Skip to content

Commit 55f779b

Browse files
committed
Add option to turn on and off animation of layout changes.
1 parent e58f77b commit 55f779b

7 files changed

Lines changed: 57 additions & 29 deletions

File tree

src/mapclient/core/managers/optionsmanager.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@
77
from mapclient.settings.general import get_virtualenv_directory
88
from mapclient.settings.definitions import SHOW_STEP_NAMES, CLOSE_AFTER, METRICS_PERMISSION, INTERNAL_EXE, UNSET_FLAG, \
99
DONT_CREATE_VIRTUAL_ENV, OPTIONS_SETTINGS_TAG, INTERNAL_WORKFLOWS_AVAILABLE, INTERNAL_WORKFLOW_DIR, VIRTUAL_ENV_PATH, \
10-
GIT_EXE, PYSIDE_UIC_EXE, PYSIDE_RCC_EXE, PREVIOUS_PW_WRITE_STEP_LOCATION, PREVIOUS_PW_ICON_LOCATION, CHECK_TOOLS_ON_STARTUP, \
10+
GIT_EXE, PYSIDE_UIC_EXE, PYSIDE_RCC_EXE, PREVIOUS_PW_WRITE_STEP_LOCATION, PREVIOUS_PW_ICON_LOCATION, \
11+
CHECK_TOOLS_ON_STARTUP, \
1112
USE_EXTERNAL_GIT, USE_EXTERNAL_RCC, USE_EXTERNAL_UIC, RECENTS_ABSOLUTE_PATHS, RECENTS_LENGTH, PREVIOUS_WORKFLOW, \
12-
AUTOLOAD_PREVIOUS_WORKFLOW, METRICS_PERMISSION_ATTAINED
13+
AUTOLOAD_PREVIOUS_WORKFLOW, METRICS_PERMISSION_ATTAINED, ANIMATE_LAYOUT_UPDATES
1314

1415

1516
def _is_boolean(option):
1617
return option in [SHOW_STEP_NAMES, CHECK_TOOLS_ON_STARTUP, DONT_CREATE_VIRTUAL_ENV, METRICS_PERMISSION, USE_EXTERNAL_GIT,
17-
USE_EXTERNAL_RCC, USE_EXTERNAL_UIC, RECENTS_ABSOLUTE_PATHS, INTERNAL_WORKFLOWS_AVAILABLE, AUTOLOAD_PREVIOUS_WORKFLOW]
18+
USE_EXTERNAL_RCC, USE_EXTERNAL_UIC, RECENTS_ABSOLUTE_PATHS, INTERNAL_WORKFLOWS_AVAILABLE,
19+
AUTOLOAD_PREVIOUS_WORKFLOW, ANIMATE_LAYOUT_UPDATES]
1820

1921

