Ejemplo n.º 1
0
    def createRecordGroupBox(self):
        self.recordForm = QtGui.QGroupBox("Video capture")
        self.recordFormLayout = QFormLayout()

        self.path_bx = QtGui.QLineEdit()
        self.resetPath()

        self.file_btn = QtGui.QPushButton("save to")
        self.file_btn.clicked.connect(self.on_getfile)

        self.file_bx = QtGui.QLineEdit()
        self.file_bx.textChanged.connect(self.on_fileChange)
        self.file_bx.setText(self.filename)


        self.save_btn = QtGui.QCheckBox()
        self.save_btn.setChecked(self.save)
        self.save_btn.stateChanged.connect(self.on_saveClick)


        hbox = QtGui.QHBoxLayout()
        self.recordFormLayout.addRow(self.file_btn, self.file_bx)
        self.recordFormLayout.addRow(QLabel("path:"), self.path_bx)
        self.recordFormLayout.addRow(QLabel("save:"), self.save_btn)


        self.recordForm.setLayout(self.recordFormLayout)
    def __init__(self, unfolding, parent=None):
        super(Window, self).__init__(parent)
        self.listCheckBox = []
        self.listLabel = []
        self.unfolding = unfolding

        for hinge in unfolding.all_hinges:
            self.listCheckBox.append(str(hinge))
            self.listLabel.append('')

        grid = QGridLayout()

        for i, v in enumerate(self.listCheckBox):
            self.listCheckBox[i] = QCheckBox(v)
            self.listLabel[i] = QLabel()
            grid.addWidget(self.listCheckBox[i], i, 0)
            grid.addWidget(self.listLabel[i], i, 1)
            if unfolding.all_hinges[i] in unfolding.open_hinges:
                self.listCheckBox[i].setChecked(True)
            else:
                self.listCheckBox[i].setChecked(False)

        self.button = QPushButton("Update hinges")
        self.button.clicked.connect(self.checkboxChanged)
        self.labelResult = QLabel()

        grid.addWidget(self.button, 10, 0, 1, 2)
        grid.addWidget(self.labelResult, 11, 0, 1, 2)
        self.setLayout(grid)
        self.setWindowTitle('Hinge Selection')
    def createImageGroupBox(self):
        self.imageForm = QGroupBox('Imaging')
        self.imageLayout = QGridLayout()

        ##raw image
        self.imv1 = RawImageWidget(scaled=True)
        ## tracking
        self.imv2 = RawImageWidget(scaled=True)
        ## mask
        self.imv3 = RawImageWidget(scaled=True)
        ## avergae
        self.imv4 = RawImageWidget(scaled=True)

        ## set background image
        self.imv1.setImage(self.bkImage)

        self.imageLayout.addWidget(QLabel("Raw:"), 0, 0, 1, 1)
        self.imageLayout.addWidget(QLabel("Detection:"), 0, 1, 1, 1)
        self.imageLayout.addWidget(self.imv1, 1, 0, 1, 1)
        self.imageLayout.addWidget(self.imv2, 1, 1, 1, 1)
        self.imageLayout.addWidget(QLabel("Mask:"), 2, 0, 1, 1)
        self.imageLayout.addWidget(QLabel("Moving average:"), 2, 1, 1, 1)
        self.imageLayout.addWidget(self.imv3, 3, 0, 1, 1)
        self.imageLayout.addWidget(self.imv4, 3, 1, 1, 1)

        self.imageForm.setLayout(self.imageLayout)
    def createPumpGroupBox(self):
        self.pumpForm = QGroupBox("Pump settings")
        self.pumpFormLayout = QFormLayout()

        self.flowOff1_btn = QtGui.QPushButton('Increase')
        self.flowOff0_btn = QtGui.QPushButton('Decrease')

        self.flowOn1_btn = QtGui.QPushButton('Increase')
        self.flowOn0_btn = QtGui.QPushButton('Decrease')

        self.flowOn1_btn.clicked.connect(self.on_flowOn1)
        self.flowOn0_btn.clicked.connect(self.on_flowOn0)
        self.flowOff1_btn.clicked.connect(self.on_flowOff1)
        self.flowOff0_btn.clicked.connect(self.on_flowOff0)

        self.ardReset_btn = QtGui.QPushButton('reset flow')
        self.ardReset_btn.clicked.connect(self.on_ARDreset)

        hbox = QtGui.QHBoxLayout()
        hbox.addWidget(self.flowOn0_btn)
        hbox.addWidget(self.flowOn1_btn)

        hboxOff = QtGui.QHBoxLayout()
        hboxOff.addWidget(self.flowOff0_btn)
        hboxOff.addWidget(self.flowOff1_btn)

        self.pumpFormLayout.addRow(QLabel("On time:"), hbox)
        self.pumpFormLayout.addRow(QLabel("Off time:"), hboxOff)
        self.pumpFormLayout.addRow(self.ardReset_btn)
        self.pumpForm.setLayout(self.pumpFormLayout)
