Esempio n. 1
0
class qlabeled_entry(QWidget):
    def __init__(self, var, text, 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.efield = QLineEdit("Default Text")
        # self.efield.setMaximumWidth(max_size)
        self.efield.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.efield)
        self.var = var        
        self.efield.textChanged.connect(self.when_modified)
        
    def when_modified(self):
        self.var.set(self.efield.text())
        
    def hide(self):
        QWidget.hide(self)
class SimpleOption(QWidget):
    def __init__(self, settingsName, labelText, defaultValue, checkable=False):
        super(SimpleOption, self).__init__()
        self.setLayout(QHBoxLayout())
        #self.layout().setSpacing(0)
        self.checkable = checkable
        if checkable:
            self.checkBox = QCheckBox()
            self.layout().addWidget(self.checkBox)
        self.label = QLabel(labelText)
        self.label.setAlignment(Qt.AlignRight|Qt.AlignVCenter)
        #self.label.setMinimumWidth(240)
        self.layout().addWidget(self.label)
        self.settingsName = settingsName
        self.editor(defaultValue)
    def editor(self, defaultValue):
        self.lineEdit = QLineEdit()
        self.lineEdit.setText(str(QSettings().value(self.settingsName, defaultValue)))
        self.lineEdit.setToolTip('Default value: %s' % defaultValue)
        self.lineEdit.setAlignment(Qt.AlignLeft|Qt.AlignTop)
        self.layout().addWidget(self.lineEdit)
    def setEnabled(self, e):
        self.lineEdit.setEnabled(e)
    def getName(self):
        return self.label.text()
    def setName(self, newName):
        self.label.setText(newName)
    def getValue(self):
        return self.lineEdit.text()
    def setValue(self, newValue):
        self.lineEdit.setText(str(newValue))
    def save(self):
        QSettings().setValue(self.settingsName, self.getValue())
    def __str__(self):
        return str(self.getValue())
Esempio n. 3
0
class TimeLimitWidget(_LimitWidget):

    def __init__(self, parent=None):
        _LimitWidget.__init__(self, parent)
        self.setAccessibleName('Time')

    def _initUI(self):
        # Widgets
        self._lbl_time = QLabel('Time')
        self._lbl_time.setStyleSheet("color: blue")
        self._txt_time = TimeParameterWidget(TimeLimit.time_s)

        # Layouts
        layout = _LimitWidget._initUI(self)
        layout.addRow(self._lbl_time, self._txt_time)

        return layout

    def value(self):
        return TimeLimit(time_s=self._txt_time.values())

    def setValue(self, value):
        if hasattr(value, 'time_s'):
            self._txt_time.setValues(value.time_s)

    def setReadOnly(self, state):
        _LimitWidget.setReadOnly(self, state)
        style = 'color: none' if state else 'color: blue'
        self._lbl_time.setStyleSheet(style)
class MainWindow(QMainWindow):
    """ Our main window class
    """
    def __init__(self):
        QMainWindow.__init__(self)
        self.setWindowTitle("Main Window")
        self.setGeometry(300, 250, 400, 300)
        self.statusLabel = QLabel('Showing Progress')
        self.progressBar = QProgressBar()
        self.progressBar.setMinimum(0)
        self.progressBar.setMaximum(100)
    
    def CreateStatusBar(self):
        self.myStatusBar = QStatusBar()
        self.progressBar.setValue(10)
        self.myStatusBar.addWidget(self.statusLabel, 1)
        self.myStatusBar.addWidget(self.progressBar, 2)
        #self.myStatusBar.showMessage('Ready', 2000)
        self.setStatusBar(self.myStatusBar)
    
    def showProgress(self):
        while(self.progressBar.value() < self.progressBar.maximum()):
            self.progressBar.setValue(self.progressBar.value() + 10)
            time.sleep(1)
        self.statusLabel.setText('Ready')
Esempio n. 5
0
class PowerNotificationDialog(QDialog):
    '''
    Dialog to notify about system power changing state.
    '''

    message = "No message set"

    def __init__(self, parent=None):
        super(PowerNotificationDialog, self).__init__(parent)
        self.setWindowFlags(Qt.Dialog | Qt.FramelessWindowHint)

        layout = QGridLayout()

        spinBox = QLabel()
        spinner = QMovie(":icons/spinner")
        spinner.start()
        spinBox.setMovie(spinner)
        layout.addWidget(spinBox, 0, 0)

        self.textBox = QLabel()

        layout.addWidget(self.textBox, 0, 1, 1, 3)

        btnOK = ExpandingButton()
        btnOK.setText("OK")
        btnOK.clicked.connect(self.accept)
        layout.addWidget(btnOK, 1, 1, 1, 2)

        self.setLayout(layout)

    def exec_(self):
        self.textBox.setText(self.message)
        super(PowerNotificationDialog, self).exec_()
Esempio n. 6
0
 def getLabel(self, text, font, alignment=None):
     """ Get a Level Label with the text """
     label = QLabel(text, self)
     label.setFont(font)
     if alignment:
         label.setAlignment(alignment)
     return label
class PingerView(QWidget):
  def __init__(self, parent=None):
    super(PingerView, self).__init__(parent)
    self.state = 0
    layout = QVBoxLayout()
    self.btn_start_stop = QPushButton("Start Pinging")
    self.lbl_output = QLabel()
    self.btn_start_stop.clicked.connect(self.controlThread)
    layout.addWidget(self.btn_start_stop)
    layout.addWidget(self.lbl_output)
    self.setLayout(layout)
    
  def createPingerThread(self):
    req_data = RequestData(100, 1000, 1000, 3)
    self.receive_pipe, send_pipe =  Pipe(duplex=False)
    self.pinger_process = Pinger(["www.google.com"], req_data, send_pipe)

  def controlThread(self):
    if self.state == 0:
      self.createPingerThread()
      self.state = 1
      self.btn_start_stop.setText("Stop Pinging")
      self.pinger_process.start()
      data  = self.receive_pipe.recv()
      self.lbl_output.setText(str(data))
      self.pinger_process.terminate()
      self.pinger_process.wait()
      self.state = 0
      self.btn_start_stop.setText("Start Pinging")
	def getParameterWidget(self):
		"""
		Returns a widget with sliders / fields with which properties of this
		volume property can be adjusted.
		:rtype: QWidget
		"""
		layout = QGridLayout()
		layout.setContentsMargins(0, 0, 0, 0)
		layout.setAlignment(Qt.AlignTop)

		self.sliders = []
		for index in range(7):
			slider = QSlider(Qt.Horizontal)
			slider.setMinimum(0)
			slider.setMaximum(1000)
			slider.setValue(int(math.pow(self.sectionsOpacity[index], 1.0/3.0) * slider.maximum()))
			slider.valueChanged.connect(self.valueChanged)
			self.sliders.append(slider)
			label = QLabel(self.sectionNames[index])
			label.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
			layout.addWidget(label, index, 0)
			layout.addWidget(slider, index, 1)

		try:
			from ColumnResizer import ColumnResizer
			columnResizer = ColumnResizer()
			columnResizer.addWidgetsFromLayout(layout, 0)
		except Exception, e:
			print e
