Example #1
2
class DragPlotWidget(QFrame):
    ''' draggable widget plotting data and
    a combo box to choose channel
    '''
    
    def __init__(self, parent=None):
        super(DragPlotWidget, self).__init__(parent)
        
        # transparent fill color and a frame with size 400x250 
        self.setStyleSheet("QFrame {  border: 2px solid black; background-image: url(); }")
        self.setGeometry(1,1,400,250)
        
        # arrange elements in a gridLayout
        l = QGridLayout()
        self.setLayout(l)
        
        self.p = pq.PlotWidget(self)
        self.p.setYRange(-0.0002, 0.0002)
        self.pl1 = self.p.plot(np.linspace(0,3.4, 1000))  # initial plot
        
        self.box = QComboBox(self)
        self.box.addItems(["EMG " + str(x+1) for x in range(16)])
        self.box.currentIndexChanged.connect(self.changeChannel)
        
        l.addWidget(self.p)
        l.addWidget(self.box)
        
        self.dragPos = QPoint(0,0)
        
    def mousePressEvent(self, e):
        ''' enter drag mode by left click and save position '''
        if e.buttons() != Qt.LeftButton:
            return
        self.dragPos = e.pos()
        
    def mouseMoveEvent(self, e):
        ''' move by holding left mouse button and update position
        - removing offset by subtracting saved dragPos
        '''
        if e.buttons() != Qt.LeftButton:
            return
        position = e.pos() + self.pos() - self.dragPos
        self.move(position)
        self.update()
        self.parent().update()
    
    def mouseReleaseEvent(self, e):
        ''' release left mouse button and exit drag mode '''
        if e.buttons() != Qt.LeftButton:
            return
        position = e.pos() + self.pos() - self.dragPos
        self.move(position)
    
    def changeChannel(self, index):
        ''' change channel to index and clear plot '''
        self.p.plot([0], clear=True)
    
    def updatePlot(self, data):
        ''' plot new data '''
        self.p.plot(data[self.box.currentIndex()], clear=True)
Example #2
1
    def setup_toolbar(self):
        color_widget = ColorWidget()
        color_widget.color_changed.connect(self.fourier.on_color_change)
        self.toolBar.addWidget(QLabel("Color:"))
        self.toolBar.addWidget(color_widget)

        self.toolBar.addWidget(QLabel("Shape:"))
        size_spin = QSpinBox(self.toolBar)
        size_spin.setValue(20)
        size_spin.valueChanged[int].connect(self.fourier.on_size_change)

        shape_combo = QComboBox(self.toolBar)
        shape_combo.activated[str].connect(self.fourier.on_shape_change)
        shape_combo.addItems(brush_shapes)

        self.toolBar.addWidget(shape_combo)
        self.toolBar.addWidget(size_spin)

        self.toolBar.addWidget(QLabel("Symmetry:"))
        x_sym = QCheckBox(self.toolBar)
        x_sym.toggled.connect(self.fourier.on_x_toggle)

        opp_sym = QCheckBox(self.toolBar)
        opp_sym.toggled.connect(self.fourier.on_opp_toggle)
        self.toolBar.addWidget(QLabel("X"))
        self.toolBar.addWidget(x_sym)

        y_sym = QCheckBox(self.toolBar)
        y_sym.toggled.connect(self.fourier.on_y_toggle)
        self.toolBar.addWidget(QLabel("Y"))
        self.toolBar.addWidget(y_sym)
        self.toolBar.addWidget(QLabel("Center"))
        self.toolBar.addWidget(opp_sym)
Example #3
0
 def __init__(self, parent=None):
   super(ExportDialog, self).__init__(parent)
   self._output_folder = None
   self.setModal(True)
   layout_main = QGridLayout()
   label_choose_format = QLabel(self.tr("Choose format"))
   self.combo_choose_format = QComboBox()
   self.combo_choose_format.setModel(QStringListModel(FileExporter.FORMATS_AVAILABLE))
   label_saveto = QLabel(self.tr("Save location"))
   button_saveto = QPushButton(self.tr("Browse ..."))
   button_saveto.clicked.connect(self._openFolderChoiceDialog)
   self.label_output = QLabel()
   button_export = QPushButton(self.tr("Export"))
   button_export.clicked.connect(self.accept)
   button_cancel = QPushButton(self.tr("Cancel"))
   button_cancel.clicked.connect(self.reject)
   row = 0; col = 0;
   layout_main.addWidget(label_choose_format, row, col, 1, 2)
   col += 2
   layout_main.addWidget(self.combo_choose_format, row, col, 1, 2)
   row += 1; col -= 2;
   layout_main.addWidget(label_saveto, row, col, 1, 2)
   col += 2
   layout_main.addWidget(button_saveto, row, col, 1, 2)
   row += 1; col -= 2;
   layout_main.addWidget(self.label_output, row, col, 1, 4)
   row += 1; col += 2
   layout_main.addWidget(button_export, row, col)
   col += 1
   layout_main.addWidget(button_cancel, row, col)
   self.setWindowTitle(self.tr("Export Parameters"))
   self.setLayout(layout_main)
 def createEditor(self, parent, option, index):
     """ Should return a combo box with Income or Expense """
     self.accounts = Accounts.all()
     self.accountNames = [account.name for account in self.accounts]
     comboBox = QComboBox(parent)
     comboBox.insertItems(0, self.accountNames)
     return comboBox
Example #5
0
class CustomPage(QWizardPage):
    '''
    Custom Computer Wizard Page
    
    Contains inputs for the Driver and Parser that the user can define a 
    custom mix of driver/parser/options.
    '''
    def __init__(self, parent=None):
        super(CustomPage, self).__init__(parent)
        
        self._createLayout()
        
        self.registerField('driver', self._cbxDriver)
        self.registerField('parser', self._cbxParser)
        self.registerField('driveropt', self._txtDOpts)
        self.registerField('parseropt', self._txtPOpts)
    
        self.setTitle(self.tr('Setup Driver Options'))
        self.setSubTitle(self.tr('Select the Driver and Parser to use with your Dive Computer.'))
    
    def nextId(self):
        'Return the next Page Id'
        return Pages.Browse
    
    def _createLayout(self):
        'Create the Wizard Page Layout'
        
        self._cbxDriver = QComboBox()
        self._cbxDriver.setModel(DriverModel())
        self._lblDriver = QLabel(self.tr('&Driver:'))
        self._lblDriver.setBuddy(self._cbxDriver)
        
        self._cbxParser = QComboBox()
        self._cbxParser.setModel(ParserModel())
        self._lblParser = QLabel(self.tr('&Parser:'))
        self._lblParser.setBuddy(self._cbxParser)
        
        self._txtDOpts = QLineEdit()
        self._lblDOpts = QLabel(self.tr('Driver Options:'))
        self._lblDOpts.setBuddy(self._txtDOpts)
        
        self._txtPOpts = QLineEdit()
        self._lblPOpts = QLabel(self.tr('Parser Options:'))
        self._lblPOpts.setBuddy(self._txtPOpts)
        
        gbox = QGridLayout()
        gbox.addWidget(self._lblDriver, 0, 0)
        gbox.addWidget(self._cbxDriver, 0, 1)
        gbox.addWidget(self._lblParser, 1, 0)
        gbox.addWidget(self._cbxParser, 1, 1)
        gbox.addWidget(self._lblDOpts, 2, 0)
        gbox.addWidget(self._txtDOpts, 2, 1)
        gbox.addWidget(self._lblPOpts, 3, 0)
        gbox.addWidget(self._txtPOpts, 3, 1)
        
        vbox = QVBoxLayout()
        vbox.addLayout(gbox)
        vbox.addStretch()
        
        self.setLayout(vbox)
Example #6
0
    def __init__(self, parent=None):
        super(TransferTaskDialog, self).__init__(parent)

        layout = QFormLayout(self)

        self.to_queue_selector = QComboBox()
        self.from_queue_selector = QComboBox()

        queue_list = cqmanage.cqQueueList()
        for queue in queue_list:
            self.to_queue_selector.addItem(str(queue))
            self.from_queue_selector.addItem(str(queue))

        self.number_to_transfer = QLineEdit("")

        layout.addRow("To Queue:", self.to_queue_selector)
        layout.addRow("From Queue:", self.from_queue_selector)
        layout.addRow("Amount:", self.number_to_transfer)

        # OK and Cancel buttons
        self.buttons = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self)
        layout.addWidget(self.buttons)

        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)

        self.setWindowTitle("Transfer Tasks")
        self.resize(225, 150)