Ejemplo n.º 5
0
 def __init__(self, parent=None):
     super(MigrationWidget, self).__init__(parent, Qt.WindowStaysOnTopHint)
     self._migration, vbox, hbox = {}, QVBoxLayout(self), QHBoxLayout()
     lbl_title = QLabel(translations.TR_CURRENT_CODE)
     lbl_suggestion = QLabel(translations.TR_SUGGESTED_CHANGES)
     self.current_list, self.suggestion = QListWidget(), QPlainTextEdit()
     self.suggestion.setReadOnly(True)
     self.btn_apply = QPushButton(translations.TR_APPLY_CHANGES + " !")
     self.suggestion.setToolTip(translations.TR_SAVE_BEFORE_APPLY + " !")
     self.btn_apply.setToolTip(translations.TR_SAVE_BEFORE_APPLY + " !")
     # pack up all widgets
     hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding))
     hbox.addWidget(self.btn_apply)
     vbox.addWidget(lbl_title)
     vbox.addWidget(self.current_list)
     vbox.addWidget(lbl_suggestion)
     vbox.addWidget(self.suggestion)
     vbox.addLayout(hbox)
     # connections
     self.connect(self.current_list,
                  SIGNAL("itemClicked(QListWidgetItem*)"),
                  self.load_suggestion)
     self.connect(self.btn_apply, SIGNAL("clicked()"), self.apply_changes)
     # registers
     IDE.register_service('tab_migration', self)
     ExplorerContainer.register_tab(translations.TR_TAB_MIGRATION, self)
Ejemplo n.º 6
0
    def test_dock_standalone(self):
        widget = QWidget()
        layout = QHBoxLayout()
        widget.setLayout(layout)
        layout.addStretch(1)
        widget.show()

        dock = CollapsibleDockWidget()
        layout.addWidget(dock)
        list_view = QListView()
        list_view.setModel(QStringListModel(["a", "b"], list_view))

        label = QLabel("A label. ")
        label.setWordWrap(True)

        dock.setExpandedWidget(label)
        dock.setCollapsedWidget(list_view)
        dock.setExpanded(True)

        self.app.processEvents()

        def toogle():
            dock.setExpanded(not dock.expanded())
            self.singleShot(2000, toogle)

        toogle()

        self.app.exec_()
Ejemplo n.º 7
0
 def paintEvent(self, evt):
     QLabel.paintEvent(self, evt)
     p = QPainter(self)
     p.setFont(self.font())
     x = self._movieWidth + 6
     y = (self.height() + p.fontMetrics().xHeight()) / 2
     p.drawText(x, y, self._text)
     p.end()
Ejemplo n.º 8
0
class HtmlBrowser(QWidget):
    def __init__(self,parent=None):
        QWidget.__init__(self,parent)
        
        self.__toolBar = QToolBar(self)
        self.__toolBar.setIconSize(QSize(16,16))
        self.__htmlBrowserView = HtmlBrowserView(self)
        self.__addressinput = QLineEdit(self)
        self.__loadlabel = QLabel(self)

        layout=QVBoxLayout(self)
        layout.setSpacing(0)
        layout.setMargin(0)
        layout.addWidget(self.__toolBar)
        layout.addWidget(self.__htmlBrowserView)
        
        self.__setupToolBarAction()
        
        QObject.connect(self.__addressinput, SIGNAL("returnPressed ()"),self.__evt_load)
        QObject.connect(self.__htmlBrowserView, SIGNAL("loadFinished (bool)"),lambda:self.__loadlabel.setMovie(None))
        QObject.connect(self.__htmlBrowserView, SIGNAL("loadStarted ()"),self.__evt_loadstarted)


    def __evt_loadstarted(self):
        if  not self.__loadlabel.movie():
            movie = QMovie(getPath('iconDir','loading.gif'), QByteArray(), self.__loadlabel)
            movie.setSpeed(50)
            self.__loadlabel.setMovie(movie)
            movie.start()

    
    def __evt_load(self):
        self.__htmlBrowserView.load(QUrl(self.__addressinput.text()))
        
    def setHtml(self,html):
        self.__htmlBrowserView.setHtml(html)
        
    def webview(self):
        return self.__htmlBrowserView
    def __setupToolBarAction(self):
        
        self.__toolBar.addAction(self.__htmlBrowserView.getActions()["pre"])
        self.__toolBar.addAction(self.__htmlBrowserView.getActions()["next"])
        self.__toolBar.addAction(self.__htmlBrowserView.getActions()["stop"])
        self.__toolBar.addAction(self.__htmlBrowserView.getActions()["reload"])
        self.__toolBar.addWidget(self.__loadlabel)
        self.__toolBar.addWidget(self.__addressinput)
        
        action = QAction(QIcon(getPath('iconDir','heditor/go.png')),"go",self,triggered=self.__evt_load)
        
        self.__toolBar.addAction(action)

        self.__toolBar.addAction(self.__htmlBrowserView.getActions()["zoomin"])
        self.__toolBar.addAction(self.__htmlBrowserView.getActions()["zoomreset"])
        self.__toolBar.addAction(self.__htmlBrowserView.getActions()["zoomout"])
