예제 #1
0
    def __init__(self, title, main_app, model_controller, plugin_manager):
        qt.QMainWindow.__init__(self, None, title, qt.Qt.WDestructiveClose)
        self.setWindowState(qt.Qt.WindowMaximized)
        self.setCaption(title)

        self.setIcon(
            qt.QPixmap(os.path.join(CONF.getIconsPath(), 'faraday_icon.png')))

        self._main_app = main_app
        self._model_controller = model_controller

        self._mainArea = qt.QHBox(self)
        self.setCentralWidget(self._mainArea)
        self._vb_splitter = qt.QSplitter(self._mainArea)
        self._vb_splitter.setOrientation(qt.QSplitter.Vertical)
        self._hb_splitter = qt.QSplitter(self._vb_splitter)
        self._hb_splitter.setOrientation(qt.QSplitter.Horizontal)

        self.statusBar().setSizeGripEnabled(False)

        self._shell_widgets = []
        self._notifications = []
        self._tab_manager = TabManager(self._hb_splitter)
        self._perspective_manager = PerspectiveManager(self._hb_splitter,
                                                       self._main_app)

        self._hosts_treeview = HostsBrowser(self._perspective_manager,
                                            self._model_controller, 'Hosts')
        notifier.registerWidget(self._hosts_treeview)

        self._perspective_manager.registerPerspective(self._hosts_treeview,
                                                      default=True)

        wtw = WorkspaceTreeWindow(self._perspective_manager, 'Workspaces',
                                  self._main_app.getWorkspaceManager())
        self._perspective_manager.registerPerspective(wtw)
        self._workspaces_treeview = wtw

        self._log_console = LogConsole(self._vb_splitter, 'Console')

        self._actions = dict()
        self._setupActions()

        self._menues = {}
        self._setupMenues()

        self.main_toolbar = qt.QToolBar(self, 'main toolbar')
        self._setupMainToolbar()

        self.location_toolbar = LocationToolbar(self, 'location toolbar')
        self.location_toolbar.setOffset(1500)

        self._status_bar_widgets = dict()
        self._setupStatusBar()

        self._is_shell_maximized = False

        self.shell_font = qt.QFont()
        self.shell_font.setRawName(CONF.getFont())
        self.setSizeFont()
예제 #2
0
    def __init__(self, parent, node):
        BaseNodeWidget.__init__(self, parent, node)

        mainlayout = qt.QHBoxLayout(self, 0, 0)
        mainsplit = qt.QSplitter(self)
        mainsplit.setOrientation(qt.QSplitter.Vertical)
        mainlayout.addWidget(mainsplit)

        plotsplit = qt.QSplitter(mainsplit)
        plotsplit.setOrientation(qt.QSplitter.Horizontal)

        self.accountView = AccountValuesListView(plotsplit, node)
        self.connect(self.accountView, plot.plotControlToggle, self.togglePlot)
        self.connect(self.accountView, plot.plotControlColorSelected,
                     self.colorPlot)

        self.plotFrame = plot.BasePlot(plotsplit)
        self.plotFrame.axisLabelFormat[plot.yRight] = ('f', 2, 2)
        self.plotFrame.enableAxis(plot.yLeft, False)
        self.plotZoomer = plot.BaseZoomer(self.plotFrame.canvas())

        self.executionsView = AccountExecutionsNode(mainsplit, node.executions)

        link.connect(self.accountView)
        link.connect(self.executionsView)
        self.refreshPlot()
예제 #3
0
  def __init__(self):
    qt.QWidget.__init__(self)
    self.mainWidget = qt.QWidget()
    self.mainWidget.objectName = "qSlicerAppMainWindow"
    self.mainWidget.setLayout(qt.QHBoxLayout())

    self.setupLayoutWidget()

    self.moduleFrame = qt.QWidget()
    self.moduleFrame.setLayout(qt.QVBoxLayout())
    self.widget = QuantitativeReportingWidget(self.moduleFrame)
    self.widget.setup()

    # TODO: resize self.widget.parent to minimum possible width

    self.scrollArea = qt.QScrollArea()
    self.scrollArea.setWidget(self.widget.parent)
    self.scrollArea.setWidgetResizable(True)
    self.scrollArea.setMinimumWidth(self.widget.parent.minimumSizeHint.width())

    self.splitter = qt.QSplitter()
    self.splitter.setOrientation(qt.Qt.Horizontal)
    self.splitter.addWidget(self.scrollArea)
    self.splitter.addWidget(self.layoutWidget)
    self.splitter.splitterMoved.connect(self.onSplitterMoved)

    self.splitter.setStretchFactor(0,0)
    self.splitter.setStretchFactor(1,1)
    self.splitter.handle(1).installEventFilter(self)

    self.mainWidget.layout().addWidget(self.splitter)
    self.mainWidget.show()
    def __init__(self):
        qt.QWidget.__init__(self)

        #    print slicer.dicomDatabase

        self.mainWidget = ProstateAblationSlicelet.MainWindow()

        self.setupLayoutWidget()

        self.moduleFrame = qt.QWidget()
        self.moduleFrame.setLayout(qt.QVBoxLayout())
        self.widget = ProstateAblationWidget(self.moduleFrame)
        self.widget.setup()

        # TODO: resize self.widget.parent to minimum possible width

        self.scrollArea = qt.QScrollArea()
        self.scrollArea.setWidget(self.widget.parent)
        self.scrollArea.setWidgetResizable(True)
        self.scrollArea.setMinimumWidth(
            self.widget.parent.minimumSizeHint.width())

        self.splitter = qt.QSplitter()
        self.splitter.setOrientation(qt.Qt.Horizontal)
        self.splitter.addWidget(self.scrollArea)
        self.splitter.addWidget(self.layoutWidget)
        self.splitter.splitterMoved.connect(self.onSplitterMoved)

        self.splitter.setStretchFactor(0, 0)
        self.splitter.setStretchFactor(1, 1)
        self.splitter.handle(1).installEventFilter(self)

        self.mainWidget.mainFrame.layout().addWidget(self.splitter)
        self.mainWidget.show()
