def setupChildApps(self, seq):
        """ setupChildApps() -> make child processes from their definitions

        """
        self.child_apps = child_apps = []
        self.child_partials = child_partials = {}

        for child_def in seq:
            title, command = child_def[0:2]
            name = title.strip()

            page = qt.QWidget(self.processTabs, name + 'Page')
            layout = qt.QHBoxLayout(page, 4, 4, name + 'Layout')
            textedit = StdOutTextEdit(page, name + 'TextEdit')
            layout.addWidget(textedit)
            self.processTabs.insertTab(page, title)

            process = qt.QProcess()
            process.title = title
            for arg in str(command).split():
                process.addArgument(arg)

            stdout_call = \
                base.PartialCall(self.handleReadyStdout,
                                 process=process, textwidget=textedit)
            exit_call = \
                base.PartialCall(self.handleChildExit,
                                 process=process, textwidget=textedit)
            child_partials[name] = (stdout_call, exit_call)

            self.connect(process, qt.SIGNAL('readyReadStdout()'), stdout_call)
            self.connect(process, qt.SIGNAL('processExited()'), exit_call)
            child_apps.append((name, textedit, process))
Exemplo n.º 2
0
 def __init__(self, master, gcode, colnam, scode, ecode, dims, rclick):
     self.master = master
     self.this = ___qtlist___.___qrrclist___(master.group[-1][0])
     self.root = [self.this]
     for i in colnam:
         self.this.addColumn(i)
     self.keyn = len(colnam)
     self.this.setAllColumnsShowFocus(True)
     self.implant('gcode', gcode)
     self.ecode = ecode
     self.scode = scode
     self.rclick = rclick
     if dims != (0, 0):
         fm = self.this.fontMetrics()
         if dims[0] != 0:
             self.this.setMinimumWidth(dims[0] * fm.width('g'))
         if dims[1] != 0:
             self.this.setMinimumHeight(dims[1] * fm.height())
     master.win.connect(self.this, qt.SIGNAL("clicked (QListViewItem*)"),
                        self.dostuff1)
     master.win.connect(self.this,
                        qt.SIGNAL("doubleClicked (QListViewItem*)"),
                        self.dostuff2)
     master.win.connect(self.this,
                        qt.SIGNAL("returnPressed (QListViewItem*)"),
                        self.dostuff2)
     self.reload()
Exemplo n.º 3
0
    def __init__(self, *args):
        BlissWidget.__init__(self, *args)
        self.__pid = -1
        self.__cmd = None
        self.__userHost = None
        self.__stringFont = None
        self.__startIdle = qt.QTimer(self)
        qt.QObject.connect(self.__startIdle, qt.SIGNAL("timeout()"),
                           self.__idleRun)

        self.__container = qttools.QtXEmbedContainer(self)
        qt.QObject.connect(self.__container, qt.SIGNAL("clientClosed()"),
                           self.run)
        layout = qt.QVBoxLayout(self)
        layout.addWidget(self.__container)
        self.__container.setSizePolicy(qt.QSizePolicy.Expanding,
                                       qt.QSizePolicy.Expanding)
        self.__container.setSizeIncrement(1, 12)
        qt.QObject.connect(qt.qApp, qt.SIGNAL("aboutToQuit()"),
                           self.__killTerm)

        ####### PROPERTY #######
        self.addProperty("command", "string", "")
        self.addProperty("users@host", "string", "")
        self.addProperty("font", "string", "")
Exemplo n.º 4
0
    def __init__(self, parent, name, **kwargs):
        BaseGraphicScan.__init__(self,
                                 parent,
                                 name,
                                 uifile='Mesh.ui',
                                 cmd_name='mesh',
                                 **kwargs)

        self.__rect = None

        meshTable = self._widgetTree.child('__table')
        qt.QObject.connect(meshTable, qt.SIGNAL('valueChanged(int,int)'),
                           self._valueChangedScanParam)
        gButton = self._widgetTree.child('__grabButton')
        meshTable.setColumnReadOnly(5, True)

        filloutButton = self._widgetTree.child('__fillout')
        qt.QObject.connect(filloutButton, qt.SIGNAL('clicked()'),
                           self.__fillout)

        # TABLE SIZE HACKED
        height = meshTable.rowHeight(0) * (meshTable.numRows() + 1) + 5
        vheaders = meshTable.verticalHeader()
        hheaders = meshTable.horizontalHeader()
        width = vheaders.headerWidth() + hheaders.headerWidth() + 5
        meshTable.setMaximumSize(width, height)
        meshTable.setMinimumSize(width, height)
Exemplo n.º 5
0
 def __init__(self, parent):
     vBoxLayout = qt.QVBoxLayout(parent)
     aiaaGroupBox = ctk.ctkCollapsibleGroupBox()
     aiaaGroupBox.title = 'AI-Assisted Annotation Server'
     aiaaGroupLayout = qt.QFormLayout(aiaaGroupBox)
     serverUrl = qt.QLineEdit()
     aiaaGroupLayout.addRow('Server address:', serverUrl)
     parent.registerProperty('NVIDIA-AIAA/serverUrl', serverUrl, 'text',
                             str(qt.SIGNAL('textChanged(QString)')))
     serverUrlHistory = qt.QLineEdit()
     aiaaGroupLayout.addRow('Server address history:', serverUrlHistory)
     parent.registerProperty('NVIDIA-AIAA/serverUrlHistory',
                             serverUrlHistory, 'text',
                             str(qt.SIGNAL('textChanged(QString)')))
     compressDataCheckBox = qt.QCheckBox()
     compressDataCheckBox.checked = True
     compressDataCheckBox.toolTip = 'Enable this option on computer with slow network upload speed. Data compression reduces network transfer time but increases preprocessing time.'
     aiaaGroupLayout.addRow('Compress data:', compressDataCheckBox)
     compressDataMapper = ctk.ctkBooleanMapper(
         compressDataCheckBox, 'checked', str(qt.SIGNAL('toggled(bool)')))
     parent.registerProperty('NVIDIA-AIAA/compressData', compressDataMapper,
                             'valueAsInt',
                             str(qt.SIGNAL('valueAsIntChanged(int)')))
     vBoxLayout.addWidget(aiaaGroupBox)
     vBoxLayout.addStretch(1)