Esempio n. 9
0
class _ProgressEditor(Editor):
    max=Int
    message=Str
    def init(self, parent):
        self.control = self._create_control(parent)
        self.control.setMaximum(self.factory.max)
        self.control.setMinimum(self.factory.min)
        if self.factory.max_name:
            self.sync_value(self.factory.max_name,'max',mode='from')
        if self.factory.message_name:
            self.sync_value(self.factory.message_name, 'message', mode='from')

    def _max_changed(self):
        # print 'max',self.max
        self.control.setMaximum(self.max)

    def _message_changed(self, m):
        # print 'message',m
        self._message_control.setText(m)

    def _create_control(self, parent):
        layout=QVBoxLayout()
        pb = QProgressBar()

        self._message_control=QLabel()
        self._message_control.setText('     ')
        layout.addWidget(self._message_control)
        layout.addWidget(pb)

        return pb

    def update_editor(self):
        self.control.setValue(self.value)
Esempio n. 10
0
class PlusMinusButtons(QWidget):

    def __init__(self, caption):
        super(PlusMinusButtons, self).__init__()
        self.upButton = CameraButton()
        self.upButton.setIcon(QIcon(":icons/list-add"))

        self.downButton = CameraButton()
        self.downButton.setIcon(QIcon(":icons/list-remove"))

        self.caption = QLabel("<b>" + caption + "</b>")
        self.caption.setAlignment(Qt.AlignHCenter | Qt.AlignTop)

        self.initLayout()

    def initLayout(self):

        layout = QGridLayout()
        self.setLayout(layout)

        layout.addWidget(self.upButton, 0, 0)
        layout.addWidget(self.caption, 1, 0)
        layout.addWidget(self.downButton, 2, 0)

        layout.setRowStretch(0, 2)
        layout.setRowStretch(1, 2)
        layout.setRowStretch(2, 2)
Esempio n. 11
0
class qLabeledCheck(QWidget): 
    def __init__(self, name, arg_dict, 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.cbox = QCheckBox()
        # self.efield.setMaximumWidth(max_size)
        self.cbox.setFont(QFont('SansSerif', 12))
        self.label = QLabel(name)
        # self.label.setAlignment(Qt.AlignLeft)
        self.label.setFont(QFont('SansSerif', 12))
        self.layout1.addWidget(self.label)
        self.layout1.addWidget(self.cbox)
        self.arg_dict = arg_dict
        self.name = name
        self.mytype = type(self.arg_dict[name])
        if self.mytype != bool:
            self.cbox.setChecked(bool(self.arg_dict[name]))
        else:
            self.cbox.setChecked(self.arg_dict[name])
        self.cbox.toggled.connect(self.when_modified)
        self.when_modified()
        
    def when_modified(self):
        self.arg_dict[self.name]  = self.cbox.isChecked()
        
    def hide(self):
        QWidget.hide(self)
Esempio n. 12
0
class Program(QDialog):
    def __init__(self, parent=None):
        super(Program, self).__init__(parent)

        btn = QPushButton("Open Dialog")
        self.label1 = QLabel("Label 1 result")
        self.label2 = QLabel("Label 2 result")

        layout = QVBoxLayout()
        layout.addWidget(btn)
        layout.addWidget(self.label1)
        layout.addWidget(self.label2)
        self.setLayout(layout)

        btn.clicked.connect(self.open_dialog)

        # Force the window to stay on top
        self.setWindowFlags(Qt.WindowStaysOnTopHint)

    def open_dialog(self):
        dialog = Dialog()
        if dialog.exec_():
            # If dialog returns True (accept)
            self.label1.setText("SpinBox value is " + str(dialog.spin_box.value()))
            self.label2.setText("CheckBox is " + str(dialog.check_box.isChecked()))
        else:
            # Dialog rejected
            QMessageBox.warning(self, "Warning", "Dialog canceled")
Esempio n. 13
0
 def __init__(self, countdown, parent=None):
     QLabel.__init__(self, parent)
     self.countdown = countdown
     self.setText(self.countdown.toString(Qt.ISODate))
     # setup the countdown timer
     self.timer = QTimer(self)
     self.timer.timeout.connect(self._update_time)
Esempio n. 14
0
    def initUi(self):

        #slider
        slider = QSlider(PySide.QtCore.Qt.Orientation.Horizontal, self)
        slider.setRange(0,2)
        slider.setTickInterval(1)
        slider.setValue(2)
        self.slider = slider

        #.. and corresponding label element
        label = QLabel(self)
        label.setText(self.activation_states[slider.value()])
        self.label = label
        
        #connections
        #PySide.QtCore.QObject.connect(slider, slider.valueChanged, self, self.update_label)
        #self.connect(slider.valueChanged, self.update_label())
        slider.valueChanged[int].connect(self.update_label)
        
        # layout
        lo = QVBoxLayout() 
        lo.addWidget( slider )
        lo.addWidget( label )


        self.setLayout(lo)
class PluginSizeCanvasIndicator(IPlugin):
    def __init__(self, data_singleton):
        self.data_singleton = data_singleton
        self.label = QLabel()
        self.mw = self.data_singleton.mainWindow

    def name(self):
        return 'Size Canvas Indicator'

    def version(self):
        return '0.0.1'

    def description(self):
        return 'Size Canvas Indicator'

    def initialize(self):
        self.label.setVisible(True)
        self.mw.ui.statusbar.addWidget(self.label)
        # self.mw.ui.statusbar.addPermanentWidget(self.label, 1)

        self.mw.send_new_image_size.connect(self.update_label)

        canvas = self.mw.get_current_canvas()
        if canvas is not None:
            self.update_label(canvas.width(), canvas.height())

    def destroy(self):
        self.mw.ui.statusbar.removeWidget(self.label)
        self.mw.send_new_image_size.disconnect(self.update_label)

    def update_label(self, w, h):
        self.label.setText('{} x {}'.format(w, h))
Esempio n. 16
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)
Esempio n. 17
0
	def __init__(self, node, parent=None):
		super(DevicePage, self).__init__(parent)
		
		name_label = QLabel("Name:")
		self.name_lineedit = QLineEdit()
		setpressure_label = QLabel("Set Pressure:")
		#self.setpressure_spinbox = QDoubleSpinBox()
		self.setpressure_spinbox = CustomDoubleSpinBox(node, parent, setpressure_label.text())
		modelnum_label = QLabel("Model Number:")
		#self.modelnum_lineedit = QLineEdit()
		self.modelnum_lineedit = CustomLineEdit(node, parent, modelnum_label.text())
		orient_label = QLabel("Orientation:")
		self.orient_combobox = QComboBox()
		self.orient_combobox.addItems(["Horizontal", "Vertical"])
		
		layout = QGridLayout()
		layout.addWidget(name_label, 0, 0)
		layout.addWidget(self.name_lineedit, 0, 1)
		layout.addWidget(setpressure_label, 1, 0)
		layout.addWidget(self.setpressure_spinbox, 1, 1)
		layout.addWidget(modelnum_label, 2, 0)
		layout.addWidget(self.modelnum_lineedit, 2, 1)
		layout.addWidget(orient_label, 3, 0)
		layout.addWidget(self.orient_combobox, 3, 1)
		self.setLayout(layout)
		
		self.mapper = QDataWidgetMapper()