예제 #5
0
    def initControls(self):
        """ initControls() -> create the plot controls

        """
        series = self.series
        connect = self.connect
        labels = self.pointLabels

        self.controlsBox = controlsbox = qt.QVBox(self)
        self.controlsGrid = controlsgrid = qt.QGrid(2, controlsbox)
        self.plotSplitter = qt.QSplitter(qt.Qt.Vertical, self)

        controlsgrid.setSpacing(self.gridSpacing)
        controlsgrid.setMargin(self.gridMargin)

        smap = [(self.seriesKey, series), ] + series.index_map.items()
        smap = [(k, v) for k, v in smap if hasattr(v, 'plot_style')]
        for key, seq in smap:
            style = getPlotStyle(seq)
            curve_check = CurveToggleCheckBox(controlsgrid, key)
            curve_color = CurveColorPickButton(controlsgrid, style.color, key)
            connect(curve_check, plotControlToggle, self.toggleCurveVisibility)
            connect(curve_color, plotControlColorSelected, self.setCurveColor)
            self.curveTools[key] = (curve_check, curve_color)

        for key in self.plotKeys:
            for side in self.trackingSides:
                labels[key][side] = TrackingPointLabel(controlsbox, side)

        lastlabel = qt.QFrame(controlsbox)
        controlsbox.setStretchFactor(lastlabel, 100)
        self.series_map = dict(smap)
예제 #6
0
    def __init__(self, parent, node):
        BaseNodeWidget.__init__(self, parent, node)

        mainsplitter = qt.QSplitter(qt.QSplitter.Vertical, self)
        orderslistview = OrderSupervisorList(mainsplitter, node)
        tabssplitter = qt.QSplitter(qt.QSplitter.Horizontal, mainsplitter)

        ordertabs = qt.QTabWidget(tabssplitter)
        ordertab = OrderTab(ordertabs, {})
        ordertabs.insertTab(ordertab, "Order")

        reporttab = ReportTab(ordertabs, [])
        ordertabs.insertTab(reporttab, "Report")

        messagestab = MessagesTab(ordertabs, {})
        ordertabs.insertTab(messagestab, "Messages")

        contracttabs = qt.QTabWidget(tabssplitter)
        contracttab = ContractTab(contracttabs, {})
        contracttabs.insertTab(contracttab, "Contract")

        layout = qt.QVBoxLayout(self)
        layout.addWidget(mainsplitter)

        for widget in (
                ordertabs,
                tabssplitter,
                contracttabs,
        ):
            widget.setMargin(0)

        for widget in (ordertab, contracttab, messagestab, reporttab):
            self.connect(orderslistview, util.sigSelectChanged,
                         widget.displayOrderItem)
            self.connect(orderslistview, util.sigOrdersUpdated,
                         widget.displayOrderItem)

        firstitem = orderslistview.firstChild()
        if firstitem:
            orderslistview.setSelected(firstitem, True)
        link.connect(orderslistview)
    def __init__(self):
        qt.QWidget.__init__(self)
        self.setLayout(qt.QVBoxLayout())
        self.mainWidget = qt.QWidget()
        self.mainWidget.objectName = "qSlicerAppMainWindow"
        self.mainWidget.setLayout(qt.QVBoxLayout())

        self.setupLayoutWidget()

        self.moduleFrame = qt.QWidget()
        self.moduleFrameLayout = qt.QVBoxLayout()
        self.moduleFrame.setLayout(self.moduleFrameLayout)

        self.buttons = qt.QFrame()
        self.buttons.setLayout(qt.QHBoxLayout())
        self.moduleFrameLayout.addWidget(self.buttons)
        self.addDataButton = qt.QPushButton("Add Data")
        self.buttons.layout().addWidget(self.addDataButton)
        self.addDataButton.connect("clicked()",
                                   slicer.app.ioManager().openAddDataDialog)
        self.loadSceneButton = qt.QPushButton("Load Scene")
        self.buttons.layout().addWidget(self.loadSceneButton)
        self.loadSceneButton.connect(
            "clicked()",
            slicer.app.ioManager().openLoadSceneDialog)

        self.zFrameRegistrationWidget = ZFrameRegistrationWithROIWidget(
            self.moduleFrame)
        self.zFrameRegistrationWidget.setup()
        self.zFrameRegistrationWidget.reloadCollapsibleButton.visible = False

        # TODO: resize self.widget.parent to minimum possible width

        self.scrollArea = qt.QScrollArea()
        self.scrollArea.setWidget(self.zFrameRegistrationWidget.parent)
        self.scrollArea.setWidgetResizable(True)
        self.scrollArea.setMinimumWidth(
            self.zFrameRegistrationWidget.parent.minimumSizeHint.width())

        self.splitter = qt.QSplitter()
        self.splitter.setOrientation(qt.Qt.Horizontal)
        self.splitter.addWidget(self.scrollArea)
        self.splitter.addWidget(self.layoutWidget)
        self.splitter.splitterMoved.connect(self.onSplitterMoved)

        self.splitter.setStretchFactor(0, 0)
        self.splitter.setStretchFactor(1, 1)
        self.splitter.handle(1).installEventFilter(self)

        self.mainWidget.layout().addWidget(self.splitter)
        self.mainWidget.show()
예제 #8
0
    def _buildPanes(self):
        """Build a PanedWidget with panes for lists and display views"""
        panedW = qt.QSplitter(Qt.Vertical, self._topLevel, "panedW")
        panedW.setSizePolicy(_ANCHOR)
        panedW.setOpaqueResize(1) # repaint often when resizing
        
        # build and manage the lists pane
        self._buildLists(panedW)

        # build and manage the display pane
        self._display = DisplayFrame(panedW)

        # set sash position
        self._display.setMinimumSize(oogui.DISPLAY_WIDTH, oogui.SASH_MIN)

        return panedW
예제 #9
0
 def horizontalSplitter(*args, **kwargs):
     return qt.QSplitter(qt.Qt.Horizontal, *args)
예제 #10
0
    def __init__(self, parent, model_controller, caption):
        qt.QVBox.__init__(self, parent)

        self._model_controller = model_controller

        self.modelUpdateTimer = qt.QTimer(self)
       
        self.__pendingModelObjectRedraws = []

        self.reindex_flag_lock = Lock()
        self.reindex_flag = False

        self.connect( self.modelUpdateTimer, qt.SIGNAL("timeout()"), self._modelObjectViewUpdater)
                                        
        self.modelUpdateTimer.start( 1000  , False)
                                                                                 

        self.setName(caption) if caption else self.setName("")

        self.setFrameStyle(qt.QFrame.Panel | qt.QFrame.Plain)
        self.setLineWidth(0)

        self._host_items = {}

                                                                                                   
        self._category_items = {}

                                                                                                
                                                                        
        self._category_tree = {}

        self.contextpopups = {}
        self._setupContextPopups()

        self.contextdispatchers = {}

                       
        self._filter = ""
        self.ix = None

        self._setupContextDispatchers()

        split = qt.QSplitter(self)
        split.setOrientation(qt.QSplitter.Vertical)

        lv = self.listview = ModelObjectListView(split)
                                     
                                       
                                         
        lv.setRootIsDecorated(True)

                                               
        self.connect( lv, qt.SIGNAL("selectionChanged()"), self._itemSelected )
        self.connect( lv, qt.SIGNAL("rightButtonPressed(QListViewItem *,const QPoint&,int)"), self._showContextMenu )
                                                        
        lv.addColumn("Hosts")
        lv.setColumnWidthMode(0,qt.QListView.Maximum)
                                                                                    

                         
        lv.setTreeStepSize(20)

                                                                           
                                                                                                  
                                                                
                                                             
        self.rootitem = None

                                            
               

                                                                           
        self.details_table = EditionTable(split)
        hbox = qt.QHBox(self)
        self.object_label = qt.QLabel("", hbox)
        self.object_label.setMinimumSize(qt.QSize(50, 25))
        self.save_button = SaveButton(hbox, self._item_save)
        self._save_callback = None

        self.prefchilds = []