Exemplo n.º 6
0
    def __init__(self, parent = None, name = "task_toolbox"):
        qt.QWidget.__init__(self, parent, name)

        # Data atributes
        self.shape_history = None
        self.tree_brick = None
        self.previous_page_index = 0

        #Layout
        self.v_layout = qt.QVBoxLayout(self)
        self.v_layout.setSpacing(10)
        self.method_group_box = qt.QVGroupBox("Collection method", self)
        font = self.method_group_box.font()
        font.setPointSize(12)
        self.method_group_box.setFont(font)
    
        self.tool_box = qt.QToolBox(self.method_group_box , "tool_box")
        self.tool_box.setFixedWidth(475)
        font = self.tool_box.font()
        font.setPointSize(10)
        self.tool_box.setFont(font)
        
        self.discrete_page = CreateDiscreteWidget(self.tool_box, "Discrete",)
        self.discrete_page.setBackgroundMode(qt.QWidget.PaletteBackground)
        self.char_page = CreateCharWidget(self.tool_box, "Characterise")
        self.char_page.setBackgroundMode(qt.QWidget.PaletteBackground)
        self.helical_page = CreateHelicalWidget(self.tool_box, "helical_page")
        self.helical_page.setBackgroundMode(qt.QWidget.PaletteBackground)
        self.energy_scan_page = CreateEnergyScanWidget(self.tool_box, "energy_scan")
        self.xrf_scan_page = CreateXRFScanWidget(self.tool_box, "xrf_scan")
        self.workflow_page = CreateWorkflowWidget(self.tool_box, 'workflow')
        
        self.tool_box.addItem(self.discrete_page, "Standard Collection")
        self.tool_box.addItem(self.char_page, "Characterisation")
        self.tool_box.addItem(self.helical_page, "Helical Collection")
        self.tool_box.addItem(self.energy_scan_page, "Energy Scan")
        self.tool_box.addItem(self.xrf_scan_page, "XRF Scan")
        self.tool_box.addItem(self.workflow_page, "Advanced")

        self.add_pixmap = Icons.load("add_row.png")
        self.create_task_button = qt.QPushButton("  Add to queue", self)
        self.create_task_button.setIconSet(qt.QIconSet(self.add_pixmap))
        msg = "Add the collection method to the selected sample"
        qt.QToolTip.add(self.create_task_button, msg)
        
        self.v_layout.addWidget(self.method_group_box)

        self.button_hlayout = qt.QHBoxLayout(None)
        self.spacer = qt.QSpacerItem(1, 20, qt.QSizePolicy.Expanding,
                                     qt.QSizePolicy.Minimum)
        self.button_hlayout.addItem(self.spacer)
        self.button_hlayout.addWidget(self.create_task_button)
        self.method_group_box.layout().setSpacing(10)
        self.method_group_box.layout().addLayout(self.button_hlayout)

        qt.QObject.connect(self.create_task_button, qt.SIGNAL("clicked()"),
                           self.create_task_button_click)

        qt.QObject.connect(self.tool_box, qt.SIGNAL("currentChanged( int )"),
                           self.current_page_changed)
Exemplo n.º 7
0
    def __init__(self, parent=None, name=None, fl=0):
        qt.QWidget.__init__(self, parent, name, fl)

        # Attributes
        self.ready_event = False
        self.checked_items = []
        self.sample_items = []
        self.files_to_be_written = []
        self.item_run_number_list = []
        self.queue_model_hwobj = None

        # Layout
        qt.QVBoxLayout(self)
        self.dialog_layout_widget = ConfirmDialogWidgetVerticalLayout(self)
        # self.dialog_layout_widget.child('take_snapshosts_cbx').hide()
        self.dialog_layout_widget.child("file_list_view").setSorting(-1)
        self.layout().addWidget(self.dialog_layout_widget)

        qt.QObject.connect(
            self.dialog_layout_widget.continue_button,
            qt.SIGNAL("clicked()"),
            self.continue_button_click,
        )

        qt.QObject.connect(
            self.dialog_layout_widget.cancel_button,
            qt.SIGNAL("clicked()"),
            self.cancel_button_click,
        )

        self.dialog_layout_widget.force_dark_cbx.setOn(True)

        self.dialog_layout_widget.missing_one_cbx.hide()
        self.dialog_layout_widget.missing_two_cbx.hide()
        self.setCaption("Confirm collection")
Exemplo n.º 8
0
    def __init__(self,
                 parent=None,
                 name="Grid Dialog",
                 canvas=None,
                 matrix=None,
                 event_mgr=None,
                 drawing_object_layer=None):
        super(GridDialog, self).__init__(parent, name)
        self.__cell_width = 30
        self.__cell_height = 30
        self.__list_items = {}
        self.__item_counter = 0
        self.__grid_list = []
        self.__main_layout = qt.QVBoxLayout(self, 10, 11, 'main_layout')

        self.__canvas = canvas
        self.__matrix = matrix
        self.__event_mgr = event_mgr
        self.__drawing_object_layer = drawing_object_layer
        self.__drawing_mgr = None

        ui_file = 'ui_files/grid_row_widget.ui'
        current_dir = os.path.dirname(__file__)
        widget = qtui.QWidgetFactory.create(os.path.join(current_dir, ui_file))
        widget.reparent(self, qt.QPoint(0, 0))
        self.__main_layout.add(widget)
        self.__list_view = widget.child("list_view")

        qt.QObject.connect(widget.child("add_button"), qt.SIGNAL("clicked()"),
                           self.__add_drawing)

        qt.QObject.connect(widget.child("remove_button"),
                           qt.SIGNAL("clicked()"), self.__delete_drawing)