Example #7
0
    def createWidgets(self):
        self.extensionLabel = QLabel("&Extension")
        self.extensionComboBox = QComboBox()
        for markup in self.state.model.markups():
            self.extensionComboBox.addItem(markup)
        self.tooltips.append((self.extensionComboBox, """\
<p><b>Extension</b></p>
<p>Choose the file extension to view and edit its custom markup.</p>"""))
        self.extensionLabel.setBuddy(self.extensionComboBox)
        self.helpButton = QPushButton(QIcon(":/help.svg"), "Help")
        self.tooltips.append(
            (self.helpButton, "Help on the Custom Markup dialog"))
        self.addButton = QPushButton(QIcon(":/add.svg"), "&Add...")
        self.tooltips.append((self.addButton, """\
<p><b>Add</b></p>
<p>Add a new custom markup to the index.</p>"""))
        self.deleteButton = QPushButton(QIcon(":/delete.svg"), "&Delete...")
        self.tooltips.append((self.deleteButton, """\
<p><b>Delete</b></p>
<p>Permanently delete the custom markup from the index's <tt>.xix</tt>
file. (Note that <tt>.ucp</tt> custom markup cannot be deleted.)</p>"""))
        self.closeButton = QPushButton(QIcon(":/dialog-close.svg"), "&Close")
        self.tooltips.append((self.closeButton, """<p><b>Close</b></p>
<p>Close the dialog.</p>"""))
        self.tabWidget = QTabWidget()
        self.documentPanel = CustomMarkupPanels.Document.Panel(
            self.state, self)
        self.characterPanel = CustomMarkupPanels.Character.Panel(
            self.state, self)
        self.tabWidget.addTab(self.documentPanel, "D&ocument")
        self.tabWidget.addTab(self.characterPanel, "C&haracter")
Example #8
0
    def initUI(self):

        self.scopeSelector = QComboBox()
        self.scopeSelector.addItem("Layout", FileSelector.ScopeLayout)
        self.scopeSelector.addItem("Device and RF", FileSelector.ScopeDevice)
        self.scopeSelector.addItem("Firmware Update",
                                   FileSelector.ScopeFirmware)
        # self.scopeSelector.addItem("All", FileSelector.ScopeAll)

        self.scopeSelector.currentIndexChanged.connect(self.scopeUpdate)

        self.layoutSettings = LayoutSettingsScope()
        self.deviceSettings = DeviceSettingsScope()
        self.firmwareSettings = FirmwareSettingsScope()

        self.scope = None

        self.layout = QVBoxLayout()
        self.layout.addWidget(self.scopeSelector)

        self.stackedLayout = QStackedLayout()
        self.stackedLayout.addWidget(self.layoutSettings)
        self.stackedLayout.addWidget(self.deviceSettings)
        self.stackedLayout.addWidget(self.firmwareSettings)

        self.layout.addLayout(self.stackedLayout)

        self.setMinimumSize(0, 300)

        self.setLayout(self.layout)
    def __init__(self,parent=None):
        super(Form,self).__init__(parent)

        date = self.get_data()
        rates = sorted(self.rates.keys())

        dateLabel = QLabel(date)

        self.fromComboBox = QComboBox()
        self.toComboBox = QComboBox()

        self.fromComboBox.addItems(rates)
        self.toComboBox.addItems(rates)

        self.fromSpinBox = QDoubleSpinBox()
        self.fromSpinBox.setRange(0.01,1000)
        self.fromSpinBox.setValue(1.00)

        self.toLabel = QLabel("1.00")

        layout = QGridLayout();
        layout.addWidget(dateLabel,5,0)
        layout.addWidget(self.fromComboBox, 1,0)
        layout.addWidget(self.toComboBox,2,0)
        layout.addWidget(self.fromSpinBox,1,1)
        layout.addWidget(self.toLabel,2,1)

        self.setLayout(layout)

        #Connect Signal
        self.fromComboBox.currentIndexChanged.connect(self.update_ui)
        self.toComboBox.currentIndexChanged.connect(self.update_ui)
        self.fromSpinBox.valueChanged.connect(self.update_ui)
Example #10
0
	def __init__(self, root_node, parent=None):
		super(AddScenarioDlg, self).__init__(parent)
		self.setWindowTitle("Add Scenario")
		
		type_label = QLabel("&Scenario Type:")
		self.type_combobox = QComboBox()
		type_label.setBuddy(self.type_combobox)
		self.type_combobox.addItems(["External Fire", "Liquid Overfill", "Regulator Failure"])
		device_label = QLabel("&Associated Relief Device:")
		self.device_combobox = QComboBox()
		device_label.setBuddy(self.device_combobox)
		for area in root_node.children:
			for device in area.children:
				self.device_combobox.addItem(device.name, device)
		button_box = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
			
		layout = QGridLayout()
		layout.addWidget(type_label, 0, 0)
		layout.addWidget(self.type_combobox, 0, 1)
		layout.addWidget(device_label, 1, 0)
		layout.addWidget(self.device_combobox, 1, 1)
		layout.addWidget(button_box, 2, 1)
		self.setLayout(layout)
		
		button_box.accepted.connect(self.accept)
		button_box.rejected.connect(self.reject)
Example #11
0
	def __init__(self, renderController, parent=None):
		super(RenderParameterWidget, self).__init__(parent=parent)

		self.renderController = renderController
		self.renderController.visualizationChanged.connect(self.visualizationLoaded)

		self.paramWidget = None

		self.visTypeComboBox = QComboBox()
		for visualizationType in self.renderController.visualizationTypes:
			self.visTypeComboBox.addItem(visualizationType)

		layout = QGridLayout()
		layout.setAlignment(Qt.AlignTop)
		layout.setSpacing(10)
		layout.setContentsMargins(10, 0, 10, 0)
		if len(self.renderController.visualizationTypes) > 1:
			layout.addWidget(QLabel("Visualization type:"), 0, 0)
			layout.addWidget(self.visTypeComboBox, 0, 1)
		self.setLayout(layout)

		self.scrollArea = QScrollArea()
		self.scrollArea.setFrameShape(QFrame.NoFrame)
		self.scrollArea.setAutoFillBackground(False)
		self.scrollArea.setAttribute(Qt.WA_TranslucentBackground)
		self.scrollArea.setWidgetResizable(True)

		self.visTypeComboBox.currentIndexChanged.connect(self.visTypeComboBoxChanged)
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.__parent = parent
        self.setWindowTitle("Add Employee")
        self.id = QLineEdit(self)
        self.id.setValidator(QRegExpValidator(QRegExp("[a-zA-Z0-9-_]+")))
        self.name = QLineEdit(self)
        self.name.setValidator(QRegExpValidator(QRegExp("[a-zA-Z\s]+")))
        self.designation = QComboBox(self)

        # self.designation.addItems(DatabaseManager.db.getDesignations())

        self.originalPay = QLineEdit(self)
        self.originalPay.setValidator(QDoubleValidator())
        self.originalPayGrade = QLineEdit(self)
        self.originalPayGrade.setValidator(QDoubleValidator())
        self.DOJ = DatePicker(self)
        self.pan = QLineEdit(self)
        self.pan.setValidator(QRegExpValidator(QRegExp("[A-Z]{5}\d{4}[A-Z]")))

        self.bttnAddEmployee = QPushButton("Add Employee")
        self.bttnCancel = QPushButton("Cancel")
        self.bttnAddEmployee.setObjectName("OkButton")
        self.bttnCancel.setObjectName("CancelButton")
        self.bttnCancel.clicked.connect(self.goBack)
        self.bttnAddEmployee.clicked.connect(self.add)

        self.designation.addItems(DatabaseManager.db.getDesignations())

        self.setupUI()
Example #13
0
class CopyScenarioDlg(QDialog):

	def __init__(self, root_node, parent=None):
		super(CopyScenarioDlg, self).__init__(parent)
		self.setWindowTitle("Duplicate Scenario")
		
		device_label = QLabel("&Copy Scenario To:")
		self.device_combobox = QComboBox()
		device_label.setBuddy(self.device_combobox)
		for area in root_node.children:
			for device in area.children:
				self.device_combobox.addItem(device.name, device)
		button_box = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
			
		layout = QGridLayout()
		layout.addWidget(device_label, 0, 0)
		layout.addWidget(self.device_combobox, 0, 1)
		layout.addWidget(button_box, 1, 1)
		self.setLayout(layout)
		
		button_box.accepted.connect(self.accept)
		button_box.rejected.connect(self.reject)
		
	def returnVals(self):
		return self.device_combobox.itemData(self.device_combobox.currentIndex())
Example #14
0
 def create_main_area(self, layout):
     # Master password
     master_password_label = QLabel("&Master-Passwort:")
     self.master_password_edit = QLineEdit()
     self.master_password_edit.setEchoMode(QLineEdit.EchoMode.Password)
     self.master_password_edit.textChanged.connect(self.masterpassword_changed)
     self.master_password_edit.returnPressed.connect(self.move_focus)
     self.master_password_edit.editingFinished.connect(self.masterpassword_entered)
     self.master_password_edit.setMaximumHeight(28)
     master_password_label.setBuddy(self.master_password_edit)
     layout.addWidget(master_password_label)
     layout.addWidget(self.master_password_edit)
     # Domain
     domain_label = QLabel("&Domain:")
     self.domain_edit = QComboBox()
     self.domain_edit.setEditable(True)
     self.domain_edit.textChanged.connect(self.domain_changed)
     self.domain_edit.currentIndexChanged.connect(self.domain_changed)
     self.domain_edit.lineEdit().editingFinished.connect(self.domain_entered)
     self.domain_edit.lineEdit().returnPressed.connect(self.move_focus)
     self.domain_edit.setMaximumHeight(28)
     domain_label.setBuddy(self.domain_edit)
     layout.addWidget(domain_label)
     layout.addWidget(self.domain_edit)
     # Username
     self.username_label = QLabel("&Username:"******"&Passwortstärke:")
     self.strength_label.setVisible(False)
     self.strength_selector = PasswordStrengthSelector()
     self.strength_selector.set_min_length(4)
     self.strength_selector.set_max_length(36)
     self.strength_selector.setMinimumHeight(60)
     self.strength_selector.set_length(12)
     self.strength_selector.set_complexity(6)
     self.strength_selector.strength_changed.connect(self.strength_changed)
     self.strength_selector.setVisible(False)
     self.strength_label.setBuddy(self.strength_selector)
     layout.addWidget(self.strength_label)
     layout.addWidget(self.strength_selector)
     # Password
     self.password_label = QLabel("&Passwort:")
     self.password_label.setVisible(False)
     self.password = QLabel()
     self.password.setTextFormat(Qt.PlainText)
     self.password.setAlignment(Qt.AlignCenter)
     self.password.setFont(QFont("Helvetica", 18, QFont.Bold))
     self.password.setVisible(False)
     self.password_label.setBuddy(self.password)
     layout.addWidget(self.password_label)
     layout.addWidget(self.password)