예제 #11
0
    def __init__(self, ctrl, argv=None):
        QtInterface.__init__(self, ctrl, argv)

        self._changeset = None

        self._window = qt.QMainWindow()
        self._window.setCaption("Smart Package Manager %s" % VERSION)
        centerWindow(self._window)
        self._window.setMinimumSize(640, 480)
        app.connect(app, qt.SIGNAL('lastWindowClosed()'), app, qt.SLOT('quit()'))

        self._undo = []
        self._redo = []

        globals = {"self": self, "qt": qt}
        group = qt.QActionGroup(self._window, "Actions")
        self._actions = compileActions(group, ACTIONS, globals)

        class ToggleAction(qt.QAction):
        
            def __init__(self, group, name, label):
                qt.QAction.__init__(self, group, name)
                self.setToggleAction(True)
                self.setMenuText(label.replace("&","&&"))
                self._name = name
            
            def connect(self, signal, callback, userdata):
                self._callback = callback
                self._userdata = userdata
                qt.QObject.connect(self, qt.SIGNAL(signal), self.slot)
            
            def slot(self):
                self._callback(self._userdata)
         
        self._filters = {}
        for name, label in [("hide-non-upgrades", _("Hide Non-upgrades")),
                            ("hide-installed", _("Hide Installed")),
                            ("hide-uninstalled", _("Hide Uninstalled")),
                            ("hide-unmarked", _("Hide Unmarked")),
                            ("hide-unlocked", _("Hide Unlocked")),
                            ("hide-requested", _("Hide Requested")),
                            ("hide-old", _("Hide Old"))]:
            act = ToggleAction(None, name, label)
            act.connect("activated()", self.toggleFilter, name)
            self._actions[name] = act

        treestyle = sysconf.get("package-tree")
        for name, label in [("groups", _("Groups")),
                            ("channels", _("Channels")),
                            ("channels-groups", _("Channels & Groups")),
                            ("none", _("None"))]:
            act = ToggleAction(group, "tree-style-"+name, label)
            if name == treestyle:
                act.setOn(True)
            act.connect("activated()", self.setTreeStyle, name)
            self._actions["tree-style-"+name] = act

        self._menubar = self._window.menuBar()
        for MENU in MENUBAR:
             def insertmenu(menubar, menu):
                item = menu[0]
                action = self._actions[item]
                m = qt.QPopupMenu(menubar)
                text = action.menuText()
                menubar.insertItem(text, m)
                for item in menu[1]:
                    if isinstance(item, tuple):
                        insertmenu(m, item)
                    elif item:
                        action = self._actions[item]
                        #i = qt.QPopupMenu(m)
                        #text = action.menuText()
                        #m.insertItem(text, i)
                        action.addTo(m)
                    else:
                        m.insertSeparator()
             insertmenu(self._menubar, MENU)

        self._toolbar = qt.QToolBar(self._window)
        for TOOL in TOOLBAR:
            def inserttool(toolbar, tool):
                if tool:
                    action = self._actions[tool]
                    #b = qt.QToolButton(toolbar, TOOL)
                    #b.setTextLabel(action.toolTip())
                    pixmap = getPixmap(TOOLBARICONS[tool])
                    #b.setIconSet(qt.QIconSet(pixmap))
                    action.setIconSet(qt.QIconSet(pixmap))
                    action.addTo(toolbar)
                else:
                    toolbar.addSeparator()
            inserttool(self._toolbar, TOOL)

        #self._window.add_accel_group(self._ui.get_accel_group())

        self._actions["exec-changes"].setAccel(qt.QKeySequence("Ctrl+C"))
        self._actions["find"].setAccel(qt.QKeySequence("Ctrl+F"))
        self._actions["expand-all"].setAccel(qt.QKeySequence("Ctrl+O"))
        self._actions["collapse-all"].setAccel(qt.QKeySequence("Ctrl+W"))
        self._actions["summary-window"].setAccel(qt.QKeySequence("Ctrl+S"))

        self._actions["exec-changes"].setEnabled(False)
        self._actions["clear-changes"].setEnabled(False)
        self._actions["undo"].setEnabled(False)
        self._actions["redo"].setEnabled(False)

        # Search bar

        self._searchbar = qt.QToolBar(self._window)
        self._searchbar.hide()
       
        label = qt.QLabel(_("Search:"), self._searchbar)
        label.show()

        self._searchentry = qt.QLineEdit(self._searchbar)
        qt.QObject.connect(self._searchentry, qt.SIGNAL("returnPressed()"), self.refreshPackages)
        self._searchentry.show()

        button = qt.QPushButton(self._searchbar)
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self.refreshPackages)
        pixmap = getPixmap("crystal-search")
        button.setIconSet(qt.QIconSet(pixmap))
        button.show()

        buttongroup = qt.QButtonGroup(self._searchbar)
        buttongroup.hide()
        
        self._searchname = qt.QRadioButton(_("Automatic"), self._searchbar)
        self._searchname.setChecked(True)
        qt.QObject.connect(self._searchname, qt.SIGNAL("clicked()"), self.refreshPackages)
        buttongroup.insert(self._searchname)
        self._searchname.show()
        self._searchdesc = qt.QRadioButton(_("Description"), self._searchbar)
        self._searchdesc.setChecked(False)
        qt.QObject.connect(self._searchdesc, qt.SIGNAL("clicked()"), self.refreshPackages)
        self._searchdesc.show()
        buttongroup.insert(self._searchdesc)

        # Packages and information

        self._splitter = qt.QSplitter(qt.Qt.Vertical, self._window)
        self._window.setCentralWidget(self._splitter)
        
        self._pv = QtPackageView(self._splitter)
        self._pv.show()

        self._pi = QtPackageInfo(self._splitter)
        self._pi.show()
        qt.QObject.connect(self._pv, qt.PYSIGNAL("packageSelected"), self._pi.setPackage)
        qt.QObject.connect(self._pv, qt.PYSIGNAL("packageActivated"), self.actOnPackages)
        qt.QObject.connect(self._pv, qt.PYSIGNAL("packagePopup"), self.packagePopup)

        self._status = self._window.statusBar()
        self._status.show()
        
        self._legend = QtLegend(self._window)
    def setupWindow(self):
        self.setWindowTitle("lapdMouse Data Archive Browser")
        self.resize(1000, 600)

        if 'lapdMouseDBBrowser' in slicer.util.moduleNames():
            self.modulePath = slicer.modules.lapdmousedbbrowser.path.replace(
                "lapdMouseDBBrowser.py", "")
        else:
            self.modulePath = '.'
        self.downloadIcon = qt.QIcon(
            os.path.join(self.modulePath, 'Resources', 'Icons',
                         'download.png'))
        self.storedIcon = qt.QIcon(
            os.path.join(self.modulePath, 'Resources', 'Icons', 'stored.png'))
        self.logo = qt.QPixmap(
            os.path.join(self.modulePath, 'Resources', 'Icons',
                         'lapdMouseDBBrowser.png'))

        self.banner = qt.QFrame()
        self.banner.setLayout(qt.QGridLayout())
        logo = qt.QLabel()
        logo.setPixmap(self.logo)
        self.banner.layout().addWidget(logo, 0, 0)
        self.bannerTextBrowser = qt.QTextBrowser()
        self.bannerTextBrowser.setOpenExternalLinks(True)
        self.bannerTextBrowser.setMaximumHeight(120)
        text = "<h1>lapdMouse Data Archive Browser</h1>"
        text += "The lapdMouse data archive contains anatomically derived lung models and aerosol deposition measurements of mice for modeling and computational toxicology in mice."
        text += " For more details about available datasets, data representation, other software, and support, please visit the <a href=\"https://doi.org/10.25820/9arg-9w56\">lapdMouse archive</a>"
        text += "<br />This work was supported in part by NIH project R01ES023863."
        self.bannerTextBrowser.html = text
        self.banner.layout().addWidget(self.bannerTextBrowser, 0, 1)

        self.table = qt.QTableWidget(self)
        self.table.setRowCount(0)
        self.table.setColumnCount(1)
        self.table.setSizePolicy(qt.QSizePolicy.Expanding,
                                 qt.QSizePolicy.Expanding)
        self.table.setHorizontalHeaderLabels(["Dataset name"
                                              ])  #,"Status","Comment"])
        self.table.setSelectionBehavior(qt.QAbstractItemView.SelectRows)
        self.table.setSelectionMode(qt.QAbstractItemView.SingleSelection)
        self.table.horizontalHeader().setStretchLastSection(True)
        self.table.connect("itemSelectionChanged()", self.onDatasetChanged)

        self.customForm = qt.QFrame()
        self.customForm.setLayout(qt.QFormLayout())
        self.customFormName = qt.QLineEdit("", self.customForm)
        self.customFormName.readOnly = True
        self.customForm.layout().addRow("Name", self.customFormName)
        self.customFormDatasetInfo = qt.QLabel('<a href=\"' + self.projectURL +
                                               '\">info</a>')
        self.customFormDatasetInfo.setTextFormat(1)
        self.customFormDatasetInfo.setOpenExternalLinks(True)
        self.customForm.layout().addRow("Info", self.customFormDatasetInfo)
        self.customFormAction = qt.QFrame(self.customForm)
        self.customFormAction.setLayout(qt.QHBoxLayout())
        self.customFormAction.layout().setSpacing(0)
        self.customFormAction.layout().setMargin(0)
        self.customFormDownloadButton = qt.QPushButton(
            "download standard file selection", self.customFormAction)
        self.customFormAction.layout().addWidget(self.customFormDownloadButton)
        self.customFormDownloadButton.connect("clicked()",
                                              self.onDownloadDataset)
        self.customFormLoadButton = qt.QPushButton(
            "load standard file selection in Slicer", self.customFormAction)
        self.customFormAction.layout().addWidget(self.customFormLoadButton)
        self.customFormLoadButton.connect("clicked()", self.onLoadDataset)
        self.customForm.layout().addRow("Quick actions", self.customFormAction)
        self.customFormFiles = qt.QTableWidget(self.customForm)
        self.customFormFiles.setRowCount(0)
        self.customFormFiles.setColumnCount(3)
        self.customFormFiles.setHorizontalHeaderLabels(
            ["Status", "Filename", "Size"])
        self.customFormFiles.horizontalHeader().setSectionResizeMode(
            1, qt.QHeaderView.Stretch)
        self.customFormFiles.setSelectionBehavior(
            qt.QAbstractItemView.SelectRows)
        self.customFormFiles.setMinimumHeight(400)
        self.customForm.layout().addRow("Files", self.customFormFiles)

        self.customFormAction2 = qt.QFrame(self.customForm)
        self.customFormAction2.setLayout(qt.QHBoxLayout())
        self.customFormAction2.layout().setSpacing(0)
        self.customFormAction2.layout().setMargin(0)
        self.customFormDownloadButton2 = qt.QPushButton(
            "download selected files", self.customFormAction2)
        self.customFormAction2.layout().addWidget(
            self.customFormDownloadButton2)
        self.customFormDownloadButton2.connect("clicked()",
                                               self.onDownloadSelectedDataset)
        self.customFormDeleteButton2 = qt.QPushButton("delete selected files",
                                                      self.customFormAction2)
        self.customFormAction2.layout().addWidget(self.customFormDeleteButton2)
        self.customFormDeleteButton2.connect("clicked()",
                                             self.onDeleteSelectedDataset)
        self.customFormLoadButton2 = qt.QPushButton(
            "load selected files in Slicer", self.customFormAction2)
        self.customFormAction2.layout().addWidget(self.customFormLoadButton2)
        self.customFormLoadButton2.connect("clicked()",
                                           self.onLoadSelectedDataset)
        self.customForm.layout().addRow("", self.customFormAction2)

        splitView = qt.QSplitter(self)
        splitView.addWidget(self.table)
        splitView.addWidget(self.customForm)
        splitView.setSizes([200, 800])

        self.updateTable()
        self.onDatasetChanged()
        self.setMenuWidget(self.banner)
        self.setCentralWidget(splitView)