Exemplo n.º 9
0
    def __init__(self, parent, caption="", manager=None):
        qt.QVBox.__init__(self, parent)
        self.setName(caption)
        self.manager = manager

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

        self.contextpopups = {}

        lv = self.listview = WorkspaceListView(self)

        lv.setRootIsDecorated(True)

        self.connect(
            lv,
            qt.SIGNAL("rightButtonPressed(QListViewItem *,const QPoint&,int)"),
            self._showContextMenu)
        self.connect(
            lv,
            qt.SIGNAL("doubleClicked(QListViewItem *, const QPoint &, int)"),
            self._itemDoubleClick)

        lv.addColumn("Workspaces")
        lv.setColumnWidthMode(0, qt.QListView.Maximum)

        lv.setTreeStepSize(20)

        self._workspace_items = []
Exemplo n.º 10
0
    def __init__(self, *args):
        qt.QFrame.__init__(self, *args)

        self.frequencySlider = Qwt.QwtSlider(self, qt.Qt.Horizontal,
                                             Qwt.QwtSlider.TopScale)
        self.frequencySlider.setScaleMaxMinor(5)
        self.frequencySlider.setScaleMaxMajor(12)
        self.frequencySlider.setThumbLength(80)
        self.frequencySlider.setBorderWidth(1)
        self.frequencySlider.setRange(87.5, 108, 0.01, 10)

        self.tuningThermo = TuningThermo(self)

        self.frequencyWheel = Qwt.QwtWheel(self)
        self.frequencyWheel.setMass(0.5)
        self.frequencyWheel.setRange(87.5, 108, 0.01)
        self.frequencyWheel.setTotalAngle(3600.0)

        self.connect(self.frequencyWheel, qt.SIGNAL("valueChanged(double)"),
                     self.adjustFreq)
        self.connect(self.frequencySlider, qt.SIGNAL("valueChanged(double)"),
                     self.adjustFreq)

        mainLayout = qt.QVBoxLayout(self)
        mainLayout.setMargin(10)
        mainLayout.setSpacing(5)
        mainLayout.addWidget(self.frequencySlider)

        hLayout = qt.QHBoxLayout()
        hLayout.setMargin(0)
        hLayout.addWidget(self.tuningThermo, 0)
        hLayout.addStretch(5)
        hLayout.addWidget(self.frequencyWheel, 2)

        mainLayout.addLayout(hLayout)
Exemplo n.º 11
0
    def __init__(self, parent=None, name=None, fl=0):
        CreateTaskBase.__init__(self, parent, name, fl, 'Standard')

        if not name:
            self.setName("create_discrete_widget")

        self.previous_energy = None
        self.init_models()

        #
        # Layout
        #
        v_layout = qt.QVBoxLayout(self, 2, 5, "v_layout")
        self._acq_gbox = qt.QVGroupBox('Acquisition', self, 'acq_gbox')
        self._acq_widget = \
            AcquisitionWidget(self._acq_gbox,
                              "acquisition_widget",
                              layout='vertical',
                              acq_params=self._acquisition_parameters,
                              path_template=self._path_template)

        self._data_path_gbox = qt.QVGroupBox('Data location', self,
                                             'data_path_gbox')        
        self._data_path_widget = \
            DataPathWidget(self._data_path_gbox,
                           'create_dc_path_widget',
                           data_model=self._path_template,
                           layout='vertical')

        self._processing_gbox = qt.QVGroupBox('Processing', self,
                                              'processing_gbox')

        self._processing_widget = \
            ProcessingWidget(self._processing_gbox,
                             data_model=self._processing_parameters)
        
        v_layout.addWidget(self._acq_gbox)
        v_layout.addWidget(self._data_path_gbox)
        v_layout.addWidget(self._processing_gbox)
        v_layout.addStretch()

        dp_layout = self._data_path_widget.data_path_widget_layout
        self.connect(self._acq_widget, qt.PYSIGNAL('mad_energy_selected'),
                     self.mad_energy_selected)
        
        self.connect(dp_layout.child('prefix_ledit'),
                     qt.SIGNAL("textChanged(const QString &)"),
                     self._prefix_ledit_change)

        self.connect(dp_layout.child('run_number_ledit'),
                     qt.SIGNAL("textChanged(const QString &)"),
                     self._run_number_ledit_change)

        self.connect(self._acq_widget,
                     qt.PYSIGNAL("path_template_changed"),
                     self.handle_path_conflict)

        self.connect(self._data_path_widget,
                     qt.PYSIGNAL("path_template_changed"),
                     self.handle_path_conflict)
Exemplo n.º 12
0
    def __init__(self, parent, name, values, layout_margin=0, layout_spacing=-1, modal=True):
        qt.QDialog.__init__(self, parent, name, modal)
        if layout_spacing == -1:
            layout_spacing =  self.fontMetrics().height()

        self.list_layout = qt.QVBoxLayout()
        self.listview = qt.QListView(self)
        self.listview.setSelectionMode(qt.QListView.Extended)
        self.listview.addColumn(name)
        self.listview.setColumnWidthMode(0, qt.QListView.Maximum)
        for value in values:
            view_item = qt.QListViewItem(self.listview)
            view_item.setText(0, qt.QString(value))

        self.list_layout.addWidget(self.listview)

        self.button_box = qt.QVBoxLayout()
        self.add_button = qt.QPushButton("Add", self)
        self.add_button.setMaximumSize(qt.QSize(100, 100))
        self.connect(self.add_button, qt.SIGNAL('clicked()'), self.addValue)
        self.remove_button = qt.QPushButton("Remove", self)
        self.remove_button.setMaximumSize(qt.QSize(100, 100))
        self.connect(self.remove_button, qt.SIGNAL('clicked()'), self.removeValue)
        self.close_button = qt.QPushButton("Close", self)
        self.close_button.setMaximumSize(qt.QSize(100, 100))
        self.connect(self.close_button, qt.SIGNAL('clicked()'), self.close)
        self.button_box.addWidget(self.add_button)
        self.button_box.addWidget(self.remove_button)
        self.button_box.addStretch(2)
        self.button_box.addWidget(self.close_button)

        self.main_layout = qt.QHBoxLayout(self, layout_margin, layout_spacing, "main_layout")
        self.main_layout.addLayout(self.list_layout)
        self.main_layout.addLayout(self.button_box)