Example #15
0
class aLabeledPopup(QWidget):
    def __init__(self, var, text, item_list, pos = "side", max_size = 200):
        QWidget.__init__(self)
        self.setContentsMargins(1, 1, 1, 1)
        if pos == "side":
            self.layout1=QHBoxLayout()
        else:
            self.layout1 = QVBoxLayout()
        self.layout1.setContentsMargins(1, 1, 1, 1)
        self.layout1.setSpacing(1)
        self.setLayout(self.layout1)
        
        self.item_combo = QComboBox()
        self.item_combo.addItems(item_list)
        self.item_combo.setFont(QFont('SansSerif', 12))
        self.label = QLabel(text)
        # self.label.setAlignment(Qt.AlignLeft)
        self.label.setFont(QFont('SansSerif', 12))
        self.layout1.addWidget(self.label)
        self.layout1.addWidget(self.item_combo)
        self.var = var
        self.item_combo.textChanged.connect(self.when_modified)
        self.item_combo.currentIndexChanged.connect(self.when_modified)
        self.when_modified()
        
    def when_modified(self):
        self.var.set(self.item_combo.currentText())
        
    def hide(self):
        QWidget.hide(self)
Example #16
0
	def __init__(self, root_node, parent=None):
		super(AddDeviceDlg, self).__init__(parent)
		self.setWindowTitle("Add Relief Device")

		id_label = QLabel("&Relief Device ID:")
		self.id_lineedit = QLineEdit()
		self.id_lineedit.setMaxLength(200)
		id_label.setBuddy(self.id_lineedit)
		area_label = QLabel("Associated Relief Device &Area:")
		self.area_combobox = QComboBox()
		for area in root_node.children:
			self.area_combobox.addItem(area.name, area)
		area_label.setBuddy(self.area_combobox)
		color_label = QLabel("&Text Color:")
		self.color_combobox = QComboBox()
		for key in sorted(COLORS.keys()):
			pixmap = QPixmap(26, 26)
			pixmap.fill(COLORS[key])
			self.color_combobox.addItem(QIcon(pixmap), key)
		color_label.setBuddy(self.color_combobox)
		button_box = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
			
		layout = QGridLayout()
		layout.addWidget(id_label, 0, 0)
		layout.addWidget(self.id_lineedit, 0, 1)
		layout.addWidget(area_label, 1, 0)
		layout.addWidget(self.area_combobox, 1, 1)
		layout.addWidget(color_label, 2, 0)
		layout.addWidget(self.color_combobox, 2, 1)
		layout.addWidget(button_box, 3, 1)
		self.setLayout(layout)
		
		button_box.accepted.connect(self.accept)
		button_box.rejected.connect(self.reject)
Example #17
0
class ChooseMarkerDialog(QDialog):
	def __init__(self,markers):
		super(ChooseMarkerDialog, self).__init__()
		self.setWindowTitle('Select final marker...')
		markerLabel			= QLabel('Marker:')
		self.marker			= QComboBox()
		self.marker.addItems(markers)
		self.marker.setCurrentIndex(-1)
		layout				= QGridLayout()
		layout.addWidget(markerLabel,0,0)
		layout.addWidget(self.marker,0,1)
		self.buttons		= QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)	
		self.buttons.accepted.connect(self.accept)
		self.buttons.rejected.connect(self.reject)
		layout.addWidget(self.buttons,100,0,1,2)
		self.setLayout(layout)
	def getMarker(self):
		return self.marker.currentText()
 
	@staticmethod
	def run(markers,parent = None):
		dialog				= ChooseMarkerDialog(markers)
		result				= dialog.exec_()
		marker				= dialog.getMarker()
		return (marker,result == QDialog.Accepted)
Example #18
0
class AddFilterDlg(QDialog):
	
	def __init__(self, parent=None):
		super(AddFilterDlg, self).__init__(parent)
		self.setWindowTitle("Advanced Filtering Options")
		
		note_label = QLabel("NOTE: These filtering options apply exclusively to relief devices, not to the relief device area they belong to or to their scenarios.")
		pressure_label = QLabel("Filter where <b>Set Pressure</b> is")
		self.pressure_combobox = QComboBox()
		self.pressure_combobox.addItems(["Greater Than", "Less Than", "Equal To", "Not Equal To"])
		self.pressure_value = QDoubleSpinBox()
		pressure_layout = QHBoxLayout()
		pressure_layout.addWidget(pressure_label)
		pressure_layout.addWidget(self.pressure_combobox)
		pressure_layout.addWidget(self.pressure_value)
		button_box = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
		
		layout = QGridLayout()
		layout.addWidget(note_label, 0, 0)
		layout.addLayout(pressure_layout, 1, 0)
		layout.addWidget(button_box, 2, 0)
		self.setLayout(layout)
		
		button_box.accepted.connect(self.accept)
		button_box.rejected.connect(self.reject)
		
	def returnVals(self):
		return (self.pressure_combobox.currentText(), self.pressure_value.value())
Example #19
0
class _OptionsSelector(QDialog):

    def __init__(self, list_options, parent=None):
        QDialog.__init__(self, parent)

        # Variables
        model = _AvailableOptionsListModel()
        for options in list_options:
            model.addOptions(options)

        # Widgets
        lbltext = QLabel('Select the options to import')

        self._combobox = QComboBox()
        self._combobox.setModel(model)

        buttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)

        # Layouts
        layout = QVBoxLayout()
        layout.addWidget(lbltext)
        layout.addWidget(self._combobox)
        layout.addWidget(buttons)
        self.setLayout(layout)

        # Signals
        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)

    def options(self):
        return self._combobox.model().options(self._combobox.currentIndex())
Example #20
0
class FinishWrangleItemsDialog(QDialog):
    def __init__(self, parent=None):
        super(FinishWrangleItemsDialog, self).__init__(parent)

        layout = QFormLayout(self)

        self.status_selector = QComboBox()
        status_list = ["abort", "done", "publish", "cancel"]
        for status in status_list:
            self.status_selector.addItem(str(status))

        layout.addRow("Finished Status:", self.status_selector)

        # OK and Cancel buttons
        self.buttons = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self)
        layout.addWidget(self.buttons)

        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)

        self.setWindowTitle("Select Finished Status")
        self.resize(250, 100)

    # get current status from the dialog
    def status(self):
        return self.status_selector.currentText()

    # static method to create the dialog and return (date, time, accepted)
    @staticmethod
    def getStatus(parent=None):
        dialog = FinishWrangleItemsDialog(parent)
        result = dialog.exec_()
        status = dialog.status()
        return (status, result == QDialog.Accepted)
Example #21
0
    def setup_toolbar(self):
        color_widget = ColorWidget()
        color_widget.color_changed.connect(self.fourier.on_color_change)
        self.toolBar.addWidget(QLabel("Color:"))
        self.toolBar.addWidget(color_widget)

        self.toolBar.addWidget(QLabel("Shape:"))
        size_spin = QSpinBox(self.toolBar)
        size_spin.setValue(20)
        size_spin.valueChanged[int].connect(self.fourier.on_size_change)

        shape_combo = QComboBox(self.toolBar)
        shape_combo.activated[str].connect(self.fourier.on_shape_change)
        shape_combo.addItems(brush_shapes)

        self.toolBar.addWidget(shape_combo)
        self.toolBar.addWidget(size_spin)

        self.toolBar.addWidget(QLabel("Symmetry:"))
        x_sym = QCheckBox(self.toolBar)
        x_sym.toggled.connect(self.fourier.on_x_toggle)

        opp_sym = QCheckBox(self.toolBar)
        opp_sym.toggled.connect(self.fourier.on_opp_toggle)
        self.toolBar.addWidget(QLabel("X"))
        self.toolBar.addWidget(x_sym)

        y_sym = QCheckBox(self.toolBar)
        y_sym.toggled.connect(self.fourier.on_y_toggle)
        self.toolBar.addWidget(QLabel("Y"))
        self.toolBar.addWidget(y_sym)
        self.toolBar.addWidget(QLabel("Center"))
        self.toolBar.addWidget(opp_sym)