예제 #13
0
  def create(self,widgetType='window',showHeader=False,showPreview=False):
    """
    main window is a frame with widgets from the app
    widget repacked into it along with slicer-specific
    extra widgets
    """

    # find internals of widget for reference and repacking
    self.toolBar = slicer.util.findChildren(self.dicomBrowser, 'ToolBar')[0]
    self.databaseNameLabel = slicer.util.findChildren(self.dicomBrowser, 'DatabaseNameLabel')[0]
    self.databaseDirectoryButton = slicer.util.findChildren(self.dicomBrowser, 'DirectoryButton')[0]
    self.tableDensityLabel = qt.QLabel('Density: ')
    self.tableDensityLabel.objectName = 'tablesDensityLabel'
    self.tableDensityComboBox = slicer.util.findChildren(self.dicomBrowser, 'tableDensityComboBox')[0]
    self.tableDensityComboBox.connect('currentIndexChanged(QString)', self.onTableDensityComboBox)
    index = self.tableDensityComboBox.findText(self.tableDensity)
    if  (index != -1) :
      self.tableDensityComboBox.setCurrentIndex(index)

    #
    # create and configure the Slicer browser widget - this involves
    # reaching inside and manipulating the widget hierarchy
    # - TODO: this configurability should be exposed more natively
    #   in the CTK code to avoid the findChildren calls
    #
    self.tables = slicer.util.findChildren(self.dicomBrowser, 'dicomTableManager')[0]
    patientTable = slicer.util.findChildren(self.tables, 'patientsTable')[0]
    patientTableView = slicer.util.findChildren(patientTable, 'tblDicomDatabaseView')[0]
    patientSearchBox = slicer.util.findChildren(patientTable, 'leSearchBox')[0]
    studyTable = slicer.util.findChildren(self.tables, 'studiesTable')[0]
    studyTableView = slicer.util.findChildren(studyTable, 'tblDicomDatabaseView')[0]
    studySearchBox = slicer.util.findChildren(studyTable, 'leSearchBox')[0]
    seriesTable = slicer.util.findChildren(self.tables, 'seriesTable')[0]
    seriesTableView = slicer.util.findChildren(seriesTable, 'tblDicomDatabaseView')[0]
    seriesSearchBox = slicer.util.findChildren(seriesTable, 'leSearchBox')[0]
    self.tableSplitter = qt.QSplitter()
    self.tableSplitter.addWidget(patientTableView)
    self.tableSplitter.addWidget(studyTableView)
    self.tableSplitter.addWidget(seriesTableView)

    # TODO: Move to this part to CTK
    patientTableView.resizeColumnsToContents()
    studyTableView.resizeColumnsToContents()
    seriesTableView.resizeColumnsToContents()

    self.userFrame = qt.QWidget()
    self.preview = qt.QWidget()

    self.widgetType = widgetType
    if widgetType == 'dialog':
      self.window = qt.QDialog(self.dicomBrowser)
    elif widgetType == 'window':
      self.window = qt.QWidget()
    elif widgetType == 'popup':
      self.window = ctk.ctkPopupWidget(self.dicomBrowser)
      self.window.orientation = 1
      self.window.horizontalDirection = 0
      self.window.alignment = 0x82
    elif widgetType == 'dock':
      self.dock = qt.QDockWidget(slicer.util.mainWindow())
      self.dock.setFeatures( qt.QDockWidget.DockWidgetFloatable |
                                qt.QDockWidget.DockWidgetMovable |
                                qt.QDockWidget.DockWidgetClosable )
      slicer.util.mainWindow().addDockWidget(0x15, self.dock)
      self.window = qt.QFrame()
      self.dock.setWidget(self.window)
    else:
      raise "Unknown widget type - should be dialog, window, dock or popup"

    self.window.objectName = 'SlicerDICOMBrowser'

    self.setModality(not self.browserPersistent)

    self.window.setWindowTitle('DICOM Browser')

    self.layout = qt.QVBoxLayout(self.window)

    # tool row at top, with commands and database
    self.toolFrame = qt.QWidget()
    self.toolFrame.setMaximumHeight(40)
    self.toolFrame.setContentsMargins(-5,-5,-5,-5)
    self.toolLayout = qt.QHBoxLayout(self.toolFrame)
    self.layout.addWidget(self.toolFrame)
    self.toolLayout.addWidget(self.toolBar)
    self.settingsButton = ctk.ctkExpandButton()
    self.toolLayout.addWidget(self.settingsButton)
    self.toolLayout.addWidget(self.databaseNameLabel)
    self.databaseNameLabel.visible = False
    self.toolLayout.addWidget(self.databaseDirectoryButton)
    self.databaseDirectoryButton.visible = False
    self.toolLayout.addWidget(self.tableDensityLabel)
    self.tableDensityLabel.visible = False
    self.toolLayout.addWidget(self.tableDensityComboBox)
    self.tableDensityComboBox.visible = False
    self.settingsButton.connect('toggled(bool)', self.onSettingsButton)

    # enable export button and make new connection
    self.actionExport = self.dicomBrowser.findChildren('QAction', 'ActionExport')[0]
    self.actionExport.enabled = 1
    self.actionExport.connect('triggered()', self.onExportAction)

    # search row
    self.searchFrame = qt.QWidget()
    self.searchFrame.setMaximumHeight(40)
    self.searchLayout = qt.QHBoxLayout(self.searchFrame)
    self.layout.addWidget(self.searchFrame)
    patinetsLabel = qt.QLabel('Patients: ')
    self.searchLayout.addWidget(patinetsLabel)
    self.searchLayout.addWidget(patientSearchBox)
    studiesLabel = qt.QLabel('Studies: ')
    self.searchLayout.addWidget(studiesLabel)
    self.searchLayout.addWidget(studySearchBox)
    seriesLabel = qt.QLabel('Series: ')
    self.searchLayout.addWidget(seriesLabel)
    self.searchLayout.addWidget(seriesSearchBox)

    # tables goes next, spread across 1 row, 2 columns
    if self.horizontalTables:
      self.tableSplitter.setOrientation(1)
    else:
      self.tableSplitter.setOrientation(0)
    self.layout.addWidget(self.tableSplitter)

    #
    # preview related column
    #
    self.previewLayout = qt.QVBoxLayout()
    if showPreview:
      self.previewLayout.addWidget(self.preview)
    else:
      self.preview.hide()

    #
    # action related column (interacting with slicer)
    #
    self.loadableTableFrame = qt.QWidget()
    self.loadableTableFrame.setMaximumHeight(200)
    self.loadableTableLayout = qt.QFormLayout(self.loadableTableFrame)
    self.layout.addWidget(self.loadableTableFrame)

    self.loadableTableLayout.addWidget(self.userFrame)
    self.userFrame.hide()

    tableWidth = 350 if showHeader else 600
    self.loadableTable = DICOMLoadableTable(self.userFrame,width=tableWidth)

    #
    # button row for action column
    #
    self.actionButtonsFrame = qt.QWidget()
    self.actionButtonsFrame.setMaximumHeight(40)
    self.actionButtonsFrame.objectName = 'ActionButtonsFrame'
    self.layout.addWidget(self.actionButtonsFrame)

    self.actionButtonLayout = qt.QHBoxLayout()
    self.actionButtonsFrame.setLayout(self.actionButtonLayout)

    self.loadButton = qt.QPushButton('Load')
    self.loadButton.enabled = True
    self.loadButton.toolTip = 'Load Selection to Slicer'
    self.actionButtonLayout.addWidget(self.loadButton)
    self.loadButton.connect('clicked()', self.loadCheckedLoadables)

    self.headerPopup = DICOMLib.DICOMHeaderPopup()

    self.viewMetadataButton = qt.QPushButton('Metadata')
    self.viewMetadataButton.objectName = 'ActionViewMetadata'
    self.viewMetadataButton.toolTip = 'Display Metadata of the Selected Series'
    self.viewMetadataButton.enabled = False
    self.actionButtonLayout.addWidget(self.viewMetadataButton)
    self.viewMetadataButton.connect('clicked()', self.onViewHeaderButton)
    self.viewMetadataButton.connect('clicked()', self.headerPopup.open)
    self.actionButtonLayout.addStretch(1)

    self.examineButton = qt.QPushButton('Examine')
    self.actionButtonLayout.addWidget(self.examineButton)
    self.examineButton.enabled = False
    self.examineButton.connect('clicked()', self.examineForLoading)

    self.uncheckAllButton = qt.QPushButton('Uncheck All')
    self.actionButtonLayout.addWidget(self.uncheckAllButton)
    self.uncheckAllButton.connect('clicked()', self.uncheckAllLoadables)
    self.actionButtonLayout.addStretch(1)

    self.advancedViewButton = qt.QCheckBox('Advanced')
    self.advancedViewButton.objectName = 'AdvancedViewCheckBox'
    self.actionButtonLayout.addWidget(self.advancedViewButton)
    self.advancedViewButton.enabled = True
    self.advancedViewButton.checked = self.advancedView
    self.advancedViewButton.connect('clicked()', self.onAdvanedViewButton)

    self.horizontalViewCheckBox = qt.QCheckBox('Horizontal')
    self.horizontalViewCheckBox.objectName = 'HorizontalViewCheckBox'
    self.horizontalViewCheckBox.checked = self.horizontalTables
    self.horizontalViewCheckBox.connect('clicked()', self.onHorizontalViewCheckBox)
    self.actionButtonLayout.addWidget(self.horizontalViewCheckBox)
    self.toolLayout.addStretch(1)

    self.browserPersistentButton = qt.QCheckBox('Browser Persistent')
    self.browserPersistentButton.objectName = 'BrowserPersistentCheckBox'
    self.browserPersistentButton.toolTip = 'When enabled, DICOM Browser remains open after loading data or switching to another module'
    self.browserPersistentButton.checked = self.browserPersistent
    self.actionButtonLayout.addWidget(self.browserPersistentButton)
    self.browserPersistentButton.connect('stateChanged(int)', self.setBrowserPersistence)

    if self.advancedView:
      self.loadableTableFrame.visible = True
    else:
      self.loadableTableFrame.visible = False
      self.examineButton.visible = False
      self.uncheckAllButton.visible = False
    #
    # header related column (more details about the selected file)
    #
    if showHeader:
      self.headerLayout = qt.QVBoxLayout()
      self.layout.addLayout(self.headerLayout,selectionRow,2)
      self.header = DICOMHeaderWidget(self.window)
      self.headerLayout.addWidget(self.header.widget)

    #
    # Series selection
    #
    self.tables.connect('seriesSelectionChanged(QStringList)', self.onSeriesSelected)

    #
    # Plugin selection widget
    #
    self.pluginSelector = DICOMPluginSelector(self.window)
    self.loadableTableLayout.addRow(self.pluginSelector.widget,self.loadableTable.widget)
    self.checkBoxByPlugins = []

    for pluginClass in slicer.modules.dicomPlugins:
      self.checkBox = self.pluginSelector.checkBoxByPlugin[pluginClass]
      self.checkBox.connect('stateChanged(int)', self.onPluginStateChanged)
      self.checkBoxByPlugins.append(self.checkBox)