Exemplo n.º 13
0
    def __init__(self,
                 parent,
                 name,
                 callback,
                 layout_margin=0,
                 layout_spacing=-1,
                 modal=True):
        qt.QDialog.__init__(self, parent, name, modal)
        self.widgets = {}
        self.result = None
        self.callback = callback

        if layout_spacing == -1:
            layout_spacing = self.fontMetrics().height()

        self.main_layout = qt.QVBoxLayout(self, layout_margin, layout_spacing,
                                          "main_layout")

        self.setEdition()

        self.button_box = qt.QHBoxLayout()
        self.accept_button = qt.QPushButton("Accept", self)
        self.accept_button.setMaximumSize(qt.QSize(75, 25))
        self.connect(self.accept_button, qt.SIGNAL('clicked()'), self._accept)
        self.cancel_button = qt.QPushButton("Cancel", self)
        self.cancel_button.setMaximumSize(qt.QSize(75, 25))
        self.connect(self.cancel_button, qt.SIGNAL('clicked()'), self.cancel)
        self.button_box.addWidget(self.accept_button)
        self.button_box.addWidget(self.cancel_button)

        self.main_layout.addStretch(1)
        self.main_layout.setMargin(5)
        self.main_layout.setSpacing(6)
        self.main_layout.addLayout(self.button_box)
Exemplo n.º 14
0
    def __init__(self,parent,name,uifile = 'LookupScan.ui',cmd_name = 'ltscan',**kwargs) :
        BaseGraphicScan.__init__(self, parent, name, uifile=uifile, cmd_name=cmd_name, **kwargs)
        self._graphicSelection = None
        self.__polyNb = 0
        self.__gridPoints = None
        self._matchPoints = None
        self.__offsetMeasure = 1e3
        self._ltinit = None
        
        self.addProperty('offsetmeasure','float',1e3)
        
        table = self._widgetTree.child('__gridTable')
        qt.QObject.connect(table,qt.SIGNAL('valueChanged(int,int)'),self._valueChangedScanParam)

        timeWidget = self._widgetTree.child('__time')
        timeWidget.setValidator(qt.QDoubleValidator(timeWidget))
        # PopUp Menu
        self.__polygonListWidget = self._widgetTree.child('__polygonList')
        self.__polygonListWidget.setSelectionMode(qt.QListView.Extended)

        self.__polygonPopUpMenu = qt.QPopupMenu(self.__polygonListWidget)
        for itemName,cbk in [('Create new',self.__createPolygon),
                             ('Remove',self.__removeSelectedPolygon),
                             ('Revert selection',self.__revertSelectedPolygon)] :
            self.__polygonPopUpMenu.insertItem(itemName,cbk)

        self.connect(self.__polygonListWidget,qt.SIGNAL('rightButtonPressed(QListViewItem*,const QPoint &,int)'),
                     self.__polygonPopUpDisplay)

        timeWidget = self._widgetTree.child('__time')
        self.connect(timeWidget,qt.SIGNAL('returnPressed()'),self.__refreshInfoText)
        self.connect(timeWidget,qt.SIGNAL('lostFocus()'),self.__refreshInfoText)
Exemplo n.º 15
0
 def __init__(self):
     qt.QVBox.__init__(self)
     self.b1 = qt.QPushButton('reset / load table', self)
     self.connect(self.b1, qt.SIGNAL("clicked()"), self.action)
     self.tab = TableEdit(self)
     self.stage = 0
     self.b2 = qt.QPushButton('print table at console', self)
     self.connect(self.b2, qt.SIGNAL("clicked()"), self.printTable)
Exemplo n.º 16
0
    def __init__(self, parent):
        vBoxLayout = qt.QVBoxLayout(parent)
        # Add generic settings
        genericGroupBox = ctk.ctkCollapsibleGroupBox()
        genericGroupBox.title = "Generic DICOM settings"
        genericGroupBoxFormLayout = qt.QFormLayout(genericGroupBox)

        directoryButton = ctk.ctkDirectoryButton()
        genericGroupBoxFormLayout.addRow("Database location:", directoryButton)
        parent.registerProperty(slicer.dicomDatabaseDirectorySettingsKey,
                                directoryButton, "directory",
                                str(qt.SIGNAL("directoryChanged(QString)")),
                                "DICOM general settings",
                                ctk.ctkSettingsPanel.OptionRequireRestart)
        # Restart is forced because no mechanism is implemented that would reopen the DICOM database after
        # folder location is changed. It is easier to restart the application than implementing an update
        # mechanism.

        loadReferencesComboBox = ctk.ctkComboBox()
        loadReferencesComboBox.toolTip = "Determines whether referenced DICOM series are " \
          "offered when loading DICOM, or the automatic behavior if interaction is disabled. " \
          "Interactive selection of referenced series is the default selection"
        loadReferencesComboBox.addItem("Ask user", qt.QMessageBox.InvalidRole)
        loadReferencesComboBox.addItem("Always", qt.QMessageBox.Yes)
        loadReferencesComboBox.addItem("Never", qt.QMessageBox.No)
        loadReferencesComboBox.currentIndex = 0
        genericGroupBoxFormLayout.addRow("Load referenced series:",
                                         loadReferencesComboBox)
        parent.registerProperty("DICOM/automaticallyLoadReferences",
                                loadReferencesComboBox,
                                "currentUserDataAsString",
                                str(qt.SIGNAL("currentIndexChanged(int)")))

        detailedLoggingCheckBox = qt.QCheckBox()
        detailedLoggingCheckBox.toolTip = (
            "Log more details during DICOM operations."
            " Useful for investigating DICOM loading issues but may impact performance."
        )
        genericGroupBoxFormLayout.addRow("Detailed logging:",
                                         detailedLoggingCheckBox)
        detailedLoggingMapper = ctk.ctkBooleanMapper(
            detailedLoggingCheckBox, "checked",
            str(qt.SIGNAL("toggled(bool)")))
        parent.registerProperty("DICOM/detailedLogging", detailedLoggingMapper,
                                "valueAsInt",
                                str(qt.SIGNAL("valueAsIntChanged(int)")))

        vBoxLayout.addWidget(genericGroupBox)

        # Add settings panel for the plugins
        plugins = slicer.modules.dicomPlugins
        for pluginName in plugins.keys():
            if hasattr(plugins[pluginName], 'settingsPanelEntry'):
                pluginGroupBox = ctk.ctkCollapsibleGroupBox()
                pluginGroupBox.title = pluginName
                vBoxLayout.addWidget(pluginGroupBox)
                plugins[pluginName].settingsPanelEntry(parent, pluginGroupBox)
        vBoxLayout.addStretch(1)