2022
def _is_float(option):
@@ -32,6 +34,7 @@ def __init__(self):
3234
self._options = {
3335
SHOW_STEP_NAMES: True, CLOSE_AFTER: 2.0, METRICS_PERMISSION: False,
3436
DONT_CREATE_VIRTUAL_ENV: False, CHECK_TOOLS_ON_STARTUP: True,
37+
ANIMATE_LAYOUT_UPDATES: True,
3538
USE_EXTERNAL_GIT: False, USE_EXTERNAL_RCC: False, USE_EXTERNAL_UIC: False,
3639
RECENTS_ABSOLUTE_PATHS: False, RECENTS_LENGTH: 10,
3740
VIRTUAL_ENV_PATH: get_virtualenv_directory(), GIT_EXE: which('git'),

src/mapclient/core/managers/workflowmanager.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def abort_execution(self):
158158
def set_workflow_direction(self, direction):
159159
self._scene.set_workflow_direction(direction)
160160

161-
def layout_workflow(self, layout_algorithm):
161+
def layout_workflow(self, layout_algorithm, animate=True):
162162
graph, graph_edges, reverse_graph = self._scene.graph()
163163
view_parameters = self._scene.getViewParameters()
164164
adjacent_graph = {}
@@ -216,7 +216,6 @@ def layout_workflow(self, layout_algorithm):
216216
raise WorkflowError(f"Unknown layout algorithm: {layout_algorithm}")
217217

218218
self._iteration_count = 0
219-
animate = True
220219
if animate:
221220
self._layout_timer.start(16)
222221
else:

src/mapclient/settings/definitions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
# Options related strings
3131
OPTIONS_SETTINGS_TAG = 'Options'
3232
SHOW_STEP_NAMES = 'checkBoxShowStepNames'
33+
ANIMATE_LAYOUT_UPDATES = 'checkBoxAnimateLayoutUpdates'
3334
CLOSE_AFTER = 'doubleSpinBoxMessageBoxTimer'
3435
METRICS_PERMISSION = 'checkBoxMetricsPermission'
3536
DONT_CREATE_VIRTUAL_ENV = 'checkBoxDontCreateVirtualEnvironment'

src/mapclient/view/mainwindow.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
from mapclient.settings.info import DEFAULT_WORKFLOW_ANNOTATION_FILENAME
3030
from mapclient.settings.definitions import WIZARD_TOOL_STRING, METRICS_PERMISSION, \
3131
PMR_TOOL_STRING, PYSIDE_RCC_EXE, USE_EXTERNAL_RCC, PYSIDE_UIC_EXE, USE_EXTERNAL_UIC, \
32-
PREVIOUS_PW_WRITE_STEP_LOCATION, PREVIOUS_PW_ICON_LOCATION, USE_EXTERNAL_GIT, METRICS_PERMISSION_ATTAINED, METRICS_CLIENT_ID
32+
PREVIOUS_PW_WRITE_STEP_LOCATION, PREVIOUS_PW_ICON_LOCATION, USE_EXTERNAL_GIT, METRICS_PERMISSION_ATTAINED, \
33+
METRICS_CLIENT_ID, ANIMATE_LAYOUT_UPDATES
3334
from mapclient.view.utils import set_wait_cursor
3435
from mapclient.core.metrics import get_metrics_logger
3536

@@ -318,7 +319,8 @@ def set_workflow_direction(self, direction):
318319
self.model().workflowManager().set_workflow_direction(direction)
319320

320321
def layout_workflow(self, layout_algorithm):
321-
self.model().workflowManager().layout_workflow(layout_algorithm)
322+
om = self._model.optionsManager()
323+
self.model().workflowManager().layout_workflow(layout_algorithm, om.getOption(ANIMATE_LAYOUT_UPDATES))
322324

323325
@set_wait_cursor
324326
def set_current_widget(self, widget):

src/mapclient/view/managers/options/optionsdialog.py

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ def checkedOk(self, tool):
144144
def load(self, options):
145145
self._original_options = options
146146
step_name_option = self._ui.checkBoxShowStepNames.objectName()
147+
animate_layout_option = self._ui.checkBoxAnimateLayoutUpdates.objectName()
147148
check_tools_option = self._ui.checkBoxCheckToolsOnStartup.objectName()
148149
use_external_git_option = self._ui.checkBoxUseExternalGit.objectName()
149150
use_external_rcc_option = self._ui.checkBoxUseExternalPySideRCC.objectName()
@@ -156,6 +157,8 @@ def load(self, options):
156157
metrics_permission = self._ui.checkBoxMetricsPermission.objectName()
157158
absolute_paths = self._ui.checkBoxAbsolutePaths.objectName()
158159
recents_length = self._ui.spinBoxRecentsLength.objectName()
160+
161+
self._ui.checkBoxAnimateLayoutUpdates.setChecked(options.get(animate_layout_option, True))
159162
if step_name_option in options:
160163
self._ui.checkBoxShowStepNames.setChecked(options[step_name_option])
161164
if check_tools_option in options:
@@ -187,19 +190,22 @@ def load(self, options):
187190
self._test_tools()
188191

189192
def save(self):
190-
options = {self._ui.checkBoxShowStepNames.objectName(): self._ui.checkBoxShowStepNames.isChecked(),
191-
self._ui.checkBoxCheckToolsOnStartup.objectName(): self._ui.checkBoxCheckToolsOnStartup.isChecked(),
192-
self._ui.checkBoxUseExternalGit.objectName(): self._ui.checkBoxUseExternalGit.isChecked(),
193-
self._ui.checkBoxUseExternalPySideRCC.objectName(): self._ui.checkBoxUseExternalPySideRCC.isChecked(),
194-
self._ui.checkBoxUseExternalPySideUIC.objectName(): self._ui.checkBoxUseExternalPySideUIC.isChecked(),
195-
self._ui.lineEditPySideRCC.objectName(): self._ui.lineEditPySideRCC.text(),
196-
self._ui.lineEditPySideUIC.objectName(): self._ui.lineEditPySideUIC.text(),
197-
self._ui.lineEditGitExecutable.objectName(): self._ui.lineEditGitExecutable.text(),
198-
self._ui.lineEditInternalWorkflowDirectory.objectName(): self._ui.lineEditInternalWorkflowDirectory.text(),
199-
self._ui.doubleSpinBoxMessageBoxTimer.objectName(): self._ui.doubleSpinBoxMessageBoxTimer.value(),
200-
self._ui.checkBoxMetricsPermission.objectName(): self._ui.checkBoxMetricsPermission.isChecked(),
201-
self._ui.checkBoxAbsolutePaths.objectName(): self._ui.checkBoxAbsolutePaths.isChecked(),
202-
self._ui.spinBoxRecentsLength.objectName(): self._ui.spinBoxRecentsLength.value()}
193+
options = {
194+
self._ui.checkBoxShowStepNames.objectName(): self._ui.checkBoxShowStepNames.isChecked(),
195+
self._ui.checkBoxAnimateLayoutUpdates.objectName(): self._ui.checkBoxAnimateLayoutUpdates.isChecked(),
196+
self._ui.checkBoxCheckToolsOnStartup.objectName(): self._ui.checkBoxCheckToolsOnStartup.isChecked(),
197+
self._ui.checkBoxUseExternalGit.objectName(): self._ui.checkBoxUseExternalGit.isChecked(),
198+
self._ui.checkBoxUseExternalPySideRCC.objectName(): self._ui.checkBoxUseExternalPySideRCC.isChecked(),
199+
self._ui.checkBoxUseExternalPySideUIC.objectName(): self._ui.checkBoxUseExternalPySideUIC.isChecked(),
200+
self._ui.lineEditPySideRCC.objectName(): self._ui.lineEditPySideRCC.text(),
201+
self._ui.lineEditPySideUIC.objectName(): self._ui.lineEditPySideUIC.text(),
202+
self._ui.lineEditGitExecutable.objectName(): self._ui.lineEditGitExecutable.text(),
203+
self._ui.lineEditInternalWorkflowDirectory.objectName(): self._ui.lineEditInternalWorkflowDirectory.text(),
204+
self._ui.doubleSpinBoxMessageBoxTimer.objectName(): self._ui.doubleSpinBoxMessageBoxTimer.value(),
205+
self._ui.checkBoxMetricsPermission.objectName(): self._ui.checkBoxMetricsPermission.isChecked(),
206+
self._ui.checkBoxAbsolutePaths.objectName(): self._ui.checkBoxAbsolutePaths.isChecked(),
207+
self._ui.spinBoxRecentsLength.objectName(): self._ui.spinBoxRecentsLength.value()
208+
}
203209

204210
return options
205211

src/mapclient/view/managers/options/qt/optionsdialog.ui

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@
6060
</property>
6161
</widget>
6262
</item>
63+
<item>
64+
<widget class="QCheckBox" name="checkBoxAnimateLayoutUpdates">
65+
<property name="text">
66+
<string>Animate layout updates</string>
67+
</property>
68+
<property name="checked">
69+
<bool>true</bool>
70+
</property>
71+
</widget>
72+
</item>
6373
</layout>
6474
</widget>
6575
</item>

src/mapclient/view/managers/options/ui/ui_optionsdialog.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
################################################################################
44
## Form generated from reading UI file 'optionsdialog.ui'
55
##
6-
## Created by: Qt User Interface Compiler version 6.5.1
6+
## Created by: Qt User Interface Compiler version 6.9.1
77
##
88
## WARNING! All changes made in this file will be lost when recompiling UI file!
99
################################################################################
@@ -58,6 +58,12 @@ def setupUi(self, OptionsDialog):
5858

5959
self.verticalLayout_6.addWidget(self.checkBoxShowStepNames)
6060

61+
self.checkBoxAnimateLayoutUpdates = QCheckBox(self.groupBox)
62+
self.checkBoxAnimateLayoutUpdates.setObjectName(u"checkBoxAnimateLayoutUpdates")
63+
self.checkBoxAnimateLayoutUpdates.setChecked(True)
64+
65+
self.verticalLayout_6.addWidget(self.checkBoxAnimateLayoutUpdates)
66+
6167

6268
self.verticalLayout_4.addWidget(self.groupBox)
6369

@@ -146,7 +152,7 @@ def setupUi(self, OptionsDialog):
146152

147153
self.verticalLayout_4.addWidget(self.groupBox_4)
148154

149-
self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
155+
self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding)
150156