Ejemplo n.º 9
0
    def createCalibrationFormGroupBox(self):
        self.calibrationForm = QGroupBox("Image Calibration")
        self.calibrationLayout = QFormLayout()

        self.slider = QSlider(Qt.Horizontal)
        self.slider.setMinimum(0)
        self.slider.setMaximum(255)
        self.slider.setValue(self.pVal)
        self.slider.setTickPosition(QSlider.TicksBelow)
        self.slider.setTickInterval(10)
        self.slider.valueChanged.connect(self.on_slidervaluechange)
        self.textSlider = QtGui.QLineEdit(str(self.pVal))

        hbox_mn = QtGui.QHBoxLayout()
        hbox_mn.addWidget(self.slider)
        hbox_mn.addWidget(self.textSlider)


        self.slider2 = QSlider(Qt.Horizontal)
        self.slider2.setMinimum(0)
        self.slider2.setMaximum(255)
        self.slider2.setValue(self.pVal_mx)
        self.slider2.setTickPosition(QSlider.TicksBelow)
        self.slider2.setTickInterval(10)
        self.slider2.valueChanged.connect(self.on_slider2valuechange)
        self.textSlider2 = QtGui.QLineEdit(str(self.pVal_mx),self.win)

        hbox_mx = QtGui.QHBoxLayout()
        hbox_mx.addWidget(self.slider2)
        hbox_mx.addWidget(self.textSlider2)

        self.ROIslider= QSlider(Qt.Horizontal)
        self.ROIslider.setMinimum(0)
        self.ROIslider.setMaximum(1000)
        self.ROIslider.setValue(self.area_mn)
        self.ROIslider.setTickPosition(QSlider.TicksBelow)
        self.ROIslider.setTickInterval(100)
        self.ROIslider.valueChanged.connect(self.on_ROIslidervaluechange)
        self.ROItextSlider = QLineEdit(str(self.area_mn))

        hbox = QtGui.QHBoxLayout()
        hbox.addWidget(self.ROIslider)
        hbox.addWidget(self.ROItextSlider)

        self.calibrationLayout.addRow(QLabel("ROI max area:"),hbox)
        self.calibrationLayout.addRow(QLabel("px min:"), hbox_mn)
        self.calibrationLayout.addRow(QLabel("px max:"), hbox_mx)

        self.calibrationForm.setLayout(self.calibrationLayout)
Ejemplo n.º 10
0
    def showdialog(self, title):
        d = QDialog(self)
        d.setFixedSize(300, 100)
        label = QLabel(self.Error, d)
        label.move(20, 20)
        self.current = os.listdir(self.files)[0][0:4]
        self.roll = QLineEdit(str(self.current), d)
        self.roll.move(50, 20)

        b1 = QPushButton("Ok",d)
        b1.move(125,50)
        d.setWindowTitle(str(title))

        b1.clicked.connect(self.process_frames)
        d.exec_()
Ejemplo n.º 11
0
    def __init__(self, parent):
        super(Plugins, self).__init__()
        self._preferences, vbox = parent, QVBoxLayout(self)
        label = QLabel(translations.TR_PREFERENCES_PLUGINS_MAIN)
        vbox.addWidget(label)

        self.connect(self._preferences, SIGNAL("savePreferences()"), self.save)
Ejemplo n.º 12
0
 def __init__(self, parent):
     QWidget.__init__(self, parent)
     self._layout = QHBoxLayout(self)
     self._label = QLabel("Very important option", self)
     self._layout.addWidget(self._label)
     self.edit = QLineEdit(self)
     self._layout.addWidget(self.edit)