Esempio n. 18
0
 def createWidgets(self):
     """Create children widgets needed by this view"""
     
     fieldsWidth = 450
     labelsFont = View.labelsFont()
     editsFont = View.editsFont()
     
     self.setLogo()
     
     self.localdirLabel = QLabel(self)
     self.localdirEdit = QLineEdit(self)
     self.localdirLabel.setText('Choose a folder')
     self.localdirLabel.setFont(labelsFont)
     self.localdirEdit.setFixedWidth(fieldsWidth)
     self.localdirEdit.setReadOnly(False)
     self.localdirEdit.setFont(editsFont)
     
     self.browseButton = QPushButton(self)
     self.browseButton.setText('Browse')
     self.browseButton.setFont(labelsFont)
     
     self.syncButton = QPushButton(self)
     self.syncButton.setText('Sync') 
     self.syncButton.setFont(labelsFont)
     
     self.browseButton.clicked.connect(self.onBrowseClicked)
     self.syncButton.clicked.connect(self.onSyncClicked)
     
     settings = get_settings()
     self.localdirEdit.setText(settings.value(SettingsKeys['localdir'], ''))
     
     self.statusLabel = QLabel(self)
     self.statusLabel.setText('Status')
     self.statusLabel.setFont(View.labelsFont())
     self.status = StatusArea(self)
Esempio n. 19
0
class ShowersLimitWidget(_LimitWidget):

    def __init__(self, parent=None):
        _LimitWidget.__init__(self, parent)
        self.setAccessibleName('Showers')

    def _initUI(self):
        # Widgets
        self._lbl_showers = QLabel('Number of electron showers')
        self._lbl_showers.setStyleSheet("color: blue")
        self._txt_showers = NumericalParameterWidget(ShowersLimit.showers)

        # Layouts
        layout = _LimitWidget._initUI(self)
        layout.addRow(self._lbl_showers, self._txt_showers)

        return layout

    def value(self):
        return ShowersLimit(showers=self._txt_showers.values())

    def setValue(self, value):
        if hasattr(value, 'showers'):
            self._txt_showers.setValues(value.showers)

    def setReadOnly(self, state):
        _LimitWidget.setReadOnly(self, state)
        style = 'color: none' if state else 'color: blue'
        self._lbl_showers.setStyleSheet(style)
Esempio n. 20
0
    def __init__(self, window, ok_handler, cancel_handler):
        super(SignInDialog, self).__init__(window)

        self.setWindowTitle("Login")
        self.setFixedSize(300, 130)
        self.setModal(True)

        self.layout = QGridLayout(self)

        self.username_label = QLabel(self)
        self.username_label.setText("Username:"******"Password:"******"Login")
        self.buttons.button(QDialogButtonBox.Cancel).setText("Cancel")
        self.buttons.button(QDialogButtonBox.Cancel).clicked.connect(cancel_handler)

        self.buttons.button(QDialogButtonBox.Ok).clicked.connect(
            lambda: ok_handler(self.edit_username.text(), self.edit_password.text()))

        self.layout.addWidget(self.username_label, 0, 0)
        self.layout.addWidget(self.edit_username, 0, 1)
        self.layout.addWidget(self.password_label, 1, 0)
        self.layout.addWidget(self.edit_password, 1, 1)
        self.layout.addWidget(self.buttons, 3, 0, 1, 2, Qt.AlignCenter)

        self.setLayout(self.layout)
Esempio n. 21
0
    class AddAccountDialog(QDialog):
        def __init__(self, parent, ok_handler, cancel_handler):
            super(AdminWidget.AddAccountDialog, self).__init__(parent)

            self.setWindowTitle("Add account")
            self.setFixedSize(300, 100)
            self.setModal(True)

            self.layout = QGridLayout(self)

            self.username_label = QLabel(self)
            self.username_label.setText("Username")
            self.edit_username = QLineEdit(self)

            self.buttons = QDialogButtonBox(self)
            self.buttons.addButton(QDialogButtonBox.Ok)
            self.buttons.addButton(QDialogButtonBox.Cancel)
            self.buttons.button(QDialogButtonBox.Ok).setText("Add")
            self.buttons.button(QDialogButtonBox.Cancel).setText("Cancel")
            self.buttons.button(QDialogButtonBox.Cancel).clicked.connect(cancel_handler)
            self.buttons.button(QDialogButtonBox.Ok).clicked.connect(lambda: ok_handler(self.edit_username.text()))

            self.layout.addWidget(self.username_label, 0, 0)
            self.layout.addWidget(self.edit_username, 0, 1)
            self.layout.addWidget(self.buttons, 1, 0, 1, 2, Qt.AlignCenter)

            self.setLayout(self.layout)
Esempio n. 22
0
class PVProbe(QWidget):
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        name_label  = QLabel("PV Name:")
        self.pvname = QLineEdit()
        value_label = QLabel("PV Value:")
        self.value  = QLabel("    ")

        self.pvname.returnPressed.connect(self.onPVNameReturn)
        self.pv = None

        grid = QGridLayout()
        grid.addWidget(name_label,   0, 0)
        grid.addWidget(self.pvname,  0, 1)
        grid.addWidget(value_label,  1, 0)
        grid.addWidget(self.value,   1, 1)

        self.setLayout(grid)
        self.setWindowTitle("PySide PV Probe:")

    def onPVNameReturn(self):
        self.pv = epics.PV(self.pvname.text(), callback=self.onPVChange)

    def onPVChange(self, pvname=None, char_value=None, **kws):
        self.value.setText(char_value)