Example #22
0
    def create_combobox(self, parent, editable=False):
        """ Returns an adapted QComboBox control.
        """
        control = QComboBox(check_parent(parent))
        control.setEditable(editable)

        return control_adapter(control)
Example #23
0
    def initialize(self, words):
        self.removeComboBox = QComboBox()
        self.removeComboBox.addItems(words)
        self.tooltips.append((self.removeComboBox, """\
<p><b>Spelling Words combobox</b></p>
<p>This index's list of words that have been remembered as correctly
spelled or to be ignored even though they aren't in the dictionary for
the index's language.</p>"""))
        self.helpButton = QPushButton(QIcon(":/help.svg"), "Help")
        self.tooltips.append((self.helpButton,
                              "Help on the Forget Spelling Words dialog"))
        self.removeButton = QPushButton(QIcon(":/spelling-remove.svg"),
                                        "&Forget")
        self.tooltips.append((self.removeButton, """\
<p><b>Forget</b></p>
<p>Permanently forget the selected word from the index's spelling words
list. Afterwards, if this word appears in any entry, it will be
highlighted as misspelled.</p>"""))
        closeButton = QPushButton(QIcon(":/dialog-close.svg"),
                                  "&Close")
        self.tooltips.append((closeButton, """<p><b>Close</b></p>
<p>Close the dialog.</p>"""))
        self.buttonBox = QDialogButtonBox()
        self.buttonBox.addButton(closeButton, QDialogButtonBox.RejectRole)
        self.buttonBox.addButton(
            self.removeButton, QDialogButtonBox.ApplyRole)
        self.buttonBox.addButton(self.helpButton, QDialogButtonBox.HelpRole)
        layout = QFormLayout()
        layout.addRow("F&orget", self.removeComboBox)
        layout.addRow(self.buttonBox)
        self.setLayout(layout)
        self.helpButton.clicked.connect(self.help)
        self.removeButton.clicked.connect(self.remove)
        self.buttonBox.rejected.connect(self.reject)
Example #24
0
 def load_rows(self, *args):
     """
     :param args:item code
     :return:Loads the rows from the database
     """
     table = self.dialogue.menudialogue_menuIngredients_table
     if args:
         table.clearContents()
         table.setRowCount(0)
         if args[0] != 0:
             table.setRowCount(len(args))
             for i, j in enumerate(args):
                 item = QTableWidgetItem(j['code'])
                 table.setItem(i, 0, item)
                 item = QTableWidgetItem(j['item'])
                 table.setItem(i, 1, item)
                 item = QTableWidgetItem(j['category'])
                 table.setItem(i, 2, item)
                 combo = QComboBox()
                 self.fillunits(combo)
                 index = combo.findText(j['units'])
                 combo.setCurrentIndex(index)
                 table.setCellWidget(i, 3, combo)
                 quantity = QLineEdit(j['quantity'])
                 table.setCellWidget(i, 4, quantity)
     else:
         ###arranges the width each time we call this method
         table.setColumnWidth(1, table.width() / 5)
         table.setColumnWidth(2, table.width() / 5)
         table.setColumnWidth(3, table.width() / 5)
Example #25
0
 def createEditor(self, row, column, item, view):
   """
     Creates the ComboBox for setting the Status
   """
   cb = QComboBox()
   for key in gStatusTags.keys():
     cb.addItem(QIcon(gStatusTags[key]), key)
   return cb
Example #26
0
 def createEditor(self, row, column, item, view):
     """
   Creates the ComboBox for setting the Status
 """
     cb = QComboBox()
     for key in gStatusTags.keys():
         cb.addItem(QIcon(gStatusTags[key]), key)
     return cb
Example #27
0
    def createWidgets(self):
        settings = QSettings()

        self.txtGroupBox = QGroupBox("Plain Text Format (.txt)")
        self.indentLabel = QLabel("&Indent")
        self.indentComboBox = QComboBox()
        self.indentLabel.setBuddy(self.indentComboBox)
        oldIndent = IndentKind.TAB
        oldIndent = self.config.get(Gconf.Key.Indent, oldIndent)
        index = -1
        for i, indent in enumerate(IndentKind):
            text = indent.name.replace("_", " ").title()
            self.indentComboBox.addItem(text, indent.value)
            if indent is oldIndent:
                index = i
        self.indentComboBox.setCurrentIndex(index)
        self.form.tooltips.append((self.indentComboBox, """\
<p><b>Indent</b></p>
<p>The indentation to use when outputting an indented-style index in
plain text format for each level of indentation.</p>"""))

        self.rtfGroupBox = QGroupBox("Rich Text Format (.rtf)")
        self.rtfIndentLabel = QLabel("I&ndent")
        self.rtfIndentComboBox = QComboBox()
        self.rtfIndentLabel.setBuddy(self.rtfIndentComboBox)
        oldIndent = IndentKind(int(settings.value(Gopt.Key.IndentRTF,
                                                  Gopt.Default.IndentRTF)))
        index = -1
        for i, indent in enumerate(IndentKind):
            text = ("Indent" if i == 0 else
                    indent.name.replace("_", " ").title())
            self.rtfIndentComboBox.addItem(text, indent.value)
            if indent is oldIndent:
                index = i
        self.rtfIndentComboBox.setCurrentIndex(index)
        self.form.tooltips.append((self.rtfIndentComboBox, """\
<p><b>Indent</b></p>
<p>The indentation to use when outputting an indented-style index in
rich text format for each level of indentation.</p>"""))

        self.pdfGroupBox = QGroupBox("Portable Document Format (.pdf)")
        self.paperSizeLabel = QLabel("Paper Size")
        self.letterRadioButton = QRadioButton("&Letter")
        self.a4RadioButton = QRadioButton("&A4")
        size = PaperSizeKind(int(settings.value(Gopt.Key.PaperSize,
                                                Gopt.Default.PaperSize)))
        if size is PaperSizeKind.LETTER:
            self.letterRadioButton.setChecked(True)
        else:
            self.a4RadioButton.setChecked(True)
        self.form.tooltips.append((self.letterRadioButton, """\
<p><b>Paper Size, Letter</b></p>
<p>If checked, when outputting a PDF of the index, US Letter
8.5"x11"-sized pages will be used.</p>"""))
        self.form.tooltips.append((self.a4RadioButton, """\
<p><b>Paper Size, A4</b></p>
<p>If checked, when outputting a PDF of the index, European A4-sized
pages will be used.</p>"""))
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.__parent = parent
        self.setWindowTitle("Calculate Salary")

        t = datetime.now()
        self.month = QComboBox()
        self.month.addItems([
            "JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE", "JULY",
            "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER"
        ])
        self.month.setCurrentIndex(t.month - 1)
        self.year = QSpinBox()
        self.year.setRange(1900, 3000)
        self.year.setValue(t.year)

        self.name = SearchBox(self)
        self.name.setPlaceholderText("Enter Name")

        self.name.returnPressed.connect(self.setIDList)
        self.nameList = []
        self.nameList = DatabaseManager.db.getEmployeeNameList()
        self.name.setList(self.nameList)
        self.name.setCurrentIndex(-1)

        self.id = QComboBox()
        self.id.currentIndexChanged.connect(
            lambda: self.loadInfo(self.id.currentText()))

        self.designation = QLineEdit()
        self.designation.setReadOnly(True)
        self.originalPay = QLineEdit()
        self.originalPay.setReadOnly(True)
        self.originalPayGrade = QLineEdit()
        self.originalPayGrade.setReadOnly(True)
        self.DOJ = QLineEdit()
        self.DOJ.setReadOnly(True)
        self.pan = QLineEdit()
        self.pan.setReadOnly(True)

        self.presentPay = QLineEdit()
        self.presentPay.setReadOnly(True)
        self.da_percent = ValueBox()
        self.hra_percent = ValueBox()
        self.ta_percent = ValueBox()
        self.it_percent = ValueBox()
        self.pt_percent = ValueBox()

        self.name.editTextChanged.connect(self.clearInfo)

        self.bttnCalculate = QPushButton("Calculate")
        self.bttnCalculate.clicked.connect(self.calculate)
        self.bttnCancel = QPushButton("Back")
        self.bttnCancel.clicked.connect(self.goBack)
        self.bttnCalculate.setObjectName("OkButton")
        self.bttnCancel.setObjectName("CancelButton")

        self.setupUI()
class DelegateKeepsReferenceToEditor(QAbstractItemDelegate):
    def __init__(self, parent=None):
        QAbstractItemDelegate.__init__(self, parent)
        self.comboBox = QComboBox()
        self.comboBox.addItem(id_text)

    def createEditor(self, parent, option, index):
        self.comboBox.setParent(parent)
        return self.comboBox
Example #30
0
    def __init__(self, parent=None):
        QComboBox.__init__(self, parent)

        self._factors = {}
        for scale, factor in self._FACTORS:
            self.addItem(scale)
            self._factors[scale] = factor

        self.setScale("s")
class DelegateKeepsReferenceToEditor(QAbstractItemDelegate):
    def __init__(self, parent=None):
        QAbstractItemDelegate.__init__(self, parent)
        self.comboBox = QComboBox()
        self.comboBox.addItem(id_text)

    def createEditor(self, parent, option, index):
        self.comboBox.setParent(parent)
        return self.comboBox