Ejemplo n.º 13
0
    def __init__(self, parent, available):
        QWidget.__init__(self, parent)
        self._parent = parent
        self._available = available
        vbox = QVBoxLayout(self)
        self._table = ui_tools.CheckableHeaderTable(1, 2)
        self._table.setSelectionMode(QTableWidget.SingleSelection)
        self._table.removeRow(0)
        vbox.addWidget(self._table)
        ui_tools.load_table(
            self._table,
            (translations.TR_PROJECT_NAME, translations.TR_VERSION),
            _format_for_table(available))
        self._table.setColumnWidth(0, 500)
        self._table.setSortingEnabled(True)
        self._table.setAlternatingRowColors(True)
        hbox = QHBoxLayout()
        btnInstall = QPushButton(translations.TR_INSTALL)
        btnInstall.setMaximumWidth(100)
        hbox.addWidget(btnInstall)
        hbox.addWidget(QLabel(translations.TR_NINJA_NEEDS_TO_BE_RESTARTED))
        vbox.addLayout(hbox)

        self.connect(btnInstall, SIGNAL("clicked()"), self._install_plugins)
        self.connect(self._table, SIGNAL("itemSelectionChanged()"),
                     self._show_item_description)
Ejemplo n.º 14
0
    def __init__(self, suggested, parent=None):
        super(PythonDetectDialog, self).__init__(parent, Qt.Dialog)
        self.setMaximumSize(QSize(0, 0))
        self.setWindowTitle("Configure Python Path")

        vbox = QVBoxLayout(self)
        msg_str = ("We have detected that you are using "
                   "Windows,\nplease choose the proper "
                   "Python application for you:")
        lblMessage = QLabel(self.tr(msg_str))
        vbox.addWidget(lblMessage)

        self.listPaths = QListWidget()
        self.listPaths.setSelectionMode(QListWidget.SingleSelection)
        vbox.addWidget(self.listPaths)

        hbox = QHBoxLayout()
        hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding))
        btnCancel = QPushButton(self.tr("Cancel"))
        btnAccept = QPushButton(self.tr("Accept"))
        hbox.addWidget(btnCancel)
        hbox.addWidget(btnAccept)
        vbox.addLayout(hbox)

        self.connect(btnAccept, SIGNAL("clicked()"), self._set_python_path)
        self.connect(btnCancel, SIGNAL("clicked()"), self.close)

        for path in suggested:
            self.listPaths.addItem(path)
        self.listPaths.setCurrentRow(0)
Ejemplo n.º 15
0
    def __init__(self, parent):
        QAction.__init__(self, parent)
        self.webview = parent
        self.setIcon(QIcon(getPath('iconDir', 'heditor/table.png')))
        self.setIconVisibleInMenu(True)
        self.setText("table")

        self.infolabel = QLabel("Insert a table")
        menu = QMenu(self.webview)

        action = QWidgetAction(self)
        action.setDefaultWidget(self.infolabel)
        menu.addAction(action)

        action = QWidgetAction(self)
        action.setDefaultWidget(RichHtmlTableQWidget(self))
        menu.addAction(action)

        #action = QAction(QIcon(getPath('iconDir','heditor/table1.png')),"insert styled table",self)
        #action.setIconVisibleInMenu(True)
        #menu.addAction(action)

        action = QAction(
            "insert table...",
            self,
            triggered=lambda: RichHtmlTableQDialog(self.webview).show())
        action.setIconVisibleInMenu(True)
        action.setIcon(QIcon(getPath('iconDir', 'heditor/table.png')))

        menu.addAction(action)

        self.setMenu(menu)
Ejemplo n.º 16
0
    def get_left_layout(self):
        layout = QVBoxLayout()

        layout.addLayout(self.get_misc_layout())

        self.pic = QLabel(self)
        layout.addWidget(self.pic)

        return layout
Ejemplo n.º 17
0
 def __init__(self, traceback_msg):
     QWidget.__init__(self)
     vbox = QVBoxLayout(self)
     self._editor = QPlainTextEdit()
     vbox.addWidget(QLabel(translations.TR_TRACEBACK))
     vbox.addWidget(self._editor)
     self._editor.setReadOnly(True)
     self._editor.setLineWrapMode(0)
     self._editor.insertPlainText(traceback_msg)
     self._editor.selectAll()
Ejemplo n.º 18
0
    def createDefaultGroupBox(self):
        self.defaultForm = QtGui.QGroupBox("Video capture")
        self.defaultFormLayout = QFormLayout()


        self.ArdPortComboBox = QComboBox()
        self.ArdPortComboBox.addItem("Port 14511",'/dev/cu.usbmodem14511')
        self.ArdPortComboBox.addItem("Port 14311",'/dev/cu.usbmodem14311')
        self.ArdPortComboBox.addItem("Port 1461",'/dev/cu.usbmodem1461')
        self.ArdPortComboBox.currentIndexChanged.connect(self.on_setARDport)

        self.cameraComboBox = QComboBox()
        self.cameraComboBox.addItem("0",'0')
        self.cameraComboBox.addItem("1",'1')
        self.cameraComboBox.currentIndexChanged.connect(self.on_setcameraport)

        self.start_btn = QtGui.QPushButton('start')
        self.start_btn.clicked.connect(self.on_start)

        ## stop flow button
        self.stop_btn = QtGui.QPushButton('stop')
        self.stop_btn.clicked.connect(self.on_stop)

        ## quit app button
        self.qbtn = QtGui.QPushButton('exit')
        self.qbtn.clicked.connect(self.on_quit)
        self.qbtn.clicked.connect(QtCore.QCoreApplication.instance().quit)

        hbox = QtGui.QHBoxLayout()
        hbox.addWidget(self.start_btn)
        hbox.addWidget(self.stop_btn)
        hbox.addWidget(self.qbtn)

        self.defaultFormLayout.addRow(hbox)

        self.defaultFormLayout.addRow(QLabel("Arduino Port:"),\
                                     self.ArdPortComboBox)

        self.defaultFormLayout.addRow(QLabel("camera:"),\
                                     self.cameraComboBox)

        self.defaultForm.setLayout(self.defaultFormLayout)