Esempio n. 23
0
    def __init__(self, parent=None):
        super(StatusArea, self).__init__(parent)
        self.setStyleSheet('StatusArea {background: yellow}')
        self.msg = QLabel(self)
        self.file = QLabel(self)
        self.progress = QProgressBar(self)
   
        self.msg.setFont(View.labelsFont())
        self.file.setFont(View.editsFont())

        self.progress.setMaximum(100)
        self.progress.setMinimum(0)
        self.progress.setTextVisible(False)
        self.progress.setStyleSheet(""" 
            QProgressBar {
                 border: 2px solid grey;
                 border-radius: 5px;
                 width: 60px;
                 height: 10px;
             }

             QProgressBar::chunk {
                 background-color: #05B8CC;
                 width: 5px;
             }""")
 
        layout = QHBoxLayout()
        layout.addWidget(self.msg, 0, Qt.AlignLeft)
        layout.addWidget(self.file, 0, Qt.AlignLeft)
        layout.addWidget(self.progress, 0, Qt.AlignRight)

        self.setLayout(layout)
Esempio n. 24
0
class HelpForm(QDialog):
	def __init__(self, page, parent=None):
		super(HelpForm, self).__init__(parent)
		self.pageLabel = QLabel("<font color=purple size=30><b>Help Contents</b></font>")
		self.pageLabel.setMinimumSize(400, 50)
		self.pageLabel.setAlignment(Qt.AlignCenter)
		appicom = QIcon(":/icons/njnlogo.png")
		self.setWindowIcon(appicom)
		toolBar = QToolBar()

		pixmap = QPixmap(":/icons/njnlogo.png")
		lbl = QLabel(self)
		lbl.setPixmap(pixmap)
		lbl.setFixedSize(70, 70)
		toolBar.setMinimumHeight(70)
		toolBar.setMaximumHeight(80)
		toolBar.addWidget(lbl)
		toolBar.addWidget(self.pageLabel)

		self.textBrowser = QTextBrowser()

		layout = QVBoxLayout()
		layout.addWidget(toolBar)
		layout.addWidget(self.textBrowser, 1)
		self.setLayout(layout)

		self.textBrowser.setSource(QUrl(page))
		self.setMinimumSize(650, 650)
		self.setMaximumSize(650, 660)
		self.setWindowTitle("Nigandu English to Tamil Dictionary | HELP")
Esempio n. 25
0
    def _buildResultsPanel(self):
        '''
        Creates the sub-panel containing displays widgets for informing the 
        user on the results of running the algorithm.
        '''        
        self._doneLbl = QLabel("No", self._window)
        self._solvableLbl = QLabel("Yes", self._window)
        
        #_doneLbl is highlighted green upon successful algorithm completion
        pal = self._doneLbl.palette()
        pal.setColor(QPalette.Window, Qt.green)
        self._doneLbl.setPalette(pal)

        #_solvableLbl is highlighted red if the world model isn't solvable
        pal = self._solvableLbl.palette()
        pal.setColor(QPalette.Window, Qt.red)
        self._solvableLbl.setPalette(pal)          
        
        layout = QGridLayout()
        layout.addWidget(QLabel("Path Found:"), 0, 0)
        layout.addWidget(self._doneLbl, 0, 1)
        layout.addWidget(QLabel("Is Solvable:"), 1, 0)
        layout.addWidget(self._solvableLbl, 1, 1)
        
        grpBx = QGroupBox("Results")
        grpBx.setLayout(layout)
        grpBx.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        return grpBx
class WallframeAppButton(QWidget):
    def __init__(self, app_tag, app_image_path, app_description_path):
        QWidget.__init__(self)
        # App tag
        self.app_tag_ = QLabel(app_tag)
        # App image
        app_image = QPixmap()
        app_image.load(app_image_path)
        self.app_image_ = QLabel()
        self.app_image_.setPixmap(app_image)
        # App description
        try:
            f = open(app_description_path, "r")
            self.app_description_ = f.read()
            f.close()
        except:
            print "Error opening description. Quitting."

        self.setToolTip(self.app_description_)
        # Layout the child widgets
        self.child_layout_ = QVBoxLayout()
        self.child_layout_.addWidget(self.app_image_)
        self.child_layout_.addWidget(self.app_tag_)

        self.setLayout(self.child_layout_)
Esempio n. 27
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)
class ColorWidget(QWidget):
	"""
	ColorWidget
	"""

	valueChanged = Signal(object)

	def __init__(self):
		super(ColorWidget, self).__init__()

		self.label = QLabel()
		self.color = [1.0, 1.0, 1.0]
		
		buttonLayout = QHBoxLayout()
		buttonLayout.setContentsMargins(8, 0, 0, 0)

		self.buttonWidget = QWidget()
		self.buttonWidget.setLayout(buttonLayout)

		layout = QGridLayout()
		layout.setContentsMargins(0, 0, 0, 0)
		layout.setSpacing(0)
		layout.addWidget(self.label, 0, 0)
		layout.addWidget(self.buttonWidget, 0, 1)
		self.setLayout(layout)

	def setName(self, name):
		self.label.setText(name)
Esempio n. 29
0
    def __init__(self, parent=None):
        super(BarcodeDialog, self).__init__(parent)

        settings = current_settings()

        self._layout = QVBoxLayout()
        prompt = QLabel(
            'The "Read barcodes" command will set each box\'s "Catalog number" '
            'metadata field with value(s) of any barcodes.\n'
            '\n'
            'Use the controls below to indicate how barcodes should be read. '
            'Some options might be unavailable.')
        prompt.setWordWrap(True)
        self._layout.addWidget(prompt)
        self._layout.addWidget(HorizontalLine())

        self._radio_libdmtx = self._create_libdmtx(settings)
        self._radio_zbar = self._create_zbar(settings)
        (self._radio_inlite, self._inlite_1d, self._inlite_datamatrix,
         self._inlite_pdf417, self._inlite_qr) = self._create_inlite(settings)

        self._buttons = QDialogButtonBox(QDialogButtonBox.Ok |
                                         QDialogButtonBox.Cancel)

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

        self._layout.addWidget(self._buttons)
        self.setLayout(self._layout)

        self.setWindowTitle('Read barcodes')
Esempio n. 30
0
    def makeContent(self):
        layout = QVBoxLayout()

        lblVersion = QLabel()
        lblVersion.setText("av-control version {0} (avx version {1})".format(_ui_version, _avx_version))
        layout.addWidget(lblVersion)

        self.lv = LogViewer(self.controller, self.mainWindow)

        log = ExpandingButton()
        log.setText("Log")
        log.clicked.connect(self.showLog)
        layout.addWidget(log)

        btnAutoTrack = ExpandingButton()
        btnAutoTrack.setText("Recalibrate Extras scan converter")
        btnAutoTrack.clicked.connect(handlePyroErrors(lambda: self.controller["Extras Scan Converter"].recalibrate()))
        layout.addWidget(btnAutoTrack)

        btnQuit = ExpandingButton()
        btnQuit.setText("Exit AV Control")
        btnQuit.clicked.connect(self.mainWindow.close)
        layout.addWidget(btnQuit)

        return layout