151157
self.verticalLayout_4.addItem(self.verticalSpacer)
152158

@@ -174,7 +180,7 @@ def setupUi(self, OptionsDialog):
174180
self.labelPySideRCC = QLabel(self.groupBoxStepWizard)
175181
self.labelPySideRCC.setObjectName(u"labelPySideRCC")
176182

177-
self.formLayout.setWidget(0, QFormLayout.LabelRole, self.labelPySideRCC)
183+
self.formLayout.setWidget(0, QFormLayout.ItemRole.LabelRole, self.labelPySideRCC)
178184

179185
self.horizontalLayoutPySideRCC = QHBoxLayout()
180186
self.horizontalLayoutPySideRCC.setObjectName(u"horizontalLayoutPySideRCC")
@@ -189,12 +195,12 @@ def setupUi(self, OptionsDialog):
189195
self.horizontalLayoutPySideRCC.addWidget(self.pushButtonPySideRCC)
190196

191197

192-
self.formLayout.setLayout(0, QFormLayout.FieldRole, self.horizontalLayoutPySideRCC)
198+
self.formLayout.setLayout(0, QFormLayout.ItemRole.FieldRole, self.horizontalLayoutPySideRCC)
193199

194200
self.labelPySideUIC = QLabel(self.groupBoxStepWizard)
195201
self.labelPySideUIC.setObjectName(u"labelPySideUIC")
196202