Exemplo n.º 17
0
    def __init__(self, *args):
        qt.QMainWindow.__init__(self, *args)

        self.plot = Qwt.QwtPlot(self)
        self.plot.setTitle("A Simple Map Demonstration")
        self.plot.setCanvasBackground(qt.Qt.white)
        self.plot.setAxisTitle(Qwt.QwtPlot.xBottom, "x")
        self.plot.setAxisTitle(Qwt.QwtPlot.yLeft, "y")    
        self.plot.setAxisScale(Qwt.QwtPlot.xBottom, 0.0, 1.0)
        self.plot.setAxisScale(Qwt.QwtPlot.yLeft, 0.0, 1.0)
        self.setCentralWidget(self.plot)

        # Initialize map data
        self.count = self.i = 1000
        self.xs = zeros(self.count, Float)
        self.ys = zeros(self.count, Float)

        self.kappa = 0.2

        self.curve = Qwt.QwtPlotCurve("Map")
        self.curve.attach(self.plot)

        self.curve.setSymbol(Qwt.QwtSymbol(Qwt.QwtSymbol.Ellipse,
                                           qt.QBrush(qt.Qt.red),
                                           qt.QPen(qt.Qt.blue),
                                           qt.QSize(5, 5)))

        self.curve.setPen(qt.QPen(qt.Qt.cyan))

        toolBar = qt.QToolBar(self)

        qt.QLabel("Count:", toolBar)
        sizeCounter = Qwt.QwtCounter(toolBar)
        toolBar.addSeparator()
        sizeCounter.setRange(0, 1000000, 100)
        sizeCounter.setValue(self.count)
        sizeCounter.setNumButtons(3)
        self.connect(
            sizeCounter, qt.SIGNAL('valueChanged(double)'), self.setCount)

        qt.QLabel("Ticks (ms):", toolBar)
        tickCounter = Qwt.QwtCounter(toolBar)
        toolBar.addSeparator()
        # 1 tick = 1 ms, 10 ticks = 10 ms (Linux clock is 100 Hz)
        self.ticks = 10
        tickCounter.setRange(0, 1000, 1)
        tickCounter.setValue(self.ticks)
        tickCounter.setNumButtons(3)
        self.connect(
            tickCounter, qt.SIGNAL('valueChanged(double)'), self.setTicks)
        self.tid = self.startTimer(self.ticks)

        self.timer_tic = None
        self.user_tic = None
        self.system_tic = None
        
        self.plot.replot()
Exemplo n.º 18
0
    def _setupActions(self):
        """
        creates some actions needed on some menues and toolbars
        """
        a = self._actions["close_shell"] = qt.QAction( qt.QIconSet(qt.QPixmap(os.path.join(CONF.getIconsPath(),"newshell.png"))), "&Close Shell", qt.Qt.CTRL + qt.Qt.Key_W, self, "New Shell" )
        self.connect(a, qt.SIGNAL('activated()'), self.destroyShellTab)

        a = self._actions["new_shell"] = qt.QAction( qt.QIconSet(qt.QPixmap(os.path.join(CONF.getIconsPath(),"newshell.png"))), "&New Shell", qt.Qt.CTRL + qt.Qt.Key_T, self, "New Shell" )
        self.connect(a, qt.SIGNAL('activated()'), self.createShellTab)
Exemplo n.º 19
0
    def settingsPanelEntry(panel, parent):
        """Create a settings panel entry for this plugin class.
    It is added to the DICOM panel of the application settings
    by the DICOM module.
    """
        formLayout = qt.QFormLayout(parent)

        readersComboBox = qt.QComboBox()
        for approach in DICOMScalarVolumePluginClass.readerApproaches():
            readersComboBox.addItem(approach)
        readersComboBox.toolTip = (
            "Preferred back end.  Archetype was used by default in Slicer before June of 2017."
            "Change this setting if data that previously loaded stops working (and report an issue)."
        )
        formLayout.addRow("DICOM reader approach:", readersComboBox)
        panel.registerProperty("DICOM/ScalarVolume/ReaderApproach",
                               readersComboBox, "currentIndex",
                               str(qt.SIGNAL("currentIndexChanged(int)")))

        importFormatsComboBox = ctk.ctkComboBox()
        importFormatsComboBox.toolTip = (
            "Enable adding non-linear transform to regularize images acquired irregular geometry:"
            " non-rectilinear grid (such as tilted gantry CT acquisitions) and non-uniform slice spacing."
            " If no regularization is applied then image may appear distorted if it was acquired with irregular geometry."
        )
        importFormatsComboBox.addItem("default (none)", "default")
        importFormatsComboBox.addItem("none", "none")
        importFormatsComboBox.addItem("apply regularization transform",
                                      "transform")
        # in the future additional option, such as "resample" may be added
        importFormatsComboBox.currentIndex = 0
        formLayout.addRow("Acquisition geometry regularization:",
                          importFormatsComboBox)
        panel.registerProperty(
            "DICOM/ScalarVolume/AcquisitionGeometryRegularization",
            importFormatsComboBox, "currentUserDataAsString",
            str(qt.SIGNAL("currentIndexChanged(int)")),
            "DICOM examination settings",
            ctk.ctkSettingsPanel.OptionRequireRestart)
        # DICOM examination settings are cached so we need to restart to make sure changes take effect

        allowLoadingByTimeCheckBox = qt.QCheckBox()
        allowLoadingByTimeCheckBox.toolTip = (
            "Offer loading of individual slices or group of slices"
            " that were acquired at a specific time (content or trigger time)."
            " If this option is enabled then a large number of loadable items may be displayed in the Advanced section of DICOM browser."
        )
        formLayout.addRow("Allow loading subseries by time:",
                          allowLoadingByTimeCheckBox)
        allowLoadingByTimeMapper = ctk.ctkBooleanMapper(
            allowLoadingByTimeCheckBox, "checked",
            str(qt.SIGNAL("toggled(bool)")))
        panel.registerProperty("DICOM/ScalarVolume/AllowLoadingByTime",
                               allowLoadingByTimeMapper, "valueAsInt",
                               str(qt.SIGNAL("valueAsIntChanged(int)")),
                               "DICOM examination settings",
                               ctk.ctkSettingsPanel.OptionRequireRestart)