Esempio n. 31
0
 def __init__(self):
     """ Constructo FUnction
     """
     QMainWindow.__init__(self)
     self.setWindowTitle("Application Title Here")
     self.setGeometry(300, 250, 400, 300)
     self.statusLabel = QLabel('Showing Progress')
     self.progressBar = QProgressBar()
     self.progressBar.setMinimum(0)
     self.progressBar.setMaximum(1000000)
Esempio n. 32
0
    def _create_control(self, parent):
        layout = QVBoxLayout()
        pb = QProgressBar()

        self._message_control = QLabel()
        self._message_control.setText('     ')
        layout.addWidget(self._message_control)
        layout.addWidget(pb)

        return pb
Esempio n. 33
0
    def _create_control(self, parent):
        control = QLabel()
        color = self.item.color.name()
        self._set_style(color=color,
                        control=control)

        control.setMargin(5)
        parent.setSpacing(0)

        return control
Esempio n. 34
0
 def initUI(self):
     self.fileWidget = FileBrowseWidget("Firmware file .hex (*.hex)")
     self.fileWidget.setText(DEFAULT_FIRMWARE_FILE)
     layout = QFormLayout()
     layout.addRow(QLabel("Firmware file (.hex):"), self.fileWidget)
     label = QLabel("<b>Note:</b> after updating the firmware, all layout "
                    "and device settings will be erased.")
     label.setTextInteractionFlags(Qt.TextSelectableByMouse)
     layout.addRow(label)
     self.setLayout(layout)
Esempio n. 35
0
class ImageMediaView(MediaView):
    def __init__(self, media, parent):
        super(ImageMediaView, self).__init__(media, parent)
        self._widget = QLabel(parent)
        self._widget.setGeometry(media['_geometry'])
        self._img = QImage()
        self.set_default_widget_prop()

    @Slot()
    def play(self):
        self._finished = 0
        path = "%s/%s" % (self._save_dir, self._options['uri'])
        rect = self._widget.geometry()
        self._img.load(path)
        self._img = self._img.scaled(rect.width(), rect.height(),
                                     Qt.IgnoreAspectRatio,
                                     Qt.SmoothTransformation)

        self._widget.setPixmap(QPixmap.fromImage(self._img))
        self._widget.show()
        self._widget.raise_()

        self._play_timer.setInterval(int(float(self._duration) * 1000))
        self._play_timer.start()
        self.started_signal.emit()
Esempio n. 36
0
class TouchSpinner(QWidget):
    valueChanged = Signal(int)

    def __init__(self, parent=None):
        super(TouchSpinner, self).__init__(parent)
        self._value = 50
        self._max = 100
        self._min = 0

        layout = QHBoxLayout()

        self.btnMinus = ExpandingButton()
        self.btnMinus.setIcon(QIcon(":icons/list-remove"))
        self.btnMinus.setText("-")
        self.btnMinus.clicked.connect(lambda: self.setValue(self._value - 1))
        layout.addWidget(self.btnMinus, 1)

        self.lblValue = QLabel(self.formattedValue(self._value))
        self.lblValue.setAlignment(Qt.AlignHCenter)
        layout.addWidget(self.lblValue, 1)

        self.btnPlus = ExpandingButton()
        self.btnPlus.setIcon(QIcon(":icons/list-add"))
        self.btnPlus.setText("+")
        self.btnPlus.clicked.connect(lambda: self.setValue(self._value + 1))
        layout.addWidget(self.btnPlus, 1)

        self.setLayout(layout)

    def setValue(self, value):
        if value > self._max:
            newValue = self._max
        elif value < self._min:
            newValue = self._min
        else:
            newValue = value
        if value != self._value:
            self._value = newValue
            self.valueChanged.emit(newValue)
            self.lblValue.setText(self.formattedValue(newValue))

            self.btnPlus.setEnabled(self._value < self._max)
            self.btnMinus.setEnabled(self._value > self._min)

    def setMaximum(self, maxi):
        self._max = maxi

    def setMinimum(self, mini):
        self._min = mini

    def value(self):
        return self._value

    def formattedValue(self, value):
        return "{}".format(value)
Esempio n. 37
0
    def initUI(self):
        self.layoutFile = FileBrowseWidget(
            "Layout settings file .yaml (*.yaml)")
        self.layoutFile.setText(DEFAULT_LAYOUT_FILE)
        self.rfSettingsFile = FileBrowseWidget(
            "Device settings file .yaml (*.yaml)")
        self.rfSettingsFile.setText(DEFAULT_RF_FILE)
        layout = QFormLayout()
        layout.addRow(QLabel("Layout settings file (.yaml):"), self.layoutFile)
        layout.addRow(QLabel("RF settings file (.yaml):"), self.rfSettingsFile)
        self.idLine = QLineEdit()
        self.idLine.setText(str(DEFAULT_DEVICE_ID))
        self.idLine.setMaximumWidth(50)
        self.idLine.setValidator(QIntValidator(0, 63))
        layout.addRow(QLabel("Device id (0-63):"), self.idLine)

        self.generateButton = QPushButton("Generate new RF settings")
        self.generateButton.setMaximumWidth(230)
        self.generateButton.clicked.connect(self.generateRFSettings)
        layout.addRow(None, self.generateButton)

        label = QLabel(
            "<b>Note:</b> These settings only need to be loaded on each "
            "device once and are persistent when you update the layout. "
            "To ensure proper operation and security, each device must "
            "have a unique device ID for a given RF settings file. "
            "Since RF settings file contains your encryption key, make "
            "sure to keep it secret.")
        label.setTextInteractionFlags(Qt.TextSelectableByMouse)
        label.setWordWrap(True)
        layout.addRow(label)
        self.setLayout(layout)