Ejemplo n.º 19
0
    def __init__(self,parent=None):
        QWidget.__init__(self,parent)
        
        self.__toolBar = QToolBar(self)
        self.__toolBar.setIconSize(QSize(16,16))
        self.__htmlBrowserView = HtmlBrowserView(self)
        self.__addressinput = QLineEdit(self)
        self.__loadlabel = QLabel(self)

        layout=QVBoxLayout(self)
        layout.setSpacing(0)
        layout.setMargin(0)
        layout.addWidget(self.__toolBar)
        layout.addWidget(self.__htmlBrowserView)
        
        self.__setupToolBarAction()
        
        QObject.connect(self.__addressinput, SIGNAL("returnPressed ()"),self.__evt_load)
        QObject.connect(self.__htmlBrowserView, SIGNAL("loadFinished (bool)"),lambda:self.__loadlabel.setMovie(None))
        QObject.connect(self.__htmlBrowserView, SIGNAL("loadStarted ()"),self.__evt_loadstarted)
Ejemplo n.º 20
0
    def test_tool_box(self):
        w = toolbox.ToolBox()
        style = self.app.style()
        icon = QIcon(style.standardPixmap(style.SP_FileIcon))
        p1 = QLabel("A Label")
        p2 = QListView()
        p3 = QLabel("Another\nlabel")
        p4 = QSpinBox()

        i1 = w.addItem(p1, "T1", icon)
        i2 = w.addItem(p2, "Tab " * 10, icon, "a tab")
        i3 = w.addItem(p3, "t3")
        i4 = w.addItem(p4, "t4")

        self.assertSequenceEqual([i1, i2, i3, i4], range(4))
        self.assertEqual(w.count(), 4)

        for i, item in enumerate([p1, p2, p3, p4]):
            self.assertIs(item, w.widget(i))
            b = w.tabButton(i)
            a = w.tabAction(i)
            self.assertIsInstance(b, QAbstractButton)
            self.assertIs(b.defaultAction(), a)

        w.show()
        w.removeItem(2)

        self.assertEqual(w.count(), 3)
        self.assertIs(w.widget(2), p4)

        p3 = QLabel("Once More Unto the Breach")

        w.insertItem(2, p3, "Dear friend")

        self.assertEqual(w.count(), 4)

        self.assertIs(w.widget(1), p2)
        self.assertIs(w.widget(2), p3)
        self.assertIs(w.widget(3), p4)

        self.app.exec_()
Ejemplo n.º 21
0
    def createParamGroupBox(self):
        self.paramForm = QGroupBox("Trial parameters")
        self.paramFormLayout = QFormLayout()

        self.Timer_tbox = QtGui.QLineEdit()

        self.trialTime_tbox = QtGui.QLineEdit()
        self.trialTime_tbox.textChanged.connect(self.on_trialTime_changed)
        self.trialSleepTime_tbox = QtGui.QLineEdit()
        self.trialSleepTime_tbox.textChanged.connect(self.on_trialSleepTime_changed)
        self.trialTime_tbox.setText(str(self.trialTime))
        self.trialSleepTime_tbox.setText(str(self.trialSleepTime))
        self.Timer_tbox.setText(str(0))

        self.paramFormLayout.addRow(QLabel("Trial time:"), self.trialTime_tbox)
        self.paramFormLayout.addRow(QLabel("Stimulus time:"), self.trialSleepTime_tbox)

        self.paramFormLayout.addRow(QLabel("Time left:"), self.Timer_tbox)

        self.paramFormLayout.addRow(QLabel("Time:"), QSpinBox())
        self.paramForm.setLayout(self.paramFormLayout)
    def createTextGroupBox(self):
        self.textForm = QGroupBox('Imaging')
        self.textLayout = QFormLayout()

        ## parameters
        self.maxArea_box = QtGui.QLineEdit()
        self.num_detected_box = QtGui.QLineEdit()
        self.maxArea_box.setText('0')
        self.num_detected_box.setText('0')

        hbox = QtGui.QHBoxLayout()
        hbox.addWidget(QLabel("max area:"))
        hbox.addWidget(self.maxArea_box)
        hboxD = QtGui.QHBoxLayout()
        hboxD.addWidget(QLabel("fish #:"))
        hboxD.addWidget(self.num_detected_box)

        self.textLayout.addRow(hbox)
        self.textLayout.addRow(hboxD)

        self.textForm.setLayout(self.textLayout)