Exemplo n.º 20
0
    def setupSignals(self):
        """ setupSignals() -> connect some things

        """
        self.connect(self, qt.PYSIGNAL('RunChildApps'), self.runChildApps)
        self.connect(self.buttonStop, qt.SIGNAL('clicked()'), self,
                     qt.SLOT('exec()'))
        self.connect(self.buttonClose, qt.SIGNAL('clicked()'), self,
                     qt.SLOT('close()'))
Exemplo n.º 21
0
    def __init__(self, parent=None, name=None, fl=0):
        CreateTaskBase.__init__(self, parent, name, fl, "XRF-spectrum")

        self.count_time = None

        # Data attributes
        self.init_models()
        xrfspectrum_model = queue_model_objects.XRFSpectrum()
        self.xrfspectrum_mib = DataModelInputBinder(xrfspectrum_model)

        # Layout
        v_layout = qt.QVBoxLayout(self, 2, 6, "main_v_layout")

        self._data_path_gbox = qt.QVGroupBox("Data location", self, "data_path_gbox")
        self._data_path_widget = DataPathWidget(
            self._data_path_gbox, data_model=self._path_template, layout="vertical"
        )

        parameters_hor_gbox = qt.QHGroupBox("Parameters", self)

        self.count_time_label = qt.QLabel("Count time", parameters_hor_gbox)
        self.count_time_label.setFixedWidth(83)

        self.count_time_ledit = qt.QLineEdit(
            "1.0", parameters_hor_gbox, "count_time_ledit"
        )
        self.count_time_ledit.setFixedWidth(50)

        self.xrfspectrum_mib.bind_value_update(
            "count_time", self.count_time_ledit, float
        )  # ,

        spacer = qt.QWidget(parameters_hor_gbox)
        spacer.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed)

        v_layout.addWidget(self._data_path_gbox)
        v_layout.addWidget(parameters_hor_gbox)
        v_layout.addStretch()

        self.connect(
            self._data_path_widget.data_path_widget_layout.child("run_number_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self._run_number_ledit_change,
        )

        self.connect(
            self._data_path_widget.data_path_widget_layout.child("prefix_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self._prefix_ledit_change,
        )

        self.connect(
            self._data_path_widget,
            qt.PYSIGNAL("path_template_changed"),
            self.handle_path_conflict,
        )
Exemplo n.º 22
0
    def __init__(self, parent=None):

        self._window = qt.QDialog(parent)
        self._window.setIcon(getPixmap("smart"))
        self._window.setCaption(_("New Package Priority"))
        self._window.setModal(True)

        #self._window.setMinimumSize(600, 400)

        vbox = qt.QVBox(self._window)
        vbox.setMargin(10)
        vbox.setSpacing(10)
        vbox.show()

        table = qt.QGrid(2, vbox)
        table.setSpacing(10)
        table.show()

        label = qt.QLabel(_("Package Name:"), table)

        self._name = qt.QLineEdit(table)
        self._name.show()

        label = qt.QLabel(_("Channel Alias:"), table)

        self._alias = qt.QLineEdit(table)
        self._alias.setText("*")
        self._alias.show()

        label = qt.QLabel(_("Priority:"), table)

        self._priority = qt.QSpinBox(table)
        self._priority.setSteps(1, 10)
        self._priority.setRange(-100000,+100000)
        self._priority.show()

        sep = qt.QFrame(vbox)
        sep.setFrameShape(qt.QFrame.HLine)
        sep.setFrameShadow(qt.QFrame.Sunken)
        sep.show()

        bbox = qt.QHBox(vbox)
        bbox.setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()

        button = qt.QPushButton(_("Cancel"), bbox)
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window, qt.SLOT("reject()"))

        button = qt.QPushButton(_("OK"), bbox)
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window, qt.SLOT("accept()"))

        button.setDefault(True)
        vbox.adjustSize()
        self._window.adjustSize()
