예제 #1
0
def save_workspace(workspace_name):

    # Grabs the status bar object to check current message
    status = squish.waitForObject(cvi42Objects.statusBar)

    # Saves workspace as name given
    squish.activateItem(
        squish.waitForObjectItem(cvi42Objects.menuBar, "Workspace"))
    squish.activateItem(
        squish.waitForObjectItem(cvi42Objects.workspaceButton,
                                 "Save Workspace As"))
    squish.waitForObject(
        cvi42Objects.workspaceWindowEdit).setText(workspace_name)
    squish.clickButton(
        squish.waitForObject(cvi42Objects.workspaceWindowOkButton))

    start = time.time()
    while True:
        if status.currentMessage() == "Save workspace done.":
            break
        else:
            pass
    end = time.time()

    test.log("Saving workspace: %.2f" % (end - start))

    return
예제 #2
0
def export_study(study_name):

    # status bar
    status = squish.waitForObject(cvi42Objects.statusBar)

    # Searches for study, and exports
    squish.waitForObject(cvi42Objects.patientlistEditBox).setText(study_name)
    squish.openContextMenu(
        squish.waitForObjectItem(cvi42Objects.studyTreeitem, study_name), 50,
        5, 0)
    squish.activateItem(
        squish.waitForObjectItem(cvi42Objects.contextMenu, "Export Study"))

    # export dialog flow
    squish.mouseClick(
        squish.waitForObjectItem(":splitter.sidebar_QSidebar", "My Computer"),
        53, 13, 0, squish.Qt.LeftButton)
    squish.mouseClick(
        squish.waitForObjectItem(":stackedWidget.treeView_QTreeView",
                                 "DATA (D:)"), 33, 14, 0, squish.Qt.LeftButton)
    squish.doubleClick(
        squish.waitForObjectItem(":stackedWidget.treeView_QTreeView",
                                 "DATA (D:)"), 34, 11, 0, squish.Qt.LeftButton)
    squish.clickButton(squish.waitForObject(":dcmBrowser.Choose_QPushButton"))

    start = time.time()
    while True:
        if status.currentMessage() == "Export Images done":
            break
        else:
            pass
    end = time.time()

    test.log("Time to export study: %.2f" % (end - start))
예제 #3
0
def reset_workspace():

    menuBar = ":cmr42MainWindow.appMenuBar_QMenuBar"
    workspaceButton = ":cmr42MainWindow.workspaceMenu_QMenu"
    resetWorkspaceButtonOk = ":Reset Workspace.Reset_QPushButton"

    squish.activateItem(squish.waitForObjectItem(menuBar, "Workspace"))
    squish.activateItem(
        squish.waitForObjectItem(workspaceButton, "Reset Workspace"))
    squish.clickButton(squish.waitForObject(resetWorkspaceButtonOk))
    #     squish.snooze(2)

    return
예제 #4
0
def load_workspace(workspace_name):

    workspace = "{column='0' container=':pLoadWorkspaceDialog.workspacesWidget_QTreeWidget' text='%s' type='QModelIndex'}" % workspace_name
    menuBar = ":cmr42MainWindow.appMenuBar_QMenuBar"
    workspaceButton = ":cmr42MainWindow.workspaceMenu_QMenu"

    squish.activateItem(squish.waitForObjectItem(menuBar, "Workspace"))
    squish.activateItem(
        squish.waitForObjectItem(workspaceButton, "Load Workspace"))

    squish.doubleClick(squish.waitForObject(workspace))
    #     squish.snooze(2)

    return
예제 #5
0
def close_study():

    squish.activateItem(
        squish.waitForObjectItem(cvi42Objects.menuBar, "Workspace"))
    squish.snooze(0.5)
    squish.activateItem(
        squish.waitForObjectItem(cvi42Objects.workspaceButton, "Close Study"))
    start = time.time()

    while True:
        if object.exists(cvi42Objects.patientlistEditBox) is True:
            break
        else:
            pass
    end = time.time()

    test.log("Time to close study: %.2f" % (end - start))

    return