Ejemplo n.º 23
0
    def get_misc_layout(self):
        layout = QGridLayout()
        row = 0

        layout.addWidget(QLabel('N'), row, 0)
        self.n_frames = QLabel('0')
        layout.addWidget(self.n_frames, row, 1)
        row += 1

        layout.addWidget(QLabel('Laplacian: %s' % bool(LAPLACIAN)), row, 0)
        row += 1
        layout.addWidget(QLabel('Laplacian2: %s' % bool(LAPLACIAN2)), row, 0)
        row += 1
        layout.addWidget(QLabel('Hist eq: %s' % bool(HISTEQ)), row, 0)
        row += 1
        layout.addWidget(QLabel('Color map: %s' % (COLORMAP is not None, )),
                         row, 0)
        row += 1
        layout.addWidget(QLabel('Bin scalar: %s' % SCALE_BIN), row, 0)
        row += 1
        layout.addWidget(QLabel('Display scalar: %s' % SCALE_DST), row, 0)
        row += 1

        self.v4ls = {}
        # hacked driver to directly drive values
        for ki, (label, v4l_name) in enumerate(
            (("Red", "Red Balance"), ("Green", "Gain"),
             ("Blue", "Blue Balance"), ("Exp", "Exposure"))):
            cols = 4
            rowoff = ki / cols
            coloff = cols * (ki % cols)

            layout.addWidget(QLabel(label), row + rowoff, coloff)
            le = QLineEdit('')
            self.v4ls[v4l_name] = le
            layout.addWidget(le, row + rowoff, coloff + 1)
            le.textChanged.connect(self.v4l_updated)
        row += 2

        return layout
Ejemplo n.º 24
0
    def __init__(self, parent=None):
        QMainWindow.__init__(self, parent)

        self.setFixedSize(600, 180)
        self.l0 = QLabel(self)
        self.l0.setFixedWidth(300)
        self.l0.setFixedHeight(40)
        self.l0.setAlignment(Qt.AlignCenter)
        self.l0.setText("Breathing(bpm)")
        self.l0.move(0, 0)

        self.l1 = QLabel(self)
        self.l1.setFixedWidth(300)
        self.l1.setFixedHeight(40)
        self.l1.setAlignment(Qt.AlignCenter)
        self.l1.setText("Heart Rate(bpm)")
        self.l1.move(300, 0)

        pe = QPalette()
        pe.setColor(QPalette.WindowText, Qt.yellow)
        pe.setColor(QPalette.Background, Qt.gray)
        self.l0.setAutoFillBackground(True)
        self.l0.setPalette(pe)
        self.l1.setAutoFillBackground(True)
        self.l1.setPalette(pe)

        self.l0.setFont(QFont("Roman times", 20, QFont.Bold))
        self.l1.setFont(QFont("Roman times", 20, QFont.Bold))

        self.lbr = QLabel(self)
        self.lbr.setFixedWidth(300)
        self.lbr.setFixedHeight(60)
        self.lbr.setAlignment(Qt.AlignCenter)
        self.lbr.setFont(QFont("Roman times", 55, QFont.Bold))
        self.lbr.setText("Breathing")
        self.lbr.move(0, 75)

        self.lhr = QLabel(self)
        self.lhr.setFixedWidth(300)
        self.lhr.setFixedHeight(60)
        self.lhr.setAlignment(Qt.AlignCenter)
        self.lhr.setFont(QFont("Roman times", 55, QFont.Bold))
        self.lhr.setText("Heart Rate")

        self.lhr.move(300, 75)
Ejemplo n.º 25
0
 def __init__(self):
     QDialog.__init__(self)
     self.setWindowTitle(translations.TR_PLUGIN_ERROR_REPORT)
     self.resize(600, 400)
     vbox = QVBoxLayout(self)
     label = QLabel(translations.TR_SOME_PLUGINS_REMOVED)
     vbox.addWidget(label)
     self._tabs = QTabWidget()
     vbox.addWidget(self._tabs)
     hbox = QHBoxLayout()
     btnAccept = QPushButton(translations.TR_ACCEPT)
     btnAccept.setMaximumWidth(100)
     hbox.addWidget(btnAccept)
     vbox.addLayout(hbox)
     #signals
     self.connect(btnAccept, SIGNAL("clicked()"), self.close)