Exemplo n.º 23
0
    def __init__(self, parent=None, name=None, fl=0):
        qt.QWidget.__init__(self, parent, name, fl)

        # AsyncResult to return values
        self._async_result = None

        # Layout
        qt.QVBoxLayout(self)
        main_layout = self.layout()
        main_layout.setSpacing(10)
        main_layout.setMargin(6)
        self.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Expanding)

        self.setCaption("GPhL Workflow parameters")

        # Info box
        self.info_gbox = qt.QVGroupBox("Info", self, "info_gbox")
        main_layout.addWidget(self.info_gbox)
        self.info_text = qt.QTextEdit(self.info_gbox, "info_text")
        self.info_text.setTextFormat(0)  # PlainText
        self.info_text.setFont(qt.QFont("Courier"))
        self.info_text.setReadOnly(True)

        # Special parameter box
        self.cplx_gbox = qt.QVGroupBox("Indexing solution", self, "cplx_gbox")
        main_layout.addWidget(self.cplx_gbox)
        self.cplx_widget = None

        # Parameter box
        self.parameter_gbox = qt.QVGroupBox("Parameters", self,
                                            "parameter_gbox")
        main_layout.addWidget(self.parameter_gbox)
        self.params_widget = None

        # Button bar
        button_layout = qt.QHBoxLayout(None, 0, 6, "button_layout")
        hspacer = qt.QSpacerItem(1, 20, qt.QSizePolicy.Expanding,
                                 qt.QSizePolicy.Minimum)
        button_layout.addItem(hspacer)
        self.continue_button = qt.QPushButton("Continue", self,
                                              "continue_button")
        button_layout.addWidget(self.continue_button)
        self.cancel_button = qt.QPushButton("Abort", self, "cancel_button")
        button_layout.addWidget(self.cancel_button)
        main_layout.addLayout(button_layout)

        qt.QObject.connect(self.continue_button, qt.SIGNAL("clicked()"),
                           self.continue_button_click)

        qt.QObject.connect(self.cancel_button, qt.SIGNAL("clicked()"),
                           self.cancel_button_click)

        self.resize(qt.QSize(1018, 472).expandedTo(self.minimumSizeHint()))
        self.clearWState(qt.Qt.WState_Polished)
Exemplo n.º 24
0
    def __init__(self, parent=None, name=None, fl=0):
        CreateTaskBase.__init__(self, parent, name, fl, "Workflow")

        # Data attributes
        self.workflow_hwobj = None
        self.workflows = {}

        self.init_models()

        # Layout
        v_layout = qt.QVBoxLayout(self, 2, 5, "main_v_layout")

        self._workflow_type_gbox = qt.QVGroupBox("Workflow type", self,
                                                 "workflow_rtype")

        self._workflow_cbox = qt.QComboBox(self._workflow_type_gbox)

        self._data_path_gbox = qt.QVGroupBox("Data location", self,
                                             "data_path_gbox")
        self._data_path_widget = DataPathWidget(self._data_path_gbox,
                                                data_model=self._path_template,
                                                layout="vertical")

        self._data_path_widget.data_path_widget_layout.child(
            "file_name_label").setText("")
        self._data_path_widget.data_path_widget_layout.child(
            "file_name_value_label").hide()

        # self._grid_widget = MxLookupScanBrick.MxLookupScanBrick(self, 'grid_widget')

        v_layout.addWidget(self._workflow_type_gbox)
        v_layout.addWidget(self._data_path_gbox)
        # v_layout.addWidget(self._grid_widget)
        v_layout.addStretch()

        self.connect(
            self._data_path_widget.data_path_widget_layout.child(
                "prefix_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self._prefix_ledit_change,
        )

        self.connect(
            self._data_path_widget.data_path_widget_layout.child(
                "run_number_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self._run_number_ledit_change,
        )

        self.connect(
            self._data_path_widget,
            qt.PYSIGNAL("path_template_changed"),
            self.handle_path_conflict,
        )
Exemplo n.º 25
0
    def __init__(self, parent=None):

        self._window = qt.QDialog(None)
        self._window.setIcon(getPixmap("smart"))
        self._window.setCaption(_("Priorities"))
        #self._window.setModal(True)

        self._window.setMinimumSize(600, 400)

        layout = qt.QVBoxLayout(self._window)
        layout.setResizeMode(qt.QLayout.FreeResize)

        vbox = qt.QVBox(self._window)
        vbox.setMargin(10)
        vbox.setSpacing(10)
        vbox.show()

        layout.addWidget(vbox)

        self._treeview = qt.QListView(vbox)
        self._treeview.setAllColumnsShowFocus(True)
        self._treeview.show()

        qt.QObject.connect(self._treeview, qt.SIGNAL("itemRenamed(QListViewItem *, int, const QString &)"), self.itemRenamed)
        qt.QObject.connect(self._treeview, qt.SIGNAL("selectionChanged()"), self.selectionChanged)

        self._treeview.addColumn(_("Package Name"))
        self._treeview.addColumn(_("Channel Alias"))
        self._treeview.addColumn(_("Priority"))

        bbox = qt.QHBox(vbox)
        bbox.setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()

        button = qt.QPushButton(_("New"), bbox)
        button.setEnabled(True)
        button.setIconSet(qt.QIconSet(getPixmap("crystal-add")))
        button.show()
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self.newPriority)
        self._newpriority = button

        button = qt.QPushButton(_("Delete"), bbox)
        button.setEnabled(False)
        button.setIconSet(qt.QIconSet(getPixmap("crystal-delete")))
        button.show()
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self.delPriority)
        self._delpriority = button

        button = qt.QPushButton(_("Close"), bbox)
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window, qt.SLOT("accept()"))
        
        button.setDefault(True)
        vbox.adjustSize()
Exemplo n.º 26
0
    def __init__(self, parent, name, uifile='', cmd_name=None):
        BlissWidget.__init__(self, parent, name)

        self._widgetTree = self.loadUIFile(uifile)
        self._widgetTree.reparent(self, qt.QPoint(0, 0))
        layout = qt.QHBoxLayout(self)
        layout.addWidget(self._widgetTree)

        self.addProperty('horizontal', 'string', '')
        self.addProperty('vertical', 'string', '')
        self.addProperty('command', 'string', '')
        self.addProperty("formatString", "formatString", "###.##")
        ####### SIGNAL #######
        self.defineSignal('getView', ())
        self.defineSignal('scanFinished', ())
        ####### SLOT #######
        self.defineSlot("ChangePixelCalibration", ())
        self.defineSlot("ChangeBeamPosition", ())

        self._view = None
        self._beamx, self._beamy = 0, 0
        self._XSize, self._YSize = 1, 1
        self._horizontalMotors = []
        self._verticalMotors = []
        self._graphicSelection = None
        self._SpecCmd = None
        self.__commandName = cmd_name
        self._logArgs = {}
        self._formatString = '%f'

        ####### GUI INIT #######
        gButton = self._widgetTree.child('__grabButton')
        gButton.hide()

        showgButton = self._widgetTree.child('__showGrab')
        showgButton.hide()

        try:
            mvButton = self._widgetTree.child('__movetoStart')
            qt.QObject.connect(mvButton, qt.SIGNAL('clicked()'),
                               self._movetoStart)
            mvButton.hide()
        except:
            pass

        startButton = self._widgetTree.child('__startScan')
        qt.QObject.connect(startButton, qt.SIGNAL('clicked()'),
                           self._startScan)
        startButton.setEnabled(False)

        stopButton = self._widgetTree.child('__stopScan')
        qt.QObject.connect(stopButton, qt.SIGNAL('clicked()'), self._stopScan)
        stopButton.setEnabled(False)