Example #32
0
 def add_messages(self, *args):
     """
     Populates the Schedules when we load the tab
     """
     table = self.notification_schedule_table
     if args:
         if args[0] != 'new':
             table.clearContents()
             table.setRowCount(0)
             table.setRowCount(len(args))
             for i, j in enumerate(args):
                 item = QTableWidgetItem(j['msg_id'])
                 table.setItem(i, 0, item)
                 item = QTableWidgetItem(j['date'])
                 table.setItem(i, 1, item)
                 item = QTableWidgetItem(
                     'Name:{}\nDesignation:{}\nAddress:{}'.format(
                         j['name'], j['designation'], j['address']))
                 table.setItem(i, 2, item)
                 item = QTableWidgetItem(
                     'Message Type:{}\nMessage:{}'.format(
                         j['msg_type'].title(), j['msg_body']))
                 table.setItem(i, 3, item)
                 states = QComboBox()
                 self.populate_states(states, j['msg_state'].title())
                 states.currentIndexChanged.connect(
                     lambda index, row=i: self.changed_state(row, index))
                 table.setCellWidget(i, 4, states)
         elif args[0] == 'new':
             initial = table.rowCount()
             row = table.rowCount() + len(args[1])
             table.setRowCount(row)
             forward_range = range(initial, row)
             for i, j in zip(forward_range, args[1]):
                 item = QTableWidgetItem(j['msg_id'])
                 table.setItem(i, 0, item)
                 item = QTableWidgetItem(j['date'])
                 table.setItem(i, 1, item)
                 item = QTableWidgetItem(
                     'Name:{}\nDesignation:{}\nAddress:{}'.format(
                         j['name'], j['designation'], j['address']))
                 table.setItem(i, 2, item)
                 item = QTableWidgetItem(
                     'Message Type:{}\nMessage:{}'.format(
                         j['msg_type'].title(), j['msg_body']))
                 table.setItem(i, 3, item)
                 states = QComboBox()
                 self.populate_states(states, j['msg_state'].title())
                 states.currentIndexChanged.connect(
                     lambda index, row=i: self.changed_state(row, index))
                 table.setCellWidget(i, 4, states)
     table.setColumnWidth(0, (table.width() * 0.5) / 5)
     table.setColumnWidth(1, (table.width() * 0.5) / 5)
     table.setColumnWidth(2, table.width() / 5)
     table.setColumnWidth(3, (table.width() * 2) / 5)
     self.notification_schedule_table.resizeRowsToContents()
Example #33
0
    def createWidgets(self):
        self.fontLabel = QLabel("Fon&t:")
        self.fontComboBox = QFontComboBox()
        self.tooltips.append((self.fontComboBox, """\
<p><b>Font</b></p>
<p>The font for displaying the characters.</p>"""))
        self.fontLabel.setBuddy(self.fontComboBox)
        self.sizeLabel = QLabel("&Size:")
        self.sizeComboBox = QComboBox()
        self.tooltips.append((self.sizeComboBox, """\
<p><b>Size</b></p>
<p>The size of font for displaying the characters.</p>"""))
        self.sizeLabel.setBuddy(self.sizeComboBox)
        self.scrollArea = QScrollArea()
        self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.panel = Panel()
        self.scrollArea.setWidget(self.panel)
        self.copyTextLabel = QLabel("Copy T&ext")
        self.copyTextLineEdit = QLineEdit()
        self.tooltips.append((self.copyTextLineEdit, """\
<p><b>Copy Text editor</b></p>
<p>The text for copying to the clipboard when <b>Copy</b> is
pressed.</p>"""))
        self.copyTextLabel.setBuddy(self.copyTextLineEdit)
        self.findTextLabel = QLabel("&Find Text")
        self.findTextLineEdit = QLineEdit()
        self.tooltips.append((self.findTextLineEdit, """\
<p><b>Find Text editor</b></p>
<p>The name or partial name of Unicode characters to be found, e.g.,
“star” will match many characters, including U+22C6 “Star
operator”.</p>"""))
        self.findTextLabel.setBuddy(self.findTextLineEdit)
        self.buttonBox = QDialogButtonBox()
        self.addSelectedButton = QPushButton(QIcon(":/add.svg"),
                                             "&Add Selected")
        self.tooltips.append((self.addSelectedButton, """\
<p><b>Add Selected</b></p>
<p>Append the selected character to the <b>Copy Text</b> editor.</p>"""))
        self.buttonBox.addButton(self.addSelectedButton,
                                 QDialogButtonBox.ActionRole)
        self.findNextButton = QPushButton(QIcon(":/edit-find.svg"),
                                          "Find &Next")
        self.tooltips.append((self.findNextButton, """\
<p><b>Find Next</b></p>
<p>Find the next character whose Unicode name contains or equals the
<b>Find Text</b>.</p>"""))
        self.buttonBox.addButton(self.findNextButton,
                                 QDialogButtonBox.ActionRole)
        self.helpButton = QPushButton(QIcon(":/help.svg"), "Help")
        self.tooltips.append(
            (self.helpButton, "Help on the Copy Character dialog"))
        self.buttonBox.addButton(self.helpButton, QDialogButtonBox.HelpRole)
        self.closeButton = QPushButton(QIcon(":/dialog-close.svg"), "&Close")
        self.tooltips.append((self.closeButton, """<p><b>Cancel</b></p>
<p>Close the dialog.</p>"""))
        self.buttonBox.addButton(self.closeButton, QDialogButtonBox.RejectRole)
 def addFilter(self):
     """ Add Filter Label and Combo Box to the UI """
     label = QLabel("Filter: ", self.toolbar)
     self.toolbar.addWidget(label)
     comboBox = QComboBox(self.toolbar)
     comboBox.addItems(__filter_order__)
     comboBox.activated.connect(self.setTransactionFilter)
     index = [__transaction_filters__[filterText] for filterText in __filter_order__].index(self.table_view.filters)
     comboBox.setCurrentIndex(index)
     self.toolbar.addWidget(comboBox)
Example #35
0
 def createEditor(self, parent, option, index):
     current_column = GridManagerColumns.Columns[index.column()]
     # Using a combobox to the planes.
     if( current_column == GridManagerColumns.Plane ):
         combo_plane = QComboBox( parent )
         combo_plane.addItems( GridPlanes.Planes )
         return combo_plane
     else:
         # The rest of the controls are fine with the standard control
         return super(VoxelGridDelegate,self).createEditor(parent, option, index)
Example #36
0
    def __init__(self, fixtures_folder, parent=None):
        QWidget.__init__(self, parent)
        self.current_fixture = None
        self.fixtures_folder = fixtures_folder
        self.setWindowTitle("Frangitron DMX program editor")

        self.text = QPlainTextEdit()
        font = QFont("Monospace")
        font.setStyleHint(QFont.TypeWriter)
        font.setPixelSize(16)
        self.text.setFont(font)
        self.text.setStyleSheet(
            "color: white; background-color: rgb(30, 30, 30)")

        self.combo_fixture = QComboBox()

        self.frame_programs = QWidget()
        self.checkboxes_programs = list()
        self.layout_programs = QGridLayout(self.frame_programs)

        self.spinner_offset = QSpinBox()
        self.spinner_offset.setMinimum(1)
        self.spinner_offset.setMaximum(512)
        self.spinner_offset.setValue(1)
        self.spinner_offset.valueChanged.connect(self.address_changed)

        self.doc = QPlainTextEdit()
        self.doc.setReadOnly(True)
        self.doc.setFont(font)

        self.status = QLabel()

        layout = QGridLayout(self)
        layout.addWidget(self.combo_fixture, 0, 1)
        layout.addWidget(self.spinner_offset, 0, 2)
        layout.addWidget(self.frame_programs, 1, 1)
        layout.addWidget(self.text, 0, 0, 3, 1)
        layout.addWidget(self.doc, 2, 1, 1, 2)
        layout.addWidget(self.status, 3, 0, 1, 3)
        layout.setColumnStretch(0, 60)
        layout.setColumnStretch(1, 40)

        self.resize(1280, 800)

        self.streamer = Streamer(self.fixtures_folder)

        self.combo_fixture.addItems(sorted(self.streamer.fixtures))
        self.combo_fixture.currentIndexChanged.connect(self.fixture_changed)

        self.timer = QTimer()
        self.timer.timeout.connect(self.tick)
        self.timer.start(500.0 / FRAMERATE)
        self.should_reload = True

        self.fixture_changed()
Example #37
0
 def Lists(self, glo):
     ips = self.get_ips()
     self.sl = QComboBox()
     self.sl.addItems(ips)
     self.sl.setToolTip(self.getTrans('7'))
     self.sl2 = QComboBox()
     self.get_ports()
     self.sl2.setToolTip('8')
     self.sl.currentIndexChanged.connect(self.get_ports)
     glo.addWidget(self.sl)
     glo.addWidget(self.sl2)
Example #38
0
 def Lists(self, glo):
     ips = self.get_ips()
     self.sl = QComboBox()
     self.sl.addItems(ips)
     self.sl.setToolTip(
         'Select network interface with ip, so the server runs on it')
     self.sl2 = QComboBox()
     self.get_ports()
     self.sl2.setToolTip('Select a port, so server runs through it')
     self.sl.currentIndexChanged.connect(self.get_ports)
     glo.addWidget(self.sl)
     glo.addWidget(self.sl2)