Ejemplo n.º 26
0
        def low_res_layout():
            layout = QVBoxLayout()
            layout.addWidget(QLabel("Overview"))

            # Raw X-windows canvas
            self.video_container = QWidget()
            # Allows for convenient keyboard control by clicking on the video
            self.video_container.setFocusPolicy(Qt.ClickFocus)
            w, h = 3264 / 4, 2448 / 4
            self.video_container.setMinimumSize(w, h)
            self.video_container.resize(w, h)
            policy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
            self.video_container.setSizePolicy(policy)

            layout.addWidget(self.video_container)

            return layout
Ejemplo n.º 27
0
    def __init__(self, parent):
        QDialog.__init__(self, parent, Qt.Dialog)
        self.setWindowTitle(translations.TR_PLUGIN_MANAGER)
        self.resize(700, 600)

        vbox = QVBoxLayout(self)
        self._tabs = QTabWidget()
        vbox.addWidget(self._tabs)
        self._txt_data = QTextBrowser()
        self._txt_data.setOpenLinks(False)
        vbox.addWidget(QLabel(translations.TR_PROJECT_DESCRIPTION))
        vbox.addWidget(self._txt_data)
        # Footer
        hbox = QHBoxLayout()
        btn_close = QPushButton(translations.TR_CLOSE)
        btnReload = QPushButton(translations.TR_RELOAD)
        hbox.addWidget(btn_close)
        hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding))
        hbox.addWidget(btnReload)
        vbox.addLayout(hbox)
        self.overlay = ui_tools.Overlay(self)
        self.overlay.hide()

        self._oficial_available = []
        self._community_available = []
        self._locals = []
        self._updates = []
        self._loading = True
        self._requirements = {}

        self.connect(btnReload, SIGNAL("clicked()"), self._reload_plugins)
        self.thread = ThreadLoadPlugins(self)
        self.connect(self.thread, SIGNAL("finished()"),
                     self._load_plugins_data)
        self.connect(self.thread, SIGNAL("plugin_downloaded(PyQt_PyObject)"),
                     self._after_download_plugin)
        self.connect(self.thread,
                     SIGNAL("plugin_manually_installed(PyQt_PyObject)"),
                     self._after_manual_install_plugin)
        self.connect(self.thread, SIGNAL("plugin_uninstalled(PyQt_PyObject)"),
                     self._after_uninstall_plugin)
        self.connect(self._txt_data, SIGNAL("anchorClicked(const QUrl&)"),
                     self._open_link)
        self.connect(btn_close, SIGNAL('clicked()'), self.close)
        self.overlay.show()
        self._reload_plugins()
    def __init__(self, scheme, parent):
        super(EditorSchemeDesigner, self).__init__(parent, Qt.Dialog)
        self.original_style = copy.copy(resources.CUSTOM_SCHEME)
        self._avoid_on_loading, self.saved, self._components = True, False, {}
        self.setWindowTitle(translations.TR_PREFERENCES_EDITOR_SCHEME_DESIGNER)
        self.setMinimumSize(450, 480)
        self.setMaximumSize(500, 900)
        self.resize(450, 600)

        # all layouts and groupboxes
        group0 = QGroupBox(translations.TR_PROJECT_NAME)  # scheme filename
        group1 = QGroupBox(translations.TR_PROJECT_PROPERTIES)  # properties
        group2 = QGroupBox(translations.TR_PREVIEW)  # quick preview thingy
        group0_hbox, group1_vbox = QHBoxLayout(group0), QVBoxLayout(group1)
        this_dialog_vbox, group2_vbox = QVBoxLayout(self), QVBoxLayout(group2)
        self._grid, scrollArea, frame = QGridLayout(), QScrollArea(), QFrame()

        # widgets
        self.line_name, btnSave = QLineEdit(), QPushButton(
            translations.TR_SAVE)
        self.line_name.setPlaceholderText(getuser().capitalize() + "s_scheme")
        group0_hbox.addWidget(self.line_name)
        group0_hbox.addWidget(btnSave)
        self.connect(btnSave, SIGNAL("clicked()"), self.save_scheme)
        _demo = "<center>" + ascii_letters  # demo text for preview
        self.preview_label1, self.preview_label2 = QLabel(_demo), QLabel(_demo)
        group2_vbox.addWidget(self.preview_label1)
        group2_vbox.addWidget(self.preview_label2)

        # rows titles
        self._grid.addWidget(QLabel("<b>" + translations.TR_PROJECT_NAME), 0,
                             0)
        self._grid.addWidget(QLabel("<b>" + translations.TR_CODE), 0, 1)
        self._grid.addWidget(
            QLabel("<b>" + translations.TR_EDITOR_SCHEME_PICK_COLOR), 0, 2)

        # fill rows
        for key in sorted(tuple(resources.COLOR_SCHEME.keys())):
            self.add_item(key, scheme)
        self.preview_label1.setStyleSheet('background:transparent')
        self.preview_label2.setStyleSheet('color:     transparent')

        # fill the scroll area
        frame.setLayout(self._grid)
        scrollArea.setWidget(frame)
        group1_vbox.addWidget(scrollArea)

        # put groups on the dialog
        this_dialog_vbox.addWidget(group1)
        this_dialog_vbox.addWidget(group2)
        this_dialog_vbox.addWidget(group0)
        self._avoid_on_loading = self._modified = False