197-
self.formLayout.setWidget(1, QFormLayout.LabelRole, self.labelPySideUIC)
203+
self.formLayout.setWidget(1, QFormLayout.ItemRole.LabelRole, self.labelPySideUIC)
198204

199205
self.horizontalLayoutPySideUIC = QHBoxLayout()
200206
self.horizontalLayoutPySideUIC.setObjectName(u"horizontalLayoutPySideUIC")
@@ -209,7 +215,7 @@ def setupUi(self, OptionsDialog):
209215
self.horizontalLayoutPySideUIC.addWidget(self.pushButtonPySideUIC)
210216

211217

212-
self.formLayout.setLayout(1, QFormLayout.FieldRole, self.horizontalLayoutPySideUIC)
218+
self.formLayout.setLayout(1, QFormLayout.ItemRole.FieldRole, self.horizontalLayoutPySideUIC)
213219

214220

215221
self.verticalLayout_3.addLayout(self.formLayout)
@@ -235,7 +241,7 @@ def setupUi(self, OptionsDialog):
235241

236242
self.lineEditGitExecutable = QLineEdit(self.groupBoxPMR)
237243
self.lineEditGitExecutable.setObjectName(u"lineEditGitExecutable")
238-
sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
244+
sizePolicy = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed)
239245
sizePolicy.setHorizontalStretch(1)
240246
sizePolicy.setVerticalStretch(0)
241247
sizePolicy.setHeightForWidth(self.lineEditGitExecutable.sizePolicy().hasHeightForWidth())
@@ -265,7 +271,7 @@ def setupUi(self, OptionsDialog):
265271

266272
self.horizontalLayout = QHBoxLayout()
267273
self.horizontalLayout.setObjectName(u"horizontalLayout")
268-
self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
274+
self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
269275

270276
self.horizontalLayout.addItem(self.horizontalSpacer)
271277

@@ -280,7 +286,7 @@ def setupUi(self, OptionsDialog):
280286

281287
self.verticalLayout_2.addWidget(self.groupBoxOutput)
282288

283-
self.verticalSpacer_2 = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
289+
self.verticalSpacer_2 = QSpacerItem(20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding)
284290

285291
self.verticalLayout_2.addItem(self.verticalSpacer_2)
286292

@@ -304,6 +310,7 @@ def retranslateUi(self, OptionsDialog):
304310
self.groupBox.setTitle("")
305311
self.checkBoxCheckToolsOnStartup.setText(QCoreApplication.translate("OptionsDialog", u"Check tools on application start", None))
306312
self.checkBoxShowStepNames.setText(QCoreApplication.translate("OptionsDialog", u"Show step names", None))
313+
self.checkBoxAnimateLayoutUpdates.setText(QCoreApplication.translate("OptionsDialog", u"Animate layout updates", None))
307314
self.groupBoxInternalWorkflowDirectory.setTitle(QCoreApplication.translate("OptionsDialog", u"Internal workflow directory", None))
308315
#if QT_CONFIG(tooltip)
309316
self.pushButtonInternalWorkflowDirectory.setToolTip(QCoreApplication.translate("OptionsDialog", u"Select the internal workflow directory.", None))

0 commit comments

Comments
 (0)