Esempio n. 38
0
    def __init__(self, parent=None):
        super(SettingsDialog, self).__init__(parent)

        self.setWindowTitle("Settings")

        main_layout = QVBoxLayout()

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

        settings = QSettings()

        db_group = QGroupBox("Database")
        grid_layout = QGridLayout()
        grid_layout.addWidget(QLabel("File"), 0, 0)
        text = settings.value('DB/File')
        self.file = QLineEdit(text)
        self.file.setText(text)
        grid_layout.addWidget(self.file, 0, 1)
        browse = QPushButton("Browse")
        browse.clicked.connect(self.browse)
        grid_layout.addWidget(browse, 0, 2)
        db_group.setLayout(grid_layout)
        main_layout.addWidget(db_group)

        ip_width = QFontMetrics(QFont(self.font())).width("000.000.000.000  ")

        smtp_group = QGroupBox("SMTP")
        grid_layout = QGridLayout()
        grid_layout.addWidget(QLabel("Server"), 0, 0)
        text = settings.value('SMTP/Server')
        self.smtp_server = QLineEdit(text)
        self.smtp_server.setText(text)
        grid_layout.addWidget(self.smtp_server, 0, 1)
        smtp_group.setLayout(grid_layout)
        main_layout.addWidget(smtp_group)

        self.http_proxy = QGroupBox("HTTP Proxy")
        self.http_proxy.setCheckable(True)
        self.http_proxy.setChecked(bool(settings.value('HTTP Proxy/Enabled')))
        grid_layout = QGridLayout()
        grid_layout.addWidget(QLabel("Server"), 0, 0)
        self.http_proxy_ip = QLineEdit()
        self.http_proxy_ip.setText(settings.value('HTTP Proxy/IP'))
        self.http_proxy_ip.setMinimumWidth(ip_width)
        grid_layout.addWidget(self.http_proxy_ip, 0, 1)
        grid_layout.setColumnStretch(0, 1)
        self.http_proxy.setLayout(grid_layout)
        main_layout.addWidget(self.http_proxy)

        main_layout.addWidget(buttonBox)
        self.setLayout(main_layout)

        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)
Esempio n. 39
0
class ImageMediaView(MediaView):
    def __init__(self, media, parent):
        super(ImageMediaView, self).__init__(media, parent)
        self.widget = QLabel(parent)
        self.widget.setGeometry(media['geometry'])
        self.img = QImage()
        self.set_default_widget_prop()

    @Slot()
    def play(self):
        self.finished = 0
        path = '%s/%s' % (self.save_dir, self.options['uri'])
        rect = self.widget.geometry()
        self.img.load(path)
        self.img = self.img.scaled(rect.width(), rect.height(),
                                   Qt.IgnoreAspectRatio,
                                   Qt.SmoothTransformation)
        self.widget.setPixmap(QPixmap.fromImage(self.img))
        self.widget.show()
        self.widget.raise_()
        if float(self.duration) > 0:
            self.play_timer.setInterval(int(float(self.duration) * 1000))
            self.play_timer.start()
        self.started_signal.emit()

    @Slot()
    def stop(self, delete_widget=False):
        #---- kong ----
        if not self.widget:
            return False
        del self.img
        self.img = QImage()
        #----
        super(ImageMediaView, self).stop(delete_widget)
        return True
Esempio n. 40
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()
Esempio n. 41
0
 def addTab(self, name ):
     
     newWidget = QWidget()
     layout = QVBoxLayout( newWidget )
     labelEmpty = QLabel(); labelEmpty.setMinimumHeight(5)
     buttonDelete = QPushButton( "Delete Tab" )
     layout.addWidget( labelEmpty )
     layout.addWidget( buttonDelete )
     QTabWidget.addTab( self, newWidget, name )
     
     QtCore.QObject.connect( buttonDelete, QtCore.SIGNAL( 'clicked()' ), self.deleteTab )
Esempio n. 42
0
    def __init__(self, presenter, parent=None):
        super(EditableBoxView, self).__init__(presenter, parent)
        self.nameLabel = QLabel(self)
        self.valueEdit = QLineEdit(self)

        self.setLayout(QVBoxLayout())
        self.layout().addWidget(self.nameLabel)
        self.layout().addWidget(self.valueEdit)

        self.Initialize.connect(self._initialize)
        self.valueEdit.editingFinished.connect(self._onFinishedEditingValue)
Esempio n. 43
0
 def __init__(self, parent=None):
     QMainWindow.__init__(self, parent)
     central = QWidget(self)
     layout = QVBoxLayout(central)
     self.image_label = QLabel('here\'s the shot', central)
     layout.addWidget(self.image_label)
     self.button = QPushButton('Shoot me!', central)
     self.button.setObjectName('shot_button')
     layout.addWidget(self.button)
     self.setCentralWidget(central)
     QMetaObject.connectSlotsByName(self)
Esempio n. 44
0
    def createWidgets(self):
        self.backButton = QToolButton()
        self.backButton.setIcon(QIcon(":/go-back.svg"))
        self.backButton.setText("&Back")
        self.backButton.setToolTip("""\
<p><b>Back</b> ({})</p>
<p>Navigate to the previous page.</p>""".format(
            QKeySequence("Alt+Left").toString()))
        self.forwardButton = QToolButton()
        self.forwardButton.setIcon(QIcon(":/go-forward.svg"))
        self.forwardButton.setText("&Forward")
        self.forwardButton.setToolTip("""\
<p><b>Forward</b> ({})</p>
<p>Navigate to the page you've just come back from.</p>""".format(
            QKeySequence("Alt+Right").toString()))
        self.contentsButton = QToolButton()
        self.contentsButton.setIcon(QIcon(":/go-home.svg"))
        self.contentsButton.setText("&Contents")
        self.contentsButton.setToolTip("""\
<p><b>Contents</b> ({})</p>
<p>Navigate to the contents page.</p>""".format(
            QKeySequence("Alt+Home").toString()))
        self.searchLineEdit = Widgets.LegendLineEdit.LineEdit(
            "Search (F3 or Ctrl+F)")
        self.searchLineEdit.setToolTip("""\
<p><b>Search editor</p>
<p>Type in a word to search for in the online help pages and press
<b>Enter</b> or <b>F3</b> to search.</p>""")
        self.zoomInButton = QToolButton()
        self.zoomInButton.setIcon(QIcon(":/zoomin.svg"))
        self.zoomInButton.setText("&Zoom In")
        self.zoomInButton.setToolTip("""\
<p><b>Zoom In</b> ({})</p>
<p>Make the text bigger.</p>""".format(
            QKeySequence("Alt++").toString()))
        self.zoomOutButton = QToolButton()
        self.zoomOutButton.setIcon(QIcon(":/zoomout.svg"))
        self.zoomOutButton.setText("Zoom &Out")
        self.zoomOutButton.setToolTip("""\
<p><b>Zoom Out</b> ({})</p>
<p>Make the text smaller.</p>""".format(
            QKeySequence("Alt+-").toString()))
        width = self.fontMetrics().width(self.zoomOutButton.text() + " ")
        for button in (self.backButton, self.forwardButton,
                       self.contentsButton, self.zoomInButton,
                       self.zoomOutButton):
            button.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
            button.setMinimumWidth(width)
            button.setFocusPolicy(Qt.NoFocus)
        self.browser = QWebView()
        page = self.browser.page()
        page.setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
        if self.debug:
            self.urlLabel = QLabel()