Ejemplo n.º 29
0
    def initUI(self):
        cw = QWidget()
        self.setCentralWidget(cw)
        grid = QGridLayout()
        grid.setSpacing(15)

        # status bar
        self.statusBar().showMessage('Ready')

        font_label = QFont()
        font_label.setBold(True)
        ################ dicom reader
        rstart = 0
        text_dcm = QLabel('DICOM reader')
        text_dcm.setFont(font_label)
        self.text_dcm_dir = QLabel('DICOM dir:')
        self.text_dcm_data = QLabel('DICOM data:')
        self.text_dcm_out = QLabel('output file:')
        grid.addWidget(text_dcm, rstart + 0, 1, 1, 4)
        grid.addWidget(self.text_dcm_dir, rstart + 1, 1, 1, 4)
        grid.addWidget(self.text_dcm_data, rstart + 2, 1, 1, 4)
        grid.addWidget(self.text_dcm_out, rstart + 3, 1, 1, 4)
        btn_dcmdir = QPushButton("Load DICOM", self)
        btn_dcmdir.clicked.connect(self.loadDcmDir)
        btn_dcmred = QPushButton("Organ Segmentation", self)
        btn_dcmred.clicked.connect(self.organSegmentation)
        btn_dcmcrop = QPushButton("Crop", self)
        btn_dcmcrop.clicked.connect(self.cropDcm)
        btn_dcmsave = QPushButton("Save DCM", self)
        btn_dcmsave.clicked.connect(self.saveDcm)
        grid.addWidget(btn_dcmdir, rstart + 4, 1)
        grid.addWidget(btn_dcmred, rstart + 4, 2)
        grid.addWidget(btn_dcmcrop, rstart + 4, 3)
        grid.addWidget(btn_dcmsave, rstart + 4, 4)

        hr = QFrame()
        hr.setFrameShape(QFrame.HLine)
        grid.addWidget(hr, rstart + 5, 0, 1, 6)

        # quit
        btn_quit = QPushButton("Quit", self)
        btn_quit.clicked.connect(self.quit)
        grid.addWidget(btn_quit, 24, 2, 1, 2)

        cw.setLayout(grid)
        self.setWindowTitle('liver-surgery')
        self.show()
Ejemplo n.º 30
0
    def __init__(self, requirements_dict):
        super(DependenciesHelpDialog, self).__init__()
        self.setWindowTitle(translations.TR_REQUIREMENTS)
        self.resize(525, 400)
        vbox = QVBoxLayout(self)
        label = QLabel(translations.TR_SOME_PLUGINS_NEED_DEPENDENCIES)
        vbox.addWidget(label)
        self._editor = QPlainTextEdit()
        self._editor.setReadOnly(True)
        vbox.addWidget(self._editor)
        hbox = QHBoxLayout()
        btnAccept = QPushButton(translations.TR_ACCEPT)
        btnAccept.setMaximumWidth(100)
        hbox.addWidget(btnAccept)
        vbox.addLayout(hbox)
        #signals
        self.connect(btnAccept, SIGNAL("clicked()"), self.close)

        command_tmpl = "<%s>:\n%s\n"
        for name, description in list(requirements_dict.items()):
            self._editor.insertPlainText(command_tmpl % (name, description))
    def _update_ranging_status_indicators(self):
        container = self._anchor_stats_container

        ids = sorted(self._anchors.keys())

        # Update existing labels or add new if needed
        count = 0
        for id in ids:
            col = count % 8
            row = int(count / 8)

            if count < container.count():
                label = container.itemAtPosition(row, col).widget()
            else:
                label = QLabel()
                label.setMinimumSize(30, 0)
                label.setProperty('frameShape', 'QFrame::Box')
                label.setAlignment(Qt.AlignCenter)
                container.addWidget(label, row, col)

            label.setText(str(id))

            if self._anchors[id].is_active():
                label.setStyleSheet(STYLE_GREEN_BACKGROUND)
            else:
                label.setStyleSheet(STYLE_RED_BACKGROUND)

            count += 1

        # Remove labels if there are too many
        for i in range(count, container.count()):
            col = i % 8
            row = int(i / 8)

            label = container.itemAtPosition(row, col).widget()
            label.deleteLater()