Example #39
0
    def __init__(self):
        '''
        Constructor
        '''
        super(LoginDialog, self).__init__()
        formLayout = QFormLayout()
        
        self.input1 = QLineEdit()
        self.input2 = QLineEdit()
        self.input2.setEchoMode(QLineEdit.EchoMode.Password)

        self.input3 = QLineEdit()
        self.input3.setEchoMode(QLineEdit.EchoMode.Password)    
        
        self.cb = QComboBox()
        self.cb.addItems(["Sef stanice", "Radnik u centrali", "Radnik na naplatnom mestu", "Admin"])
        
        palete = QPalette()
        palete.setColor(self.backgroundRole(), Qt.black)
        self.setPalette(palete)
        self.setWindowTitle("Login")
        self.resize(370, 100)
        
        label2 = QLabel("<font color='White'>Username</font>")
        label3 = QLabel("<font color='White'>Password</font>")
        label4 = QLabel("<font color='White'>Registration key</font>")
        label5 = QLabel("<font color='White'>Role</font>")
        
        formLayout.addRow(label2, self.input1)
        formLayout.addRow(label3, self.input2)
    
        
        btnOK = QPushButton("Login")
        btnOK.clicked.connect(self.loginAction)
        btnCancel = QPushButton("Cancel")
        btnCancel.clicked.connect(self.reject)
        btnRegister = QPushButton("Register")
        btnRegister.clicked.connect(self.registerAction)
        
        
        group = QDialogButtonBox()
        group.addButton(btnOK, QDialogButtonBox.AcceptRole)
        group.addButton(btnCancel, QDialogButtonBox.RejectRole)
        
        
        formLayout.addRow(group)
        formLayout.addRow(label4, self.input3)
        formLayout.addRow(label5, self.cb)
        formLayout.addWidget(btnRegister)
        
        self.result = None
        self.setLayout(formLayout)
    def _addComboBox(self, row, col, items, currentItem=None):
        comb = QComboBox()
        for it in items:
            comb.addItem(it)
        self.table.setCellWidget(row, col, comb)

        if currentItem is not None:
            if currentItem in items:
                comb.setCurrentIndex(items.index(currentItem))
            else:
                print('invalid item: {}'.format(currentItem))

        return comb
Example #41
0
class AbstractContext(QWidget):
    def __init__(self, parent, labels):
        super(AbstractContext, self).__init__(parent)

        self.add = QAction(QIcon(":/img/add.png"), self.tr("Add"), self)

        self.delete = QAction(QIcon(":/img/delete.png"),
                              self.tr("Delete"),
                              self)

        self.edit = QAction(QIcon(":/img/edit.png"), self.tr("Edit"), self)

        self.print_ = QAction(QIcon(":/img/print.png"), self.tr("Print"), self)

        self.toolbar = QToolBar(self.tr("Controls"), self)

        self.toolbar.addAction(self.add)
        self.toolbar.addAction(self.delete)
        self.toolbar.addAction(self.edit)
        self.toolbar.addAction(self.print_)

        self.entries = QTreeWidget(self)
        self.entries.setHeaderLabels(labels)

        self.search = QLineEdit(self)

        self.search_by = QComboBox(self)
        self.search_by.insertItems(len(labels), labels)

        layout = QGridLayout(self)

        layout.addWidget(self.toolbar,                         0, 0)
        layout.addWidget(self.entries,                         1, 0, 1, 8)
        layout.addWidget(QLabel(self.tr("Search for:"), self), 2, 0)
        layout.addWidget(self.search,                          2, 1)
        layout.addWidget(QLabel(self.tr("by"), self),          2, 2)
        layout.addWidget(self.search_by,                       2, 3)

    def add_entry(self, entry):
        pass

    def delete_entry(self, entry):
        index = self.entries.indexOfTopLevelItem(entry)
        self.entries.takeTopLevelItem(index)

    def edit_entry(self, entry, new_data):
        for column, data in new_data:
            entry.setText(column, data)

    def confirm_deletion(self, what):
        return True
Example #42
0
	def newCombo(self):
		taskList  = [u'--請選擇--', u'值班', u'救護勤務', u'備勤', u'待命服勤', u'水源查察', u'消防查察', u'宣導勤務', u'訓(演)練', u'專案勤務', u'南山救護站']
		nComboBox = QComboBox()
		nComboBox.addItems(taskList)
		for i in xrange(len(taskList)):
			if i == 0:
				nComboBox.setItemData(i, QColor('#550000'), Qt.BackgroundColorRole)
			nComboBox.setItemData(i, Qt.AlignCenter, Qt.TextAlignmentRole)
		nComboBox.setStyleSheet("text-align: right; font: bold 13px;")		
		return nComboBox
Example #43
0
class ExportDialog(QDialog):
  """Allows the choice of format and browsing to a save location
     Call data() after exec_()"""
  
  def __init__(self, parent=None):
    super(ExportDialog, self).__init__(parent)
    self._output_folder = None
    self.setModal(True)
    layout_main = QGridLayout()
    label_choose_format = QLabel(self.tr("Choose format"))
    self.combo_choose_format = QComboBox()
    self.combo_choose_format.setModel(QStringListModel(FileExporter.FORMATS_AVAILABLE))
    label_saveto = QLabel(self.tr("Save location"))
    button_saveto = QPushButton(self.tr("Browse ..."))
    button_saveto.clicked.connect(self._openFolderChoiceDialog)
    self.label_output = QLabel()
    button_export = QPushButton(self.tr("Export"))
    button_export.clicked.connect(self.accept)
    button_cancel = QPushButton(self.tr("Cancel"))
    button_cancel.clicked.connect(self.reject)
    row = 0; col = 0;
    layout_main.addWidget(label_choose_format, row, col, 1, 2)
    col += 2
    layout_main.addWidget(self.combo_choose_format, row, col, 1, 2)
    row += 1; col -= 2;
    layout_main.addWidget(label_saveto, row, col, 1, 2)
    col += 2
    layout_main.addWidget(button_saveto, row, col, 1, 2)
    row += 1; col -= 2;
    layout_main.addWidget(self.label_output, row, col, 1, 4)
    row += 1; col += 2
    layout_main.addWidget(button_export, row, col)
    col += 1
    layout_main.addWidget(button_cancel, row, col)
    self.setWindowTitle(self.tr("Export Parameters"))
    self.setLayout(layout_main)
    
  def data(self):
    if self._output_folder is None: return None
    else:
      return ExportInfo(self.combo_choose_format.currentText(), self._output_folder)
  
  def _openFolderChoiceDialog(self):
    folder = QFileDialog.getExistingDirectory(self, caption=self.tr("Choose output directory"))
    if not folder:
      self.label_output.setText("<font style='color:red;'>" + self.tr("Please choose an output folder") 
                                + "</font>")
    else: 
      self.label_output.setText(folder)
      self._output_folder = folder
Example #44
0
	def __init__(self,fileName,experimentName,guess):
		self.fileName		= QLabel(fileName)
		self.plateID		= QLineEdit()
		self.experiment		= QLineEdit()
		self.guess			= QLabel(guess[0] + ', ' + guess[1])
		self.robot			= QComboBox()
		self.platePosition	= QComboBox()
		
		self.plateID.setText(path.splitext(path.basename(fileName))[0])
		self.experiment.setText(experimentName)
		self.robot.addItems(['2000','FX','96'])
		self.robot.setCurrentIndex(self.robot.findText(guess[0]))
		self.platePosition.addItems(['Plate 0','Plate 1','Plate 2','Plate 3','Plate 4'])
		self.platePosition.setCurrentIndex(self.platePosition.findText(guess[1]))
Example #45
0
class AddDeviceDlg(QDialog):

	def __init__(self, root_node, parent=None):
		super(AddDeviceDlg, self).__init__(parent)
		self.setWindowTitle("Add Relief Device")

		id_label = QLabel("&Relief Device ID:")
		self.id_lineedit = QLineEdit()
		self.id_lineedit.setMaxLength(200)
		id_label.setBuddy(self.id_lineedit)
		area_label = QLabel("Associated Relief Device &Area:")
		self.area_combobox = QComboBox()
		for area in root_node.children:
			self.area_combobox.addItem(area.name, area)
		area_label.setBuddy(self.area_combobox)
		color_label = QLabel("&Text Color:")
		self.color_combobox = QComboBox()
		for key in sorted(COLORS.keys()):
			pixmap = QPixmap(26, 26)
			pixmap.fill(COLORS[key])
			self.color_combobox.addItem(QIcon(pixmap), key)
		color_label.setBuddy(self.color_combobox)
		button_box = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
			
		layout = QGridLayout()
		layout.addWidget(id_label, 0, 0)
		layout.addWidget(self.id_lineedit, 0, 1)
		layout.addWidget(area_label, 1, 0)
		layout.addWidget(self.area_combobox, 1, 1)
		layout.addWidget(color_label, 2, 0)
		layout.addWidget(self.color_combobox, 2, 1)
		layout.addWidget(button_box, 3, 1)
		self.setLayout(layout)
		
		button_box.accepted.connect(self.accept)
		button_box.rejected.connect(self.reject)
		
	def accept(self):
		if len(self.id_lineedit.text().strip()) == 0:
			QMessageBox.warning(self, "Error: Relief Device ID Blank", "The relief device must be given an ID.", QMessageBox.Ok)
			self.id_lineedit.setFocus()
			return
		selected_area = self.area_combobox.itemData(self.area_combobox.currentIndex())
		for device in selected_area.children:
			if device.name == self.id_lineedit.text():
				QMessageBox.warning(self, "Error: Relief Device ID Already Exists", 
				"Cannot add relief device because that relief device ID already exists. Please create a new relief device ID.", QMessageBox.Ok)
				self.id_lineedit.setFocus()
				self.id_lineedit.setSelection(0, self.id_lineedit.maxLength())
				return
		QDialog.accept(self)
		
	def returnVals(self):
		return (self.id_lineedit.text(), self.area_combobox.itemData(self.area_combobox.currentIndex()),
		COLORS[self.color_combobox.currentText()])