예제 #6
0
 def accountAction(self, action):
     squish.sendEvent(
         "QMouseEvent",
         squish.waitForObject(self.ACCOUNT_BUTTON),
         squish.QEvent.MouseButtonPress,
         0,
         0,
         squish.Qt.LeftButton,
         0,
         0,
     )
     squish.activateItem(squish.waitForObjectItem(self.ACCOUNT_MENU,
                                                  action))
예제 #7
0
def anonymize_study(study, anon_name):

    # If user is not in patient list page condition
    if object.exists(cvi42Objects.returnPatientlistButton) is True:
        squish.clickButton(
            squish.waitForObject(cvi42Objects.returnPatientlistButton))

    # Grabs the status bar object to check current message
    status = squish.waitForObject(cvi42Objects.statusBar)

    if "\\" in study:
        studyUpdated = study.replace("\\", "")
    else:
        studyUpdated = study

    # Searches for study, and anonymizes
    squish.waitForObject(cvi42Objects.patientlistEditBox).setText(studyUpdated)

    squish.openContextMenu(
        squish.waitForObjectItem(cvi42Objects.studyTreeitem, study), 50, 5, 0)

    squish.activateItem(
        squish.waitForObjectItem(cvi42Objects.contextMenu, "Anonymize Study"))
    squish.waitForObject(cvi42Objects.anonymizeEditBox).setText(anon_name)
    squish.clickButton(squish.waitForObject(cvi42Objects.anonymizeOkButton))

    start = time.time()
    #     squish.snooze(4)

    while True:
        if status.currentMessage() == "Import Study done":
            break
        else:
            pass
    end = time.time()

    test.log("Anonymizing %s time: %.2f" % (study, (end - start)))

    return anon_name
예제 #8
0
def delete_study(study_name):

    squish.waitForObject(cvi42Objects.patientlistEditBox).setText(study_name)
    squish.openContextMenu(
        squish.waitForObjectItem(cvi42Objects.studyTreeitem, study_name), 50,
        13, 0)
    squish.activateItem(
        squish.waitForObjectItem(cvi42Objects.contextMenu, "Delete Study"))
    #     squish.snooze(1)
    squish.clickButton(squish.waitForObject(cvi42Objects.DeleteStudyOkButton))
    start = time.time()

    while True:
        if object.exists(cvi42Objects.UpdatingStudyListMessage):
            break
        else:
            pass
    end = time.time()

    #     test.log("Time to delete study: %.2f" %(end-start))

    squish.waitForObject(cvi42Objects.patientlistEditBox).setText("")

    return
예제 #9
0
    def selectFoldersToSync(self, context):
        self.openSyncDialog()

        # first deselect all
        squish.mouseClick(
            squish.waitForObject(self.SYNC_DIALOG_ROOT_FOLDER),
            11,
            11,
            squish.Qt.NoModifier,
            squish.Qt.LeftButton,
        )
        for row in context.table[1:]:
            squish.mouseClick(
                squish.waitForObjectItem(self.SYNC_DIALOG_FOLDER_TREE, "/." + row[0]),
                11,
                11,
                squish.Qt.NoModifier,
                squish.Qt.LeftButton,
            )
        squish.clickButton(squish.waitForObject(self.SYNC_DIALOG_OK_BUTTON))
예제 #10
0
def click_ml(button):
    
    toolBarObject = ":cmr42MainWindow.ToolBar_QToolBar"
    contextWindow = ":cmr42MainWindow_QMenu"
    
#     # If button exists in toolbar, clicks otherwise, find button
#     children = find_children_by_text(squish.waitForObject(toolBarObject), button)
    
    contextButton = find_context_menu(button)
    squish.openContextMenu(squish.waitForObject(contextButton), 30, 20, 0)
    squish.activateItem(squish.waitForObjectItem(contextWindow, button))
#         squish.snooze(1)
    
    squish.clickButton(squish.waitForObject(contextButton))

    # Wait for progress bar 
    time = studyFunctions.loading_time()
 
    test.log("Short3d %s: %.2f "% (button, time))
    return