Exemplo n.º 27
0
    def __init__(self, parent=None, name=None, fl=0):
        plot_form.PlotForm.__init__(self, parent, name, fl)
        base.stdtee(self, 'stdout', 'stderr')
        self.tickersListView.setColumnAlignment(2, qt.Qt.AlignRight)
        self.setCaption(self.title % '')
        self.resize(qt.QSize(400, 700))

        self.connect(self.openButton, qt.SIGNAL('clicked()'),
                     self.handleOpenTickers)
        self.connect(self.tickersListView,
                     qt.SIGNAL('doubleClicked(QListViewItem *)'),
                     self.handleShowTicker)
Exemplo n.º 28
0
    def __init__(self, parent, xmms):
        qt.QObject.__init__(self, parent)
        fd = xmms.get_fd()
        self.xmms = xmms
        self.xmms.set_need_out_fun(self.chkWr)

        self.rsock = qt.QSocketNotifier(fd, qt.QSocketNotifier.Read, self)
        self.connect(self.rsock, qt.SIGNAL("activated(int)"), self.do_read)
        self.rsock.setEnabled(False)

        self.wsock = qt.QSocketNotifier(fd, qt.QSocketNotifier.Write, self)
        self.connect(self.wsock, qt.SIGNAL("activated(int)"), self.do_write)
        self.wsock.setEnabled(False)
Exemplo n.º 29
0
    def __init__(self, brick, widgetTree, xoryMotor, zMotor, rMotor,
                 tableyMotor, tablezMotor, table_y_inverted, table_z_inverted):
        self.__brick = brick
        self.__zMotor, self.__xoryMotor, self.__rotationMotor = zMotor, xoryMotor, rMotor
        self.__widgetTree = widgetTree
        self.endAlignementFlag = False
        self.alignementProcedureOff = True
        self.hLines = []
        self.motorReadyFlag = False
        self.bx = None
        self.by = None
        self.__tableYMotor = tableyMotor
        self.__tableZMotor = tablezMotor
        self.table_y_inverted = table_y_inverted
        self.table_z_inverted = table_z_inverted

        alignementTable = self.__widgetTree.child('alignementTable')
        header = alignementTable.horizontalHeader()
        header.setLabel(0, rMotor.userName())

        phiStepLineEditor = self.__widgetTree.child('__deltaPhiCalib')
        phiStepLineEditor.setValidator(qt.QDoubleValidator(self.__widgetTree))

        ####### ALIGNMENT TYPE #######
        self.nbPoint4Alignement = 3
        self.alignementProcessState = _cancelAlignementProcess(
            self, self.__widgetTree)

        self.__centerRotation = None
        self.__helpLines = []

        ####### QT SIGNAL #######
        startAlignementButton = self.__widgetTree.child('__startAlignement')
        qt.QObject.connect(startAlignementButton, qt.SIGNAL('clicked()'),
                           self.__startAlignement)

        cancelAlignementButton = self.__widgetTree.child('__cancelAlignement')
        qt.QObject.connect(cancelAlignementButton, qt.SIGNAL('clicked()'),
                           self.__cancelAlignementButton)

        showCenter = self.__widgetTree.child('__showCenter')
        qt.QObject.connect(showCenter, qt.SIGNAL('toggled(bool)'),
                           self.__showCenter)

        showHelpLines = self.__widgetTree.child('__helpLines')
        qt.QObject.connect(showHelpLines, qt.SIGNAL('toggled(bool)'),
                           self.__showHelpLines)

        ####### BRICK CONNECTION #######
        self.__brick.connect(self.__rotationMotor, qt.PYSIGNAL("stateChanged"),
                             self.__updateMotorState)
Exemplo n.º 30
0
    def __init__(self, parent=None):

        self._window = qt.QDialog(parent)
        self._window.setIcon(getPixmap("smart"))
        self._window.setCaption(_("New Target"))
        self._window.setModal(True)

        #self._window.setMinimumSize(600, 400)

        vbox = qt.QVBox(self._window)
        vbox.setMargin(10)
        vbox.setSpacing(10)
        vbox.show()

        table = qt.QGrid(2, vbox)
        table.setSpacing(10)
        table.show()

        label = qt.QLabel(_("Target:"), table)

        self._target = qt.QLineEdit(table)
        self._target.setMaxLength(40)
        self._target.show()

        blank = qt.QWidget(table)

        label = qt.QLabel(
            _("Examples: \"pkgname\", \"pkgname = 1.0\" or "
              "\"pkgname <= 1.0\""), table)

        sep = qt.QFrame(vbox)
        sep.setFrameShape(qt.QFrame.HLine)
        sep.setFrameShadow(qt.QFrame.Sunken)
        sep.show()

        bbox = qt.QHBox(vbox)
        bbox.setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()

        button = qt.QPushButton(bbox.tr("OK"), bbox)
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window,
                           qt.SLOT("accept()"))

        button = qt.QPushButton(bbox.tr("Cancel"), bbox)
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window,
                           qt.SLOT("reject()"))

        vbox.adjustSize()
        self._window.adjustSize()