Example #46
0
class SearchFile(QWidget):
    def __init__(self):
        '''
            Creates GUI
        '''
        QWidget.__init__(self)
        self.setWindowTitle("Search window")
        self.fn1 = ""
        self.fn2 = ""
        L1 = []
        L2 = []
        st = os.getcwd()
        L = os.listdir(st)
        for filenames in L:
            if (".txt" in filenames):
                L1.append(filenames)
            if (".csv" in filenames):
                L2.append(filenames)
        self.files1 = QComboBox()
        self.files2 = QComboBox()
        #self.files1.setText("SatelliteDataFile")
        #print(self.files1)
        #print(self.files2)
        self.files1.addItems(L1)
        self.files1.setCurrentIndex(-1)
        self.files2 = QComboBox()
        self.files2.addItems(L2)
        self.files2.setCurrentIndex(-1)
        self.files1.currentIndexChanged.connect(
            lambda: self.returnString(self.files1))

        self.files2.currentIndexChanged.connect(
            lambda: self.returnString(self.files2))
        self.setUpUI()

    def setUpUI(self):
        layout = QVBoxLayout()
        form = QFormLayout()
        form.addRow(QLabel("text file"), self.files1)
        form.addRow(QLabel(".csv file"), self.files2)
        layout.addLayout(form)
        self.setLayout(layout)

    def returnString(self, files):
        #print(files)
        if (files == self.files1):
            self.fn1 = str(self.files1.currentText())
        else:
            self.fn2 = str(self.files2.currentText())
class DateToolbarSection:
    """ Represents the Date Toolbar Section """
    
    def __init__(self, toolbar, panel):
        """ Initialize the Date Toolbar Section """
        self.toolbar = toolbar
        self.panel = panel
        
    def addDateSection(self):
        """ Add Date Section """
        self.dateLabel = QLabel("Month: ", self.toolbar)
        self.toolbar.addWidget(self.dateLabel)
        self.setupMonthComboBox()
        self.setupYearComboBox()
        
    def setupMonthComboBox(self):
        """ Setup the month combo box """
        self.monthComboBox = QComboBox(self.toolbar)
        self.monthComboBox.addItems(["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"])
        self.monthComboBox.activated.connect(self.setMonth)
        self.monthComboBox.setCurrentIndex(self.getCategoryStatistics().month-1)
        self.toolbar.addWidget(self.monthComboBox)
        
    def setupYearComboBox(self):
        """ Setup the year combo box """
        self.yearComboBox = QComboBox(self.toolbar)
        self.getTransactionYears()
        self.yearComboBox.addItems([str(year) for year in self.transactionYears])
        self.yearComboBox.activated.connect(self.setYear)
        self.yearComboBox.setCurrentIndex(self.transactionYears.index(self.getCategoryStatistics().year))
        self.toolbar.addWidget(self.yearComboBox)
    
    def getTransactionYears(self):
        """ Get the possible transacttion years """
        self.transactionYearsSet = Transactions.getAllYears()
        self.transactionYearsSet.add(self.getCategoryStatistics().year)
        self.transactionYears = list(self.transactionYearsSet)
        self.transactionYears.sort()
    
    def setMonth(self, index):
        """ Set the month """
        categoryStatistics = self.getCategoryStatistics()
        categoryStatistics.month = index+1
        self.panel.updatePanel()
    
    def setYear(self, index):
        """ Set the year """
        categoryStatistics = self.getCategoryStatistics()
        categoryStatistics.year = int(self.yearComboBox.currentText())
        self.panel.updatePanel()
        
    def getCategoryStatistics(self):
        """ Returns the Category Statistics """
        return self.panel.categoryStatistics
class CreateSamplesRow():
	def __init__(self):
		self.plate			= QLineEdit()
		self.parents		= QSpinBox()
		self.samples		= QSpinBox()
		self.loadedBy		= QComboBox()
		self.parents.setMaximum(8)
		self.parents.setValue(2)
		self.samples.setMaximum(96)
		self.samples.setValue(94)
		self.loadedBy.addItems(['Column','Row'])
	def getPlate(self):			return self.plate.text()
	def getParents(self):		return self.parents.value()
	def getSamples(self):		return self.samples.value()
	def getLoadedBy(self):		return self.loadedBy.currentText()
Example #49
0
 def langsList(self, glo):
     self.langs = {
         # languages to be displayed in select
         'en': 'English',
         'ar': 'Arabic',
         'fr': 'French',
         'it': 'Italian',
         'es': 'Spanish'
     }
     self.langs_list = QComboBox()
     self.langs_list.addItems(list(self.langs.values()))
     self.langs_list.setCurrentIndex(1)
     self.langs_list.setToolTip(self.getTrans('1'))
     self.langs_list.currentIndexChanged.connect(self.langChange)
     glo.addWidget(self.langs_list)
Example #50
0
class ExportPdfOptionDialog(QDialog):
    """
    Displays options UI for the PDF
    """

    def __init__(self, parent=None):
        if not parent:
            parent = hiero.ui.mainWindow()
        super(ExportPdfOptionDialog, self).__init__(parent)

        layout = QFormLayout()
        self._fileNameField = FnFilenameField(False, isSaveFile=False, caption="Set PDF name", filter="*.pdf")
        self._fileNameField.setFilename(os.path.join(os.getenv("HOME"), "Desktop", "Sequence.pdf"))
        self._optionDropdown = QComboBox()
        self._buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        self._buttonbox.button(QDialogButtonBox.Ok).setText("Export")
        self._buttonbox.accepted.connect(self.accept)
        self._buttonbox.rejected.connect(self.reject)

        self._pdfActionSettings = {"1 Shot per page": [1, 1], "4 Shots per page)": [2, 2], "9 Shots per page)": [3, 3]}

        for pdfMode in sorted(self._pdfActionSettings, reverse=True):
            self._optionDropdown.addItem(pdfMode)

        layout.addRow("Save to:", self._fileNameField)
        layout.addRow("PDF Layout:", self._optionDropdown)
        layout.addRow("", self._buttonbox)

        self.setLayout(layout)
        self.setWindowTitle("Export PDF Options")
        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)

    def numRows(self):
        """Returns the number of rows for the pdf"""
        optionText = self._optionDropdown.currentText()
        return self._pdfActionSettings[optionText][0]

    def numColumns(self):
        """Returns the number of columns for the pdf"""
        optionText = self._optionDropdown.currentText()
        return self._pdfActionSettings[optionText][1]

    def filePath(self):
        """Returns the filepath for the pdf"""
        filename = self._fileNameField.filename()
        if not filename.endswith(".pdf"):
            filename = filename + ".pdf"
        return filename
Example #51
0
    def __setupToolbar(self):
        widgetSpacer = QWidget()
        widgetSpacer.setSizePolicy(
            QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred))

        self._comboSerial = QComboBox()
        self._comboSerial.addItems(self._comm.getPorts())
        self._comboSerial.setToolTip('Serial port')

        self.toolbar.addWidget(widgetSpacer)
        self.toolbar.addWidget(self._comboSerial)

        icon = QIcon(getResource('record.png'))
        self.actionRecord.setIcon(icon)
        icon = QIcon(getResource('clear.png'))
        self.actionClear.setIcon(icon)
Example #52
0
    def __init__(self, *args, **kwargs):
        super(ComboDialog, self).__init__(*args, **kwargs)

        self.combo_box = QComboBox()

        self.ok_btn = QPushButton("&Ok")
        # noinspection PyUnresolvedReferences
        self.ok_btn.clicked.connect(self.accept)
        self.ok_btn.setDefault(True)

        self.cancel_btn = QPushButton("&Cancel")
        # noinspection PyUnresolvedReferences
        self.cancel_btn.clicked.connect(self.reject)

        self.h_layout = QHBoxLayout()
        self.v_layout = QVBoxLayout()

        self.h_layout.addStretch(0)
        self.h_layout.addWidget(self.ok_btn)
        self.h_layout.addWidget(self.cancel_btn)

        self.v_layout.addWidget(self.combo_box)
        self.v_layout.addLayout(self.h_layout)
        self.setLayout(self.v_layout)

        # noinspection PyUnresolvedReferences
        self.accepted.connect(self.on_accept)
        # noinspection PyUnresolvedReferences
        self.rejected.connect(self.on_reject)