예제 #11
0
    def selectCollaborator(self, receiver, isGroup=False):
        postFixInSuggestion = ""
        if isGroup:
            postFixInSuggestion = " (group)"

        squish.mouseClick(
            squish.waitForObject(self.SHARE_WITH_COLLABORATOR_INPUT_FIELD),
            0,
            0,
            squish.Qt.NoModifier,
            squish.Qt.LeftButton,
        )
        squish.type(
            squish.waitForObject(self.SHARE_WITH_COLLABORATOR_INPUT_FIELD),
            receiver,
        )
        squish.mouseClick(
            squish.waitForObjectItem(self.SUGGESTED_COLLABORATOR,
                                     receiver + postFixInSuggestion),
            0,
            0,
            squish.Qt.NoModifier,
            squish.Qt.LeftButton,
        )
예제 #12
0
 def performAction(self, action):
     squish.openContextMenu(
         squish.waitForObjectItem(self.ACTION_MENU, "_1"), 0, 0,
         squish.Qt.NoModifier)
     squish.activateItem(
         squish.waitForObjectItem(names.settings_QMenu, action))
예제 #13
0
def load(study, ct=False):

    studyWindow = "{text='%s' type='QAction' unnamed='1' visible='true'}" % study

    # If study is already loaded condition
    if object.exists(studyWindow) is True:
        return

    # If user is not in patient list page condition
    if object.exists(cvi42Objects.returnPatientlistButton) is True:
        squish.clickButton(
            squish.waitForObject(cvi42Objects.returnPatientlistButton))

    # Grabs the status bar object to check current message
    status = squish.waitForObject(cvi42Objects.statusBar)

    if "\\" in study:
        studyUpdated = study.replace("\\", "")
    else:
        studyUpdated = study

    # Search for study in patient list
    squish.waitForObject(cvi42Objects.patientlistEditBox).setText(studyUpdated)
    squish.doubleClick(
        squish.waitForObjectItem(cvi42Objects.studyTreeitem, study), 22, 7, 0,
        squish.Qt.LeftButton)
    start = time.time()

    if ct == False:
        while True:
            # Wait until 'Loading Study done' message appears on statusbar
            if status.currentMessage() == "Loading Study done":
                end = time.time()
                test.log("Loading Study time: %.2f" % (end - start))
                break

            # If study already opened by another user condition
            if object.exists(cvi42Objects.studyOpenWindow) is True:
                squish.clickButton(
                    squish.waitForObject(cvi42Objects.studyOpenOK))

            # If study already opened, exit patient list window
            if status.currentMessage() == "Study Already Open":
                squish.clickButton(
                    squish.waitForObject(cvi42Objects.returnStudyButton))
                break

            # If study already loaded, exit patient list window
            if status.currentMessage() == "Study is already loaded.":
                squish.clickButton(
                    squish.waitForObject(cvi42Objects.returnStudyButton))
                break

        # If indication prompt is present
        if object.exists(cvi42Objects.SelectIndicationHeader) is True:
            squish.doubleClick(
                squish.waitForObject(cvi42Objects.NoIndicationButton))

    else:
        while True:
            # Wait until 'Select indication is on the screen'
            if object.exists(cvi42Objects.SelectIndicationHeader) is True:
                end = time.time()
                test.log("Loading Study time: %.2f" % (end - start))

                squish.doubleClick(
                    squish.waitForObject(cvi42Objects.NoIndicationButton))

                break

            # If study already opened by another user condition
            if object.exists(cvi42Objects.studyOpenWindow) is True:
                squish.clickButton(
                    squish.waitForObject(cvi42Objects.studyOpenOK))

            # If study already opened, exit patient list window
            if status.currentMessage() == "Study Already Open":
                squish.clickButton(
                    squish.waitForObject(cvi42Objects.returnStudyButton))
                break

            if object.exists(
                    ":mWorkflowDockWidget.mIndicationLabel_QLabel") is True:
                end = time.time()
                test.log("Loading Study time: %.2f" % (end - start))
                break
    return