예제 #14
0
파일: wrap_pyqt.py 프로젝트: moneytech/pyvm
 def hsplitter(self):
     self.group.append(
         [qt.QSplitter(qt.Qt.Horizontal, self.group[-1][0]), 1])
예제 #15
0
파일: wrap_pyqt.py 프로젝트: moneytech/pyvm
 def vsplitter(self):
     self.group.append([qt.QSplitter(qt.Qt.Vertical, self.group[-1][0]), 1])
예제 #16
0
 def verticalSplitter(*args, **kwargs):
     return qt.QSplitter(qt.Qt.Vertical, *args)
예제 #17
0
    def __init__(self, *args, **kwargs):
        qt.QMainWindow.__init__(self, *args)

        self.filename = None
        
        self.setCaption("GUI Builder")

        toolbar = qt.QToolBar(self)
        self.cmdNew = ToolButton(toolbar, "new", self.newClicked, "create a new GUI")
        self.cmdOpen = ToolButton(toolbar, "open", self.openClicked, "open an existing GUI file")
        self.cmdSave = ToolButton(toolbar, "save", self.saveClicked, "save current GUI")
        HorizontalSpacer(toolbar, size=20)
        self.cmdLaunchGUI = ToolButton(toolbar, "launch", self.launchGUIClicked, "launch GUI (as a separate process)")
        HorizontalSpacer(toolbar, size=20)
        self.cmdViewPropertyEditor = ToolButton(toolbar, "Draw", self.showProperties, "show properties window")
        self.cmdViewGuiPreview = ToolButton(toolbar, "window_preview", self.showGuiPreview, "show GUI preview")
        self.cmdViewLog = ToolButton(toolbar, "Inform", self.showLog, "show log messages window")
        self.cmdViewHWR = ToolButton(toolbar, "view_tree", self.showHWR, "show Hardware Repository")
        HorizontalSpacer(toolbar)
        
        vbox = qt.QVBox(self)
        self.setCentralWidget(vbox) #vsplitter)
         
        hbox = qt.QSplitter(qt.Qt.Horizontal, vbox)
        self.statusbar = self.statusBar()
        self.guiEditorWindow = GUIEditorWindow(hbox)
        self.toolboxWindow = ToolboxWindow(hbox)
        
        self.logWindow = LogViewBrick.LogViewBrick(None)
        self.logWindow.setCaption("Log window")
        sw = qt.QApplication.desktop().screen().width()
        sh = qt.QApplication.desktop().screen().height()
        self.logWindow.resize(qt.QSize(sw*0.8, sh*0.2))
        self.propertyEditorWindow = PropertyEditorWindow(None)
        self.guiPreviewWindow = GUIPreviewWindow(None)
        self.hwrWindow = HWRWindow(None)

        self.configuration = self.guiEditorWindow.configuration
        
        #
        # build File menu
        #
        fileMenu = qt.QPopupMenu(self)
        fileMenu.insertItem('New', self.newClicked)
        fileMenu.insertSeparator()
        fileMenu.insertItem('Open', self.openClicked)
        fileMenu.insertSeparator()
        fileMenu.insertItem('Save', self.saveClicked)
        fileMenu.insertItem('Save as', self.saveAsClicked)
        fileMenu.insertSeparator()
        fileMenu.insertItem('Quit', self.quitClicked)
        viewMenu = qt.QPopupMenu(self)
        viewMenu.insertItem('Property Editor', self.showProperties)
        viewMenu.insertItem('GUI Preview', self.showGuiPreview)
        viewMenu.insertItem('Log window', self.showLog)
        
        #
        # build menu bar
        #
        mainMenu = self.menuBar()
        mainMenu.insertItem('File', fileMenu)
        mainMenu.insertItem('View', viewMenu)

        #
        # connections
        #
        qt.QObject.connect(self.toolboxWindow, qt.PYSIGNAL("addBrick"), self.guiEditorWindow.addBrick)
        qt.QObject.connect(self.guiEditorWindow, qt.PYSIGNAL("editProperties"), self.propertyEditorWindow.editProperties)
        qt.QObject.connect(self.guiEditorWindow, qt.PYSIGNAL("newItem"), self.propertyEditorWindow.addProperties)
        qt.QObject.connect(self.guiEditorWindow, qt.PYSIGNAL("updatePreview"), self.guiPreviewWindow.drawWindow)
        qt.QObject.connect(self.guiPreviewWindow, qt.PYSIGNAL("previewItemClicked"), self.guiEditorWindow.selectItem)
        qt.QObject.connect(self.guiEditorWindow, qt.PYSIGNAL("showProperties"), self.showProperties)
        qt.QObject.connect(self.guiEditorWindow, qt.PYSIGNAL("hideProperties"), self.hideProperties)
        qt.QObject.connect(self.guiEditorWindow, qt.PYSIGNAL("showPreview"), self.showGuiPreview)

        #
        # finish GUI
        #
        self.toolboxWindow.refresh()

        self.guiPreviewWindow.show()
