22MAP Client, a program to generate detailed musculoskeletal models for OpenSim.
33 Copyright (C) 2012 University of Auckland
44
5- This file is part of MAP Client. (http ://launchpad.net/mapclient)
5+ This file is part of MAP Client. (https ://launchpad.net/mapclient)
66
77 MAP Client is free software: you can redistribute it and/or modify
88 it under the terms of the GNU General Public License as published by
2020import os
2121import logging
2222import shutil
23- import glob
24- import zipfile
2523
2624from PySide6 import QtCore , QtWidgets , QtGui
2725
5654
5755class WorkflowWidget (QtWidgets .QWidget ):
5856
59- def __init__ (self , mainWindow ):
60- QtWidgets .QWidget .__init__ (self , parent = mainWindow )
61- self ._main_window = mainWindow
57+ def __init__ (self , main_window ):
58+ QtWidgets .QWidget .__init__ (self , parent = main_window )
59+ self ._main_window = main_window
6260 self ._ui = Ui_WorkflowWidget ()
6361 self ._ui .setupUi (self )
6462
@@ -70,7 +68,7 @@ def __init__(self, mainWindow):
7068 self ._graphicsScene = WorkflowGraphicsScene (self )
7169
7270 self ._ui .graphicsView .setScene (self ._graphicsScene )
73- self ._ui .graphicsView .setMainWindow (mainWindow )
71+ self ._ui .graphicsView .setMainWindow (main_window )
7472
7573 self ._ui .graphicsView .setUndoStack (self ._undoStack )
7674 self ._graphicsScene .setUndoStack (self ._undoStack )
@@ -130,6 +128,8 @@ def _update_ui(self):
130128 # self.action_Continue.setEnabled(workflow_open and not widget_visible)
131129 self .action_Reverse .setEnabled (workflow_open and not widget_visible )
132130 self .action_Abort .setEnabled (workflow_open and not widget_visible )
131+ self .action_SpringLayout .setEnabled (workflow_open and widget_visible and workflow_has_steps )
132+ self .action_ForceDirectedLayout .setEnabled (workflow_open and widget_visible and workflow_has_steps )
133133 self .action_Import_CFG .setEnabled (workflow_open and widget_visible and workflow_has_steps )
134134 self .action_Export_CFG .setEnabled (workflow_open and widget_visible and workflow_has_steps )
135135 self .action_ZoomIn .setEnabled (widget_visible )
@@ -208,6 +208,12 @@ def _abort_workflow(self):
208208 self ._abort_execution ()
209209 self ._reset_workflow_direction ()
210210
211+ def _spring_force_layout (self ):
212+ self ._main_window .layout_workflow ("spring_force" )
213+
214+ def _force_directed_layout (self ):
215+ self ._main_window .layout_workflow ("force_directed" )
216+
211217 def _reverse_workflow_direction (self ):
212218 self ._main_window .set_workflow_direction (not self .action_Reverse .isChecked ())
213219
@@ -443,7 +449,7 @@ def performWorkflowChecks(self, workflow_dir):
443449 5. Check for errors
444450 6. Update step tree
445451 """
446- # wm = self._mainWindow .model().workflowManager()
452+ # wm = self._main_window .model().workflowManager()
447453 pm = self ._main_window .model ().pluginManager ()
448454 steps_to_install = pm .checkPlugins (workflow_dir )
449455 dependencies_to_install = pm .checkDependencies (workflow_dir )
@@ -454,7 +460,7 @@ def performWorkflowChecks(self, workflow_dir):
454460 if download_plugins :
455461 self .installMissingPlugins (steps_to_install )
456462
457- # pm = self._mainWindow .model().pluginManager()
463+ # pm = self._main_window .model().pluginManager()
458464 # pm.load()
459465 if pm .haveErrors ():
460466 self ._main_window ._show_plugin_errors_dialog ()
@@ -688,6 +694,14 @@ def _create_menu_items(self):
688694 self ._set_action_properties (self .action_Abort , 'action_Abort' , self ._abort_workflow , '' ,
689695 'Abort Workflow' )
690696
697+ menu_workflow_layout = QtWidgets .QMenu ('Layout' , menu_workflow )
698+ self .action_SpringLayout = QtGui .QAction ('Spring force' , menu_workflow_layout )
699+ self ._set_action_properties (self .action_SpringLayout , 'action_SpringLayout' , self ._spring_force_layout , '' ,
700+ 'Layout the current workflow using a spring force algorithm' )
701+ self .action_ForceDirectedLayout = QtGui .QAction ('Force directed' , menu_workflow_layout )
702+ self ._set_action_properties (self .action_ForceDirectedLayout , 'action_ForceDirectedLayout' , self ._force_directed_layout , '' ,
703+ 'Layout the current workflow using a force directed algorithm' )
704+
691705 self .action_ZoomIn = QtGui .QAction ('Zoom In' , menu_view )
692706 self ._set_action_properties (self .action_ZoomIn , 'action_ZoomIn' , self .zoom_in , 'Ctrl++' ,
693707 'Zoom in Workflow' )
@@ -723,6 +737,10 @@ def _create_menu_items(self):
723737 # menu_workflow.addAction(self.action_Continue)
724738 menu_workflow .addAction (self .action_Reverse )
725739 menu_workflow .addAction (self .action_Abort )
740+ menu_workflow .addSeparator ()
741+ menu_workflow .addMenu (menu_workflow_layout )
742+ menu_workflow_layout .addAction (self .action_SpringLayout )
743+ menu_workflow_layout .addAction (self .action_ForceDirectedLayout )
726744
727745 def _update_recent_menu (self ):
728746 absolute_paths = self ._main_window .model ().optionsManager ().getOption (RECENTS_ABSOLUTE_PATHS )
0 commit comments