Example #53
0
	def __init__(self, parent=None):
		super(AddAreaDlg, self).__init__(parent)
		self.setWindowTitle("New Relief Device Area")
		
		name_label = QLabel("&Name:")
		self.name_lineedit = QLineEdit()
		self.name_lineedit.setMaxLength(200)
		name_label.setBuddy(self.name_lineedit)
		location_label = QLabel("&Location:")
		self.location_combobox = QComboBox()
		self.location_combobox.setEditable(True)
		location_label.setBuddy(self.location_combobox)
		self.browse_button = QPushButton("&Browse...")
		button_box = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
		
		layout = QGridLayout()
		layout.addWidget(name_label, 0, 0)
		layout.addWidget(self.name_lineedit, 0, 1)
		layout.addWidget(location_label, 1, 0)
		layout.addWidget(self.location_combobox, 1, 1)
		layout.addWidget(self.browse_button, 1, 2)
		#layout.addWidget(QFrame.HLine, 2, 0)
		layout.addWidget(button_box, 2, 1)
		self.setLayout(layout)
		
		self.browse_button.clicked.connect(self.browseFiles)
		button_box.accepted.connect(self.accept)
		button_box.rejected.connect(self.reject)
Example #54
0
    def __init__(self, p_flag=None):
        """
        User defined combobox, it's data is come from table lib_dictionary
        :param p_flag: 数据库中的标识符
        :return:
        """
        QComboBox.__init__(self)

        self.__empty = False
        self.__text = []
        self.__value = []

        if p_flag is not None:
            self.set_flag(p_flag)

        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
Example #55
0
 def _createWidgets(self):
     '''Create the widgets contained in this box'''
     # Peak number chooser
     self.numpeaks = [QRadioButton("2"),
                      QRadioButton("3"),
                      QRadioButton("4")]
     
     self.numpeaks[0].setToolTip(ttt('Model the exchange of 2 peaks'))
     self.numpeaks[1].setToolTip(ttt('Model the exchange of 3 peaks'))
     self.numpeaks[2].setToolTip(ttt('Model the exchange of 4 peaks'))
     # Make 4x4 matrix of QLabels
     self.exview = [[QLabel(self) for i in xrange(4)] for j in xrange(4)]
     for i in xrange(4):
         for e in self.exview[i]:
             e.setToolTip(ttt('The current exchange matrix'))
     # Enforce symmetry button
     self.symmetry = QCheckBox("Enforce Symmetry", self)
     self.symmetry.setToolTip(ttt('If symmetry is on then you only need to '
                                  'manually set the upper triangle of the '
                                  'exchange matrix.  Thse values are '
                                  'mirrored '
                                  'in the lower triangle and the diagonals '
                                  'are automatically set so that each row '
                                  'sums to 1. '
                                  'Otherwise you must set every element'))
     # Exchange picker
     self.exchooser = QComboBox(self)
     self.exchooser.setToolTip(ttt('Choose between which two peaks to set '
                               'the exchange (relative) rate'))
     # Exchange value
     self.exvalue = QLineEdit(self)
     self.exvalue.setToolTip(ttt('The exchange (relative) rate'))
     self.exvalue.setValidator(QDoubleValidator(0.0, 1.0, 3, self.exvalue))
Example #56
0
    def __init__(self, parent, title, sub_title):
        super(AbstractEntry, self).__init__(parent)

        self.setTitle(title)
        self.setSubTitle(sub_title)

        self.score = QComboBox(self)

        self.score.insertItems(5,
                               ["1 - Poor",
                                "2 - Fair",
                                "3 - Good",
                                "4 - Great",
                                "5 - Outstanding"])

        self.comments = QPlainTextEdit(self)
        self.comments.textChanged.connect(self.comments_changed)

        field = "%s.comments*" % title

        self.registerField(field,
                           self.comments,
                           "plainText",
                           SIGNAL("textChanged()"))

        layout = QGridLayout(self)

        layout.addWidget(QLabel(self.tr("Score:"), self),    0, 0)
        layout.addWidget(self.score,                         0, 1)
        layout.addWidget(QLabel(self.tr("Comments:"), self), 1, 0)
        layout.addWidget(self.comments,                      1, 1)
 def setupMonthComboBox(self):
     """ Setup the month combo box """
     self.monthComboBox = QComboBox(self.toolbar)
     self.monthComboBox.addItems(["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"])
     self.monthComboBox.activated.connect(self.setMonth)
     self.monthComboBox.setCurrentIndex(self.getCategoryStatistics().month-1)
     self.toolbar.addWidget(self.monthComboBox)
Example #58
0
    def createWidgets(self):
        self.helpButton = QToolButton()
        self.helpButton.setIcon(QIcon(":/help.svg"))
        self.helpButton.setFocusPolicy(Qt.NoFocus)
        self.helpButton.clicked.connect(self.help)
        self.tooltips.append(
            (self.helpButton,
             """Help on the Suggestions or Filtered panel."""))
        self.view = Views.Filtered.View(self.state)
        self.tooltips.append((self.view, """<p><b>Filtered view</b></p>
<p>This view shows any entries that match the current <b>Filter</b>.</p>
<p>Press <b>F3</b> or click <img src=":/goto-found.svg" width={0}
height={0}> or click <b>Goto→Filtered</b> to go to the current filtered
entry.</p>""".format(TOOLTIP_IMAGE_SIZE)))
        self.view.match = ""
        self.filterLabel = QLabel(
            "Filter <font color=darkgreen>(Ctrl+F)</font>")
        self.filterComboBox = QComboBox()
        self.filterComboBox.setMaxVisibleItems(24)
        self.tooltips.append((self.filterComboBox, """\
<p><b>Filter combobox</b></p>
<p>Use this combobox to choose the filter to use.</p>
<p>The <b>Terms Matching</b>, <b>Pages Matching</b>, and <b>Notes
Matching</b> filters need a match text.</p>"""))
        self.filterLabel.setBuddy(self.filterComboBox)
        for filter in FilterKind:
            if not filter.isCheck:
                self.filterComboBox.addItem(filter.text, filter)
        self.filterComboBox.currentIndexChanged[int].connect(self.query)
        self.filterTextComboBox = ComboBox()
        self.filterTextComboBox.setEditable(True)
        self.filterTextComboBox.setDuplicatesEnabled(False)
        self.filterTextComboBox.currentIndexChanged[str].connect(self.setMatch)
        self.tooltips.append((self.filterTextComboBox, """\
<p><b>Filter Match editor</b></p>
<p>The text to match when using a <b>Terms Matching</b>, <b>Pages
Matching</b>, or <b>Notes Matching</b> filter.</p>
<p>For terms and notes, the filtered entries are chosen by
case-insensitively comparing with the match word or words.</p> <p>Add a
<tt>*</tt> after a word to match any words that begin with the text
preceding the <tt>*</tt>.</p> <p>For example, “comp*” will match
“compress”, “compulsory”, “computer”, “computed”, etc.</p>
<p>For pages, enter them as you would for an entry's pages, e.g.,
<tt>199,202-5</tt> to match entries whose pages equal or include
<tt>199,202,203,204,205</tt>, whether explicitly, or within page
ranges.</p>"""))
        self.view.pane.clickLine.connect(self.state.updateNavigationStatus)
Example #59
0
    def tab_music_players(self):
        """ Everything inside the Music players tab gets created here."""
        # self.music_players
        # Creates the box with all the music players inside of it
        self.app_select_box = QComboBox(self.music_players)
        self.app_select_box.setGeometry(135, 10, 150, 25)
        # Whenever you change the application, it runs the selectnewapp func
        self.app_select_box.activated[str].connect(self.select_new_app)

        # Creates the label for the selection combobox
        self.selector_lbl = QLabel(self.music_players)
        self.selector_lbl.setGeometry(10, 10, 150, 25)
        self.selector_lbl.setText('Select your music player: ')

        # Creates the label for the current playing song (and the current
        # playing song label)
        self.current_playing_lbl = QLabel(self.music_players)
        self.current_playing_lbl.setGeometry(10, 45, 150, 25)
        self.current_playing_lbl.setText('Current playing song: ')

        self.current_playing = QLabel(self.music_players)
        self.current_playing.setGeometry(117, 45, 250, 25)
        self.current_playing.setText(Misc.noSongPlaying)

        # Creates a label which displays any additional messages
        self.misc_messages = QLabel(self.music_players)
        self.misc_messages.setGeometry(10, 80, 390, 24)
        self.misc_messages.setText(Misc.misc_message())
        self.misc_messages.setOpenExternalLinks(True)

        # adds all the music players into the combobox
        self.app_select_box.addItem(None)
        for item in Constants.ACTIVEITEMS:
            if item == '__name__' or item == 'active':
                continue
            self.app_select_box.addItem(item)

        # creates the start button
        self.start_btn = QPushButton(self.music_players)
        self.start_btn.setGeometry(75, 120, 250, 35)
        self.start_btn.setText('Start')

        # links the start button to the self.start function
        QObject.connect(
            self.start_btn, SIGNAL("clicked()"),
            lambda: Thread(target=self.start, name='startbutton').start())