예제 #18
0
    def __init__(self, *args):
        BlissWidget.__init__(self, *args)

        self.camera       = None
        self.update_disabled = False
        self.__cameraName = None

        self.__zoomList = [1.5,2,2.5,3,3.5,4]
        self.__initZoom = 2

        self.__fixWidth  = -1
        self.__fixHeight = -1

        self.__swapRgb = True
                        ####### PRINT #######
        self.__printWidget = QubPrintPreview(self)
        self.__printWidget.resize(400,500)
        printer = qt.QPrinter()
        printer.setOutputToFile(1)
        printer.setOutputFileName('/tmp/print_file.ps')
        self.__printWidget.setPrinter(printer)
        self.__printWidget.update()

        self.__beamAction    = None
        self.__scaleAction   = None
        self.__chosenActions = {}
        self.__wholeActions  = []
        self.__measureDialog = None

        ####### PRINT ACTION #######
        printAction = QubPrintPreviewAction(name="print",group="admin",withVectorMenu=True)
        printAction.previewConnect(self.__printWidget)
        self.__wholeActions.append(printAction)

        ####### SAVE IMAGE #######
        self.__saveAction = QubSaveImageAction(parent=self, label='Save falcon image',
                                               name="save", group="admin")
        self.__saveAction.setConnectCallBack(self._save_dialog_new)
        self.__wholeActions.append(self.__saveAction)
        self.__defaultSavePath = '/tmp'

        ####### UPDATE #######
        update = QubToggleAction(name="update",group="image",initState=True)
        self.connect(update,qt.PYSIGNAL("StateChanged"),self.__cameraUpdate)
        self.__wholeActions.append(update)

        ####### Start Camera ######
        startCamera = QubToggleAction(name="startCamera", group="image", iconName = 'bright-cont', initState=True)
        self.connect(startCamera, qt.PYSIGNAL("StateChanged"), self.__cameraStart)
        self.__wholeActions.append(startCamera)


        ####### BRIGHTNESS/CONTRAST #######
        self.__brightcount = QubOpenDialogAction(name="bright-cont",
                                                 iconName = 'bright-cont', group="image")
        self.__brightcount.setDialog(QubBrightnessContrastDialog(self))
        self.__wholeActions.append(self.__brightcount)

        ###### Grid TOOL ######
        self.__gridToolAction = QubOpenDialogAction(parent=self, name='grid_tool',
                                                    iconName='rectangle', label='Grid tool',
                                                    group="Tools") #place="contextmenu")
        self.__gridDialog = GridDialog(self, "Grid Dialog", flags = qt.Qt.WStyle_StaysOnTop)
        self.__gridToolAction.setConnectCallBack(self._grid_dialog_connect_hdlr)
        self.__wholeActions.append(self.__gridToolAction)

        self.__previous_pos_dict = {}
        self.__beamWidth = 0
        self.__beamHeight = 0

        ####### BEAM ACTION #######
        self.__beamAction = QubBeamAction(name="beam", group="Tools")
        self.__wholeActions.append(self.__beamAction)
        self.connect(self.__beamAction,qt.PYSIGNAL("BeamSelected"),
                     self.beamSelection)

        ####### SCALE #######
        self.__scaleAction = QubScaleAction(name='scale',group='Tools')
        self.__wholeActions.append(self.__scaleAction)
        self.__wholeActions.extend(self.__creatStdActions())

        ####### ACTION INFO #######
        actionInfo = QubInfoAction(name="actionInfo", group="image",place="statusbar")
        self.__wholeActions.append(actionInfo)

        ####### CHANGE FOREGROUND COLOR #######
        self.__fcoloraction = QubForegroundColorAction(name="color", group="image")
        self.__wholeActions.append(self.__fcoloraction)

        ####### MEASURE #######
        self.__measureAction = QubOpenDialogAction(parent=self, name='measure',
                                            iconName='measure', label='Measure',
                                            group="Tools")
        self.__measureAction.setConnectCallBack(self._measure_dialog_new)
        self.__wholeActions.append(self.__measureAction)

        # ###### POSITION TOOL ######
        # self.__posToolAction = QubOpenDialogAction(parent=self, name='pos_tool',
        #                                            iconName='circle', label='Position tool',
        #                                            group="Tools")
        # self.__posToolAction.setConnectCallBack(self._line_dialog_new)
        # self.__wholeActions.append(self.__posToolAction)

        ####### ZOOM LIST #######
        zoomActionList = QubZoomListAction(place = "toolbar",
                                           initZoom = 1,zoomValList = [0.1,0.25,0.5,0.75,1,1.5,2],
                                           show = 1,group = "zoom")
        self.__wholeActions.append(zoomActionList)

        ####### ZOOM Action #######
        self.__zoomFitOrFill = QubZoomAction(place = "toolbar",group = "zoom")
        self.__wholeActions.append(self.__zoomFitOrFill)

        ####### LINK ZOOM ACTION #######
        self.__zoomFitOrFill.setList(zoomActionList)
        zoomActionList.setActionZoomMode(self.__zoomFitOrFill)

        ####### ZOOM WINDOW #######
        self.__zoomAction = QubZoomRectangle(label='Zoom Crop',place="toolbar", show=1, group="zoom")
        self.connect(self.__zoomAction,qt.PYSIGNAL("Actif"),self.__hide_show_zoom)
        self.__wholeActions.append(self.__zoomAction)

        self.__splitter = qt.QSplitter(qt.Qt.Horizontal,self)
        self.__splitter.show()

        self.__mainVideo = QubPixmapDisplayView(self.__splitter)
        self.__mainVideo.show()
        self.__mainVideo.setScrollbarMode('Auto')
        self.__mainPlug = _MainVideoPlug(self.__mainVideo,self.__zoomAction)

        actions = self.__creatStdActions()

        ####### ZOOM LIST #######
        self.__zoomActionList = QubZoomListAction(place = "toolbar",keepROI = True,
                                                  initZoom = self.__initZoom,zoomValList = self.__zoomList,
                                                  show = 1,group = "zoom")
        actions.insert(0,self.__zoomActionList)

        ####### ZOOM Action #######
        zoomFitOrFill = QubZoomAction(place = "toolbar",keepROI = True,group = "zoom")
        zoomFitOrFill.setList(self.__zoomActionList)
        self.__zoomActionList.setActionZoomMode(zoomFitOrFill)
        actions.append(zoomFitOrFill)

        self.__zoomVideo = QubPixmapDisplayView(self.__splitter,None,actions)
        self.__zoomVideo.hide()
        self.__zoomPlug = _ZoomPlug(self.__zoomVideo)
        self.__zoomPlug.zoom().setZoom(2,2)
        self.__cbk = _rectangleZoom(self.__zoomAction,self.__zoomPlug)

        layout = qt.QHBoxLayout(self,0,0,"layout")
        layout.addWidget(self.__splitter)

        self.__image2Pixmap = QubImage2Pixmap()
        self.__image2Pixmap.plug(self.__mainPlug)
        self.__zoomPlug.setPoller(self.__image2Pixmap)

        self.__jpegDecompress = QubStdData2Image()
        self.__jpegDecompress.setSwapRGB(True)
        self.__jpeg2image = None

        ####### PROPERTY #######
        self.addProperty('camera','string','')
        self.addProperty('zoom list','string',','.join([str(x) for x in self.__zoomList]))
        self.addProperty('init zoom','integer',self.__initZoom)
        self.addProperty('swap rgb','boolean',True)

        self.addProperty('fix : width','integer',-1)
        self.addProperty('fix : height','integer',-1)

        self.addProperty('action : print','boolean',True)
        self.addProperty('action : save image','boolean',True)
        self.addProperty('action : update','boolean',True)
        self.addProperty('action : startCamera','boolean',True)
        self.addProperty('action : brightness contrast','boolean',True)
        self.addProperty('action : beam','boolean',True)
        self.addProperty('action : scale','boolean',True)
        self.addProperty('action : change foreground color','boolean',True)
        self.addProperty('action : measure','boolean',True)
        self.addProperty('action : measure (place)', 'combo', ('toolbar','contextmenu'),'toolbar')
        self.addProperty('action : zoom window','boolean',True)
        self.addProperty('action : zoom fit or fill','boolean',True)
        self.addProperty('action : zoom list','boolean',True)
        self.addProperty('action : x,y coordinates','boolean',True)
        self.addProperty('action : default color','combo',('black','red','green'),'black')

        self.addProperty('action : save image (place)',"combo",('toolbar','contextmenu'),'toolbar')
        self.addProperty('action : save image (default path)',"string",'/tmp')
        self.addProperty('action : save image (show always configure)',"boolean",True)

        self.addProperty("diffractometer", "string", "")
        self.diffractometerHwobj = None


        ####### SIGNAL #######
        self.defineSignal("BeamPositionChanged", ())

        ####### SLOT #######
        self.defineSlot("changeBeamPosition", ())
        self.defineSlot("changePixelScale",())
        self.defineSlot('getView',())
        self.defineSlot('getImage',())

        ####### LINK VIEW AND SUB VIEW #######
        mainView = self.__mainVideo.view()
        zoomView = self.__zoomVideo.view()
        mainView.addEventMgrLink(zoomView,
                                 mainView.canvas(),zoomView.canvas(),
                                 mainView.matrix(),zoomView.matrix())

        self.imageReceivedConnected = None
예제 #19
0
# SlicerLayoutCustomView = 99
# SlicerLayoutUserView = 100 

import qt
import __main__

def onModuleSelected(modulename):
  global tabWidget
  widgetRepresentation = getattr(slicer.modules, modulename.lower()).createNewWidgetRepresentation()
  widgetRepresentation.setMRMLScene(slicer.app.mrmlScene())
  #print(widgetRepresentation)
  tabWidget.addTab(widgetRepresentation, modulename)
  widgetRepresentation.enter() #update the panel

#splitter
splitter = qt.QSplitter()

leftWidget = qt.QWidget()
rightWidget = qt.QWidget()

splitter.addWidget(leftWidget)
splitter.addWidget(rightWidget)

#left layout for [add data,save data,search modules] and modules(tab)
leftLayout = qt.QVBoxLayout()
leftWidget.setLayout(leftLayout)

#right layout for 2d/3d viewer
rightLayout = qt.QVBoxLayout()
rightWidget.setLayout(rightLayout)