Esempio n. 45
0
    def __init__(self,parent):
        global dao
        super(EditDeliverySlipDialog,self).__init__(parent)

        title = _("Create delivery slip")
        self.setWindowTitle(title)

        top_layout = QVBoxLayout()
        self.title_widget = TitleWidget(title,self)
        top_layout.addWidget(self.title_widget)

        self.info_label = QLabel()
        self.info_label.setWordWrap(True)
        top_layout.addWidget(self.info_label)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton( QDialogButtonBox.StandardButton.Cancel)
        self.buttons.addButton( QDialogButtonBox.Ok)

        order_part_prototype = []
        order_part_prototype.append( TextLinePrototype('human_identifier',_('Part n.'),editable=False))
        order_part_prototype.append( TextLinePrototype('description',_('Description'),editable=False))
        order_part_prototype.append( IntegerNumberPrototype('qty',_('Qty plan.'),editable=False))
        order_part_prototype.append( IntegerNumberPrototype('tex2',_('Qty so far'),editable=False))
        order_part_prototype.append( IntegerNumberPrototype(None,_('Qty out now'),nullable=True))
        self.qty_out_column = len(order_part_prototype) - 1

        # order_part_prototype.append( IntegerNumberPrototype(None,_('Reglages'),nullable=True))
        # order_part_prototype.append( IntegerNumberPrototype(None,_('Derogation'),nullable=True))
        # order_part_prototype.append( IntegerNumberPrototype(None,_('Rebus'),nullable=True))


        self.controller_part = PrototypeController(self, order_part_prototype,None,freeze_row_count=True)
        self.controller_part.view.horizontalHeader().setResizeMode(QHeaderView.ResizeToContents)
        self.controller_part.view.horizontalHeader().setResizeMode(1,QHeaderView.Stretch)


        self.controller_part.setModel(TrackingProxyModel(self,order_part_prototype))
        self.close_order_checkbox = QCheckBox(_("Close the order"))

        top_layout.addWidget(self.controller_part.view) # self.time_tracks_view)
        # top_layout.addWidget(self._make_units_qaulifications_gui())
        top_layout.addWidget(self.close_order_checkbox)
        top_layout.addWidget(self.buttons)
        self.setLayout(top_layout)

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

        sg = QDesktopWidget().screenGeometry()
        self.setMinimumWidth(0.5*sg.width())
        self.setMinimumHeight(0.3*sg.height())

        self.slip_id = None
Esempio n. 46
0
 def setLayoutForm(self):
     """Présentation du QFormLayout"""
     self.setWindowTitle("Form Layout")
     formLayout = QFormLayout(self)
     labelUser = QLabel("Username")
     txtUser = QLineEdit()
     labelPass = QLabel("Password")
     txtPass = QLineEdit()
     formLayout.addRow(labelUser, txtUser)
     formLayout.addRow(labelPass, txtPass)
     self.setLayout(formLayout)
 def createLabel(self, text, color):
     label = QLabel(text)
     font = label.font()
     font.setPixelSize(12)
     label.setFont(font)
     label.setAlignment(Qt.AlignCenter)
     label.setStyleSheet("color: " + color)
     return label
Esempio n. 48
0
class SliderWidget(QWidget):
    """
	SliderWidget
	"""
    valueChanged = Signal(int)

    def __init__(self):
        super(SliderWidget, self).__init__()

        self.label = QLabel()
        self.slider = QSlider(Qt.Horizontal)
        self.spinbox = QSpinBox()

        self.slider.valueChanged.connect(self.changedValue)
        self.spinbox.valueChanged.connect(self.changedValue)

        layout = QGridLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setVerticalSpacing(0)
        layout.addWidget(self.label, 0, 0)
        layout.addWidget(self.slider, 0, 1)
        layout.addWidget(self.spinbox, 0, 2)
        self.setLayout(layout)

    def setName(self, name):
        """
		Set the name for the slider
		"""
        self.label.setText(name)

    def setRange(self, range):
        """
		Set the range for the value
		"""
        self.slider.setMinimum(range[0])
        self.spinbox.setMinimum(range[0])
        self.slider.setMaximum(range[1])
        self.spinbox.setMaximum(range[1])

    def setValue(self, value):
        """
		Set the value for the slider and the spinbox
		"""
        self.slider.setValue(value)
        self.spinbox.setValue(value)

    def value(self):
        return self.slider.value()

    @Slot(int)
    def changedValue(self, value):
        self.setValue(value)
        self.valueChanged.emit(value)
Esempio n. 49
0
    def __init__(self):
        QDialog.__init__(self)

        layout = QFormLayout(self)
        self.setLayout(layout)
        layout.addRow("Python version:", QLabel("%s.%s.%s (%s)" % 
                        (sys.version_info[0], 
                         sys.version_info[1], 
                         sys.version_info[2], 
                         sys.version_info[3])))

        layout.addRow("Qt version:", QLabel( qVersion()))
Esempio n. 50
0
    def __init__(self, parentQExampleScrollArea, parentQWidget=None):
        QLabel.__init__(self, parentQWidget)
        self.parentQExampleScrollArea = parentQExampleScrollArea
        self.scale = 1.0
        self.position = (0, 0)
        self.pressed = None
        self.anchor = None
        self.drawer = CaptainServer.CaptainServer(self)
        self.drawer.initUI()

        self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.customContextMenuRequested.connect(self.drawer.createMenus)
Esempio n. 51
0
    def __init__(self, caption):
        super(PlusMinusButtons, self).__init__()
        self.upButton = CameraButton()
        self.upButton.setIcon(QIcon(":icons/list-add"))

        self.downButton = CameraButton()
        self.downButton.setIcon(QIcon(":icons/list-remove"))

        self.caption = QLabel("<b>" + caption + "</b>")
        self.caption.setAlignment(Qt.AlignHCenter | Qt.AlignTop)

        self.initLayout()
