~mapclient.devs/mapclient/stable

« back to all changes in this revision

Viewing changes to plugins/mapclientplugins/imagesourcestep/step.py

  • Committer: musculoskeletal
  • Date: 2014-06-25 05:38:05 UTC
  • mfrom: (1.6.35 testing)
  • Revision ID: musculoskeletal@bioeng1033-20140625053805-jkqhi5oq74vmlntl
Merging testing into stable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
from PySide import QtGui, QtCore
23
23
 
24
 
from mountpoints.workflowstep import WorkflowStepMountPoint
25
 
from imagesourcestep.widgets.configuredialog import ConfigureDialog, ConfigureDialogState
 
24
from mapclient.mountpoints.workflowstep import WorkflowStepMountPoint
 
25
from mapclientplugins.imagesourcestep.widgets.configuredialog import ConfigureDialog, ConfigureDialogState
26
26
 
27
 
from core.threadcommandmanager import ThreadCommandManager, CommandCopyDirectory, CommandCloneWorkspace
28
 
from tools.pmr.pmrtool import PMRTool
29
 
from tools.pmr.pmrhglogindialog import PMRHgLoginDialog
 
27
from mapclient.core.threadcommandmanager import ThreadCommandManager, CommandCopyDirectory, CommandCloneWorkspace
 
28
from mapclient.tools.pmr.pmrtool import PMRTool
30
29
 
31
30
def getConfigFilename(identifier):
32
31
    return identifier + '.conf'
71
70
        self._configured = False
72
71
        self._state = ConfigureDialogState()
73
72
        self._threadCommandManager = ThreadCommandManager()
74
 
        self._threadCommandManager.registerFinishedCallback(self._threadCommandsFinished)
 
73
#         self._threadCommandManager.registerFinishedCallback(self._threadCommandsFinished)
75
74
 
76
75
    def configure(self):
77
76
        delay = False
93
92
                if d.addToPMR():
94
93
                    pmr_tool = PMRTool()
95
94
                    # Get login details:
96
 
                    dlg = PMRHgLoginDialog()
97
 
                    if dlg.exec_():
98
 
                        repourl = pmr_tool.addWorkspace(ImageSourceData.name + ': ' + self._state.identifier(), None)
99
 
                        c = CommandCloneWorkspace(repourl, step_location, dlg.username(), dlg.password())
100
 
                        self._threadCommandManager.addCommand(c)
101
 
                        self._state._pmrLocation = repourl
102
 
                        delay = True
 
95
                    repourl = pmr_tool.addWorkspace(
 
96
                        ImageSourceData.name + ': ' + self._state.identifier(),
 
97
                        None)
 
98
                    p = pmr_tool.requestTemporaryPassword(repourl)
 
99
                    username = p['user']
 
100
                    password = p['key']
 
101
                    c = CommandCloneWorkspace(repourl, step_location,
 
102
                        username, password)
 
103
                    self._threadCommandManager.addCommand(c)
 
104
                    self._state._pmrLocation = repourl
 
105
                    delay = True
 
106
 
103
107
            elif self._state._pmrLocation:
 
108
                # Get login details:
 
109
                if not os.path.exists(step_location):
 
110
                    os.mkdir(step_location)
 
111
 
 
112
                repourl = self._state._pmrLocation
 
113
 
104
114
                pmr_tool = PMRTool()
105
 
                # Get login details:
106
 
                dlg = PMRHgLoginDialog()
107
 
                if dlg.exec_():
108
 
                    if not os.path.exists(step_location):
109
 
                        os.mkdir(step_location)
110
 
                    c = CommandCloneWorkspace(self._state._pmrLocation, step_location, dlg.username(), dlg.password())
111
 
                    self._threadCommandManager.addCommand(c)
112
 
                    self._state._localLocation = step_location
113
 
                    delay = True
 
115
                p = pmr_tool.requestTemporaryPassword(repourl)
 
116
                username = p['user']
 
117
                password = p['key']
 
118
                c = CommandCloneWorkspace(repourl, step_location,
 
119
                    username, password)
 
120
                self._threadCommandManager.addCommand(c)
 
121
                self._state._localLocation = step_location
 
122
                delay = True
114
123
 
115
124
 
116
125