예제 #14
0
def click_module(module, ct=False):

    counter = 0
    moduleListItem = "{container=':mWorkflowDockWidget.protocolSteps_Workflow::ProtocolStepListWidget' text='%s' type='QModelIndex'}" % module

    # If the study is MR, the icon of the selected module is available in the toolbar. Checks if module already selected
    if ct == False:
        if object.exists(cvi42Objects.toolbarModuleButton) is True:
            if squish.waitForObject(
                    cvi42Objects.toolbarModuleButton).text == module:
                #                 test.log("Module Already Loaded")
                return

    while True:
        # If module not in the module list, search for it
        if object.exists(moduleListItem) is False:

            if counter == 0:
                # If module list scroll bar available, mouse scroll to try and find module
                if object.exists(cvi42Objects.moduleListScrollbar):
                    # Mouse scrolls up all the way to see top of visible module list
                    squish.sendEvent(
                        "QWheelEvent",
                        squish.waitForObject(cvi42Objects.moduleListScrollbar),
                        103, 527, 540, 0, 2)

                    # If module is visible, click it, and exit loop
                    if object.exists(moduleListItem) is True:
                        squish.mouseClick(squish.waitForObject(moduleListItem))

                        time = loading_time()
                        if time > 10:
                            test.log("Time to load module: %.2f" % time)
                        break

                    # If scroll bar available, scroll down a little bit each iteration
                    squish.sendEvent(
                        "QWheelEvent",
                        squish.waitForObject(cvi42Objects.moduleListScrollbar),
                        3, 307, -340, 0, 2)

                # If mouse scroll bar not available, pass each time
                else:
                    pass

            counter += 1

            # After four attempts, if module is not found, select it from the protocol list and click the module
            if counter == 4:
                squish.mouseClick(
                    squish.waitForObject(cvi42Objects.addProtocolButton))
                squish.activateItem(
                    squish.waitForObjectItem(cvi42Objects.addProtocolWindow,
                                             module))

                squish.mouseClick(squish.waitForObject(moduleListItem))

                time = loading_time()
                if time > 10:
                    test.log("Time to load module: %.2f" % time)

                return

        # If module exists from the beginning, select it and exit
        else:
            squish.mouseClick(squish.waitForObject(moduleListItem))

            time = loading_time()
            if time > 10:
                test.log("Time to load module: %.2f" % time)

            return

    return
예제 #15
0
def login(user, server):
    
    # If cvi42 already running dialog popup
    if object.exists(cvi42Objects.cviAlreadyRunning):
        squish.mouseClick(squish.waitForObject(cvi42Objects.cviAlreadyRunningOk))
    
    # If cvi42 disconnected
    if object.exists(cvi42Objects.mainDialog):
        if object.exists(cvi42Objects.LoginDialog) is False:
            test.log("Already Logged In")
            return
    
    # Grabs desired server name
    squish.mouseClick(squish.waitForObject(cvi42Objects.serverBox), 164, 7, 0, squish.Qt.LeftButton)
    squish.mouseClick(squish.waitForObjectItem(cvi42Objects.serverBox, server), 105, 8, 0, squish.Qt.LeftButton)

    # Populates username and password boxes and clicks login
    squish.mouseClick(squish.waitForObject(cvi42Objects.usernameBox))
    squish.waitForObject(cvi42Objects.usernameBox).setText(user)
    squish.waitForObject(cvi42Objects.passwordBox).setText(user)
    
    squish.clickButton(squish.waitForObject(cvi42Objects.LoginButton))   
    start = time.time()
    start2 = time.time()
        
    # If user already logged on dialog
    if object.exists(cvi42Objects.userAlreadyLoggedOn):
        squish.mouseClick(squish.waitForObject(cvi42Objects.userAlreadyLoggedOnOk))
        
    # Benchmark splash screen measurements
    splash = squish.waitForObject(cvi42Objects.splash)
    message = splash.message()
    
    counter = 0
    while True:
        try:
            if object.exists(cvi42Objects.splash):
                if message == splash.message():
                    pass
                else:
                    splash_end = time.time()
                    test.log("Time for %s: %.2f" %(message, (splash_end-start2)))
                    message = splash.message()
                    start2 = time.time()
                    
            else:
                break
        except:
            break
            
    status = squish.waitForObject(cvi42Objects.statusBar);
        
    while True:
        if status.currentMessage() == "Load image previews done":
            break
        else:
            pass

    end = time.time()
    test.log("Time to Login: %.2f" % (end-start))
    
    return