Esempio n. 52
0
    def __init__(self):

        QWidget.__init__(self)

        self.__view_page_select = ViewPageSelectMag()
        self.__view_widget_select = ViewWidgetSelect()

        self.__widget_data = dict()

        # 主 layout
        _layout = QGridLayout()
        self.setLayout(_layout)

        # 控件类型
        _type_label = QLabel(u"对象类型")
        self.__type_select = OrcSelect("operate_object_type")

        # 控件信息输入
        _widget_label = QLabel(u"控件")
        self.__widget_input = OrcLineEdit()
        self.__widget_input.setReadOnly(True)

        # 操作信息输入 layout
        _operate_label = QLabel(u"操作")
        self.__operate_select = SelectWidgetOperation()

        # 按钮
        _button_submit = QPushButton(u"确定")
        _button_cancel = QPushButton(u"取消")

        # 按钮 layout
        _layout_button = QHBoxLayout()
        _layout_button.addStretch()
        _layout_button.addWidget(_button_submit)
        _layout_button.addWidget(_button_cancel)

        _layout.addWidget(_type_label, 0, 0)
        _layout.addWidget(self.__type_select, 0, 1)
        _layout.addWidget(_widget_label, 1, 0)
        _layout.addWidget(self.__widget_input, 1, 1)
        _layout.addWidget(_operate_label, 2, 0)
        _layout.addWidget(self.__operate_select, 2, 1)
        _layout.addLayout(_layout_button, 3, 1)

        self.__change_type("PAGE")

        # connection
        _button_cancel.clicked.connect(self.close)
        _button_submit.clicked.connect(self.__submit)
        self.__widget_input.clicked.connect(self.__show_select)
        self.__view_widget_select.sig_selected[dict].connect(self.__set_widget)
        self.__view_page_select.sig_selected[dict].connect(self.__set_widget)
        self.__type_select.currentIndexChanged.connect(self.__change_type)
Esempio n. 53
0
    def testRemoveChildWidget(self):
        parent = QLabel()
        widget = QLabel(parent)
        self.assertEqual(sys.getrefcount(widget), 3)

        layout = QHBoxLayout()
        layout.addWidget(widget)
        self.assertEqual(sys.getrefcount(widget), 3)

        layout.removeWidget(widget)
        widget.setObjectName("MyWidget")
        self.assertEqual(sys.getrefcount(widget), 3)
Esempio n. 54
0
    def createBinaryOptions(self):
        """
        Binary Analysis Options
        """
        groupBox = QtGui.QGroupBox('Binary Analysis')

        # Elements
        cbs_unique_str = QCheckBox('Show unique strings', self)
        cbs_unique_com = QCheckBox('Show unique comments', self)
        cbs_unique_calls = QCheckBox('Show unique calls', self)
        cbs_entropy = QCheckBox('Calculate entropy', self)
        cutoff_label = QLabel('Connect BB cutoff')
        sb_cutoff = QSpinBox()
        sb_cutoff.setRange(1, 40)
        cutoff_func_label = QLabel('Connect functions cutoff')
        sbf_cutoff = QSpinBox()
        sbf_cutoff.setRange(1, 40)

        # Default states are read from the Config
        # class and reflected in the GUI
        cbs_unique_str.setCheckState(
            self.get_state(self.config.display_unique_strings))
        cbs_unique_com.setCheckState(
            self.get_state(self.config.display_unique_comments))
        cbs_unique_calls.setCheckState(
            self.get_state(self.config.display_unique_calls))
        cbs_entropy.setCheckState(self.get_state(
            self.config.calculate_entropy))
        sb_cutoff.setValue(self.config.connect_bb_cutoff)
        sbf_cutoff.setValue(self.config.connect_func_cutoff)

        # Connect elements and signals
        cbs_unique_str.stateChanged.connect(self.string_unique)
        cbs_unique_com.stateChanged.connect(self.comment_unique)
        cbs_unique_calls.stateChanged.connect(self.calls_unique)
        cbs_entropy.stateChanged.connect(self.string_entropy)
        sb_cutoff.valueChanged[int].connect(self.set_cutoff)
        sb_cutoff.valueChanged[int].connect(self.set_func_cutoff)

        vbox = QtGui.QVBoxLayout()
        vbox.addWidget(cbs_unique_str)
        vbox.addWidget(cbs_unique_com)
        vbox.addWidget(cbs_unique_calls)
        vbox.addWidget(cbs_entropy)
        vbox.addWidget(cutoff_label)
        vbox.addWidget(sb_cutoff)
        vbox.addWidget(cutoff_func_label)
        vbox.addWidget(sbf_cutoff)
        vbox.addStretch(1)

        groupBox.setLayout(vbox)

        return groupBox
Esempio n. 55
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)
Esempio n. 56
0
    def _append_comment(self, comment):
        l = QLabel(comment.text)
        l.setWordWrap(True)
        l.setStyleSheet("background-color: #ffffff;")
        # l.setTextInteractionFlags(Qt.TextSelectableByMouse | Qt.TextSelectableByKeyboard | Qt.LinksAccessibleByMouse | Qt.LinksAccessibleByKeyboard)

        self._comments_layout.addWidget(l)

        l = QLabel("Chuck Norris, 14/4/2016")
        l.setStyleSheet("color: #808080;")
        self._comments_layout.addWidget(l)
        self._comments_layout.setAlignment(l, Qt.AlignRight)
        self.comments_list_widget.setVisible(True)
Esempio n. 57
0
    def replace(self, unit):
        old_item = self.test_layout.itemAtPosition(0, 0)
        old_label = old_item.widget()
        ref = weakref.ref(old_item, self._destroyed)

        self.test_layout.removeWidget(old_label)
        unit.assertRaises(RuntimeError, old_item.widget)
        del old_item

        label = QLabel("Label New")
        old_label.deleteLater()
        label.setAlignment(Qt.AlignCenter)
        self.test_layout.addWidget(label, 0, 0)
Esempio n. 58
0
 def setupStatusBar(self):
     """Ajoute une barre de status"""
     self.progressBar = QProgressBar()
     self.statusLabel = QLabel('Progression ...')
     self.progressBar.setMaximum(100)
     self.progressBar.setMinimum(0)
     self.statusBar = QStatusBar()
     # # Affiche un message durant 2 sec après ouverture de l'application
     # self.statusBar.showMessage('Please Wait ...', 2000)
     self.progressBar.setValue(10)
     self.statusBar.addWidget(self.statusLabel, 1)
     self.statusBar.addWidget(self.progressBar, 2)
     self.setStatusBar(self.statusBar)
    def initUI(self):
        # container = QWidget(self)
        # container.resize(200, 100);
        # container.setStyleSheet("background-color:black;")

        font_size = QLabel('Font Size')
        font_size.fillColor = QColor(30, 30, 30, 120)
        font_size.penColor = QColor("#333333")

        grid = QGridLayout()
        grid.setContentsMargins(50, 10, 10, 10)
        grid.addWidget(font_size, 0, 0)
        self.setLayout(grid)
Esempio n. 60
0
    def __init__(self, *args, **kwargs):

        self.transInfo = ImageBaseTranslateInfo()

        super(ImageBase, self).__init__(*args, **kwargs)
        self.installEventFilter(self)

        self.image = QImage()
        self.imageTransformed = QImage()
        self.pixmap = QPixmap()
        self.label = QLabel(self)
        self.imagePath = ""
        self.aspect = 1