コード例 #1
1
ファイル: coup.py プロジェクト: fluffyOkitsune/Coup
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        
        self.graphicsView = QGraphicsView()
        
        scene = QGraphicsScene(self.graphicsView)
        scene.setSceneRect(0, 0, MainWindow.WINDOW_WIDTH, MainWindow.WINDOW_HEIGHT)
         
        self.graphicsView.setScene(scene)
        self.screen = Screen(MainWindow.WINDOW_WIDTH, MainWindow.WINDOW_HEIGHT)
        
        scene.addItem(self.screen)

        mainLayout = QHBoxLayout()
        mainLayout.setAlignment(Qt.AlignTop)
        mainLayout.addWidget(self.graphicsView)

        self.setLayout(mainLayout)
        self.setWindowTitle("Coup")
        self.updating_rule = False
        self.show()
        
        # タイマースタート
        self.timer = QTimer()
        self.timer.setInterval(int(1000 / MainWindow.FPS))
        self.timer.timeout.connect(self.timeout)
        self.timer.start()
コード例 #2
0
ファイル: data_check.py プロジェクト: canard0328/malss
    def __make_cell(self, c, name, col_type, col_type_def):
        cell = QWidget(self.inner)
        rbtn = QRadioButton('', cell)
        rbtn.toggled.connect(lambda: self.rbtn_clicked(name + '_' + str(c)))
        hbl = QHBoxLayout(cell)
        hbl.addWidget(rbtn)
        hbl.setContentsMargins(0, 0, 0, 0)
        hbl.setAlignment(Qt.AlignCenter)
        cell.setLayout(hbl)
        if name == 'cat':
            if col_type == 'object':
                rbtn.setChecked(True)
            self.lst_cat.append(rbtn)
        elif name == 'num':
            if col_type != 'object':
                rbtn.setChecked(True)
            if col_type_def == 'object':
                rbtn.setEnabled(False)
            self.lst_num.append(rbtn)
        elif name == 'obj':
            if col_type == 'object' and self.params.task == 'Regression':
                rbtn.setEnabled(False)
            elif col_type != 'object' and self.params.task == 'Classification':
                rbtn.setEnabled(False)
            if self.params.columns[c] == self.params.objective:
                rbtn.setChecked(True)
            self.lst_obj.append(rbtn)

        return cell
コード例 #3
0
ファイル: SubtitleTabs.py プロジェクト: mgoral/subconvert
    def __init__(self, parent):
        super(SearchBar, self).__init__(parent)

        self._sit = None

        self._editor = SearchEdit(self)
        self._prevButton = QPushButton("<", self)
        self._nextButton = QPushButton(">", self)
        self._closeButton = QPushButton(QIcon.fromTheme("window-close"), "", self)

        layout = QHBoxLayout()
        layout.setAlignment(Qt.AlignLeft)
        layout.setSpacing(0)

        layout.addWidget(self._editor)
        layout.addWidget(self._prevButton)
        layout.addWidget(self._nextButton)
        layout.addWidget(self._closeButton)
        layout.setContentsMargins(1, 1, 1, 1)

        self.setLayout(layout)

        self._nextButton.clicked.connect(self.next)
        self._prevButton.clicked.connect(self.prev)
        self._closeButton.clicked.connect(self.hide)
        self._editor.textChanged.connect(self._reset)
        self._editor.returnPressed.connect(self.next)
        self._editor.escapePressed.connect(self.hide)
コード例 #4
0
ファイル: padulator.py プロジェクト: sparsile/padulator
 def addStatControl(self,i,label=None):
     statbox = QHBoxLayout()
     statbox.addSpacing(1)
     statbox.setSpacing(0)
     statbox.setAlignment(Qt.AlignCenter)
     statlabel = QLabel(self.stats[i] if label is None else label)
     statlabel.setContentsMargins(0,0,0,0)
     statlabel.setAlignment(Qt.AlignCenter)
     statlabel.setFixedWidth(20)
     statbox.addWidget(statlabel)
     statcontrol = QLineEdit()
     statcontrol.setAlignment(Qt.AlignCenter)
     statcontrol.setFixedWidth(40)
     statcontrol.setText(str(self.skill.multipliers[i]))
     v = QDoubleValidator(0,99,3,statcontrol)
     v.setNotation(QDoubleValidator.StandardNotation)
     #v.setRange(0,100,decimals=3)
     statcontrol.setValidator(v)
     #print(v.top())
     def statFuncMaker(j):
         def statFunc(newValue):
             self.skill.multipliers[j] = float(newValue)
             self.skillsChanged.emit()
         return statFunc
     statcontrol.textChanged[str].connect(statFuncMaker(i))
     statbox.addWidget(statcontrol)
     statbox.addSpacing(1)
     self.layout.addLayout(statbox)
コード例 #5
0
ファイル: errorgb.py プロジェクト: faouellet/CorrectUS
    def setErrors(self, errors):
        self.errors = errors

        for idx, err_key in enumerate(sorted(self.errors)):
            err = self.errors[err_key]
            id_item = QTableWidgetItem(err.id)
            id_item.setFlags(Qt.ItemIsEnabled)

            desc_item = QTableWidgetItem(err.check)
            desc_item.setFlags(Qt.ItemIsEnabled)

            penalty_item = QTableWidgetItem(str(err.penalty))
            penalty_item.setTextAlignment(Qt.AlignCenter)

            cell_widget = QWidget()
            chk_box = QCheckBox()
            if err.is_enabled:
                chk_box.setCheckState(Qt.Checked)
            else:
                chk_box.setCheckState(Qt.Unchecked)
            chk_box.stateChanged.connect(lambda state, err=err: self.chkboxClicked(err, state))
            layout = QHBoxLayout(cell_widget)
            layout.addWidget(chk_box)
            layout.setAlignment(Qt.AlignCenter)
            cell_widget.setLayout(layout)

            self.table.setItem(idx, 0, id_item)
            self.table.setItem(idx, 1, desc_item)
            self.table.setItem(idx, 2, penalty_item)
            self.table.setCellWidget(idx, 3, cell_widget)
コード例 #6
0
ファイル: padulator.py プロジェクト: sparsile/padulator
 def addTypeBar(self,types):
     typebar = QHBoxLayout();
     typebar.addStretch(1)
     for tp in types:
         if isinstance(tp,Type):
             icon = QIcon('types/%s.png' % tp)
         elif isinstance(tp,Orb):
             icon = QIcon('orbs/%s.png' % tp)
         button = QToolButton()
         button.setIcon(icon)
         button.setCheckable(True)
         button.setContentsMargins(0,0,0,0)
         button.setFixedSize(22,22)
         button.setChecked(tp in self.skill.scope)
         def buttonFuncMaker(x):
             def buttonFunc(y):
                 if y:
                     self.skill.scope.update((x,))
                 else:
                     self.skill.scope.difference_update((x,))
                 self.skillsChanged.emit()
             return buttonFunc
         button.toggled[bool].connect(buttonFuncMaker(tp))
         typebar.addWidget(button)
     typebar.addStretch(1)
     typebar.setSpacing(0)
     typebar.setContentsMargins(0,0,0,0)
     typebar.setAlignment(Qt.AlignCenter)
     self.layout.addLayout(typebar)
コード例 #7
0
ファイル: RibbonPane.py プロジェクト: pracedru/pyDesign
 def __init__(self, parent, name):
     QWidget.__init__(self, parent)
     self.setStyleSheet(get_stylesheet("ribbonPane"))
     horizontal_layout = QHBoxLayout()
     horizontal_layout.setSpacing(0)
     horizontal_layout.setContentsMargins(0, 0, 0, 0)
     self.setLayout(horizontal_layout)
     vertical_widget = QWidget(self)
     horizontal_layout.addWidget(vertical_widget)
     horizontal_layout.addWidget(RibbonSeparator(self))
     vertical_layout = QVBoxLayout()
     vertical_layout.setSpacing(0)
     vertical_layout.setContentsMargins(0, 0, 0, 0)
     vertical_widget.setLayout(vertical_layout)
     label = QLabel(name)
     label.setAlignment(Qt.AlignCenter)
     label.setStyleSheet("color:#666;")
     content_widget = QWidget(self)
     vertical_layout.addWidget(content_widget)
     vertical_layout.addWidget(label)
     content_layout = QHBoxLayout()
     content_layout.setAlignment(Qt.AlignLeft)
     content_layout.setSpacing(0)
     content_layout.setContentsMargins(0, 0, 0, 0)
     self.contentLayout = content_layout
     content_widget.setLayout(content_layout)
コード例 #8
0
ファイル: task_widget.py プロジェクト: dagophil/mesme
    def __init__(self, task_uid, title, description, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.title = title
        self._task_uid = task_uid
        self._started = False

        # Create the layout.
        layout = QHBoxLayout()
        layout.setAlignment(Qt.AlignCenter)
        self.setLayout(layout)

        # Set the title format.
        title = "<b>%s</b>" % title

        # Create the labels and the buttons.
        delete_btn = QPushButton(text="Delete")
        delete_btn.clicked.connect(self._clicked_delete)
        title_lbl = QLabel(text=title)
        description_lbl = QLabel(text=description)
        description_lbl.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.toggle_btn = QPushButton(text="Start")
        self.toggle_btn.clicked.connect(self._clicked_toggle)
        done_btn = QPushButton(text="Done")
        done_btn.clicked.connect(self._clicked_done)

        for widget in (delete_btn, title_lbl, description_lbl, self.toggle_btn, done_btn):
            layout.addWidget(widget)
コード例 #9
0
    def _setupUi(self):
        self.setWindowTitle(self.app.NAME)
        self.resize(420, 338)
        self.centralwidget = QWidget(self)
        self.verticalLayout = QVBoxLayout(self.centralwidget)
        self.promptLabel = QLabel(tr("Select folders to scan and press \"Scan\"."), self.centralwidget)
        self.verticalLayout.addWidget(self.promptLabel)
        self.treeView = QTreeView(self.centralwidget)
        self.treeView.setSelectionMode(QAbstractItemView.ExtendedSelection)
        self.treeView.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.treeView.setAcceptDrops(True)
        triggers = QAbstractItemView.DoubleClicked | QAbstractItemView.EditKeyPressed\
            | QAbstractItemView.SelectedClicked
        self.treeView.setEditTriggers(triggers)
        self.treeView.setDragDropOverwriteMode(True)
        self.treeView.setDragDropMode(QAbstractItemView.DropOnly)
        self.treeView.setUniformRowHeights(True)
        self.verticalLayout.addWidget(self.treeView)
        hl = QHBoxLayout()
        hl.setAlignment(Qt.AlignLeft)
        label = QLabel(tr("Scan Type:"), self)
        label.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        hl.addWidget(label)
        self.scanTypeComboBox = QComboBox(self)
        self.scanTypeComboBox.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed))
        self.scanTypeComboBox.setMaximumWidth(400)
        for scan_option in self.app.model.SCANNER_CLASS.get_scan_options():
            self.scanTypeComboBox.addItem(scan_option.label)
        hl.addWidget(self.scanTypeComboBox)
        self.showPreferencesButton = QPushButton(tr("Options"), self.centralwidget)
        self.showPreferencesButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        hl.addWidget(self.showPreferencesButton)
        self.verticalLayout.addLayout(hl)
        self.horizontalLayout = QHBoxLayout()
        self.removeFolderButton = QPushButton(self.centralwidget)
        self.removeFolderButton.setIcon(QIcon(QPixmap(":/minus")))
        self.removeFolderButton.setShortcut("Del")
        self.horizontalLayout.addWidget(self.removeFolderButton)
        self.addFolderButton = QPushButton(self.centralwidget)
        self.addFolderButton.setIcon(QIcon(QPixmap(":/plus")))
        self.horizontalLayout.addWidget(self.addFolderButton)
        spacerItem1 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem1)
        self.loadResultsButton = QPushButton(self.centralwidget)
        self.loadResultsButton.setText(tr("Load Results"))
        self.horizontalLayout.addWidget(self.loadResultsButton)
        self.scanButton = QPushButton(self.centralwidget)
        self.scanButton.setText(tr("Scan"))
        self.scanButton.setDefault(True)
        self.horizontalLayout.addWidget(self.scanButton)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.setCentralWidget(self.centralwidget)

        self._setupActions()
        self._setupMenu()

        if self.app.prefs.directoriesWindowRect is not None:
            self.setGeometry(self.app.prefs.directoriesWindowRect)
        else:
            moveToScreenCenter(self)
コード例 #10
0
ファイル: SubtitleTabs.py プロジェクト: mgoral/subconvert
    def __initWidgets(self):
        minimalSizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)

        # List of subtitles
        subListDelegate = SubListItemDelegate()
        self._model = QStandardItemModel(0, 3, self)
        self._model.setHorizontalHeaderLabels([_("Begin"), _("End"), _("Subtitle")])
        self._subList = QTableView(self)
        self._subList.setModel(self._model)
        self._subList.setItemDelegateForColumn(0, subListDelegate)
        self._subList.setItemDelegateForColumn(1, subListDelegate)
        self._subList.horizontalHeader().setSectionResizeMode(2, QHeaderView.Stretch)

        self._searchBar = SearchBar(self)
        self._searchBar.hide()

        # Top toolbar
        toolbar = QHBoxLayout()
        toolbar.setAlignment(Qt.AlignLeft)
        #toolbar.addWidget(someWidget....)
        toolbar.addStretch(1)

        # Main layout
        grid = QGridLayout()
        grid.setSpacing(10)
        grid.setContentsMargins(0, 3, 0, 0)
        grid.addLayout(toolbar, 0, 0, 1, 1) # stretch to the right
        grid.addWidget(self._subList, 1, 0)
        grid.addWidget(self._searchBar, 2, 0)
        self.setLayout(grid)
コード例 #11
0
ファイル: PyQtDnd.py プロジェクト: jhavstad/model_runner
class DualFrame(QFrame):

    def __init__(self, plot_title, finish_creating_plot_gui, is_top_level):
        QFrame.__init__(self)

        self.setWindowTitle(plot_title)

        self.main_layout = QVBoxLayout(self)

        self.splitter = QSplitter()
        self.dnd_frame_1 = DndFrame('Output Graphs')
        self.dnd_frame_2 = DndFrame('Graphs to Display')

        self.splitter.addWidget(self.dnd_frame_1)
        self.splitter.addWidget(self.dnd_frame_2)

        self.main_layout.addWidget(self.splitter)

        self.button_layout = QHBoxLayout()

        self.dnd_close_button = PyQtExtras.CommandButton('Close')
        self.dnd_close_button.set_handler(self.on_close)

        self.dnd_accept_button = PyQtExtras.CommandButton('Accept')
        self.dnd_accept_button.set_handler(self.on_accept)

        self.button_layout.addWidget(self.dnd_close_button)
        self.button_layout.addWidget(self.dnd_accept_button)

        self.button_layout.setAlignment(Qt.AlignRight)

        self.main_layout.addLayout(self.button_layout)

        self.finish_creating_plot_gui = finish_creating_plot_gui

        self.is_top_level = is_top_level

        self.setMinimumSize(QSize(800, 640))

    def add_to_first(self, text):
        self.dnd_frame_1.add_label(text)

    def add_to_second(self, text):
        self.dnd_frame_2.add_label(text)

    def on_accept(self):
        plots_to_output = self.dnd_frame_1.get_output_plot_filenames()

        if self.finish_creating_plot_gui != None:
            self.finish_creating_plot_gui(plots_to_output)

        self.close()

    def on_close(self):

        self.hide()

        if self.is_top_level:
            QApplication.exit(0)
コード例 #12
0
ファイル: window_ui.py プロジェクト: smajida/detection
    def widgetSource(self):
        """Create source widget.
        """
        hbox = QHBoxLayout()
        sourceLabel = QLabel(self.tr('Source'))

        self.sourceCBox = QComboBox(self)
        self.sourcePath = QLineEdit(self)
        self.sourcePath.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Maximum)
#        self.sourcePath.setMinimumWidth(400)
        self.sourcePathButton = QPushButton('...')
        self.sourcePathButton.setMaximumWidth(40)

        self.playButton = QPushButton('')
        self.nextFrameButton = QPushButton('')
        self.refreshButton = QPushButton('')

        css = "QPushButton { border: none; }" \
            "QPushButton:pressed { border: 1px solid #555; background-color: #222; }"

        size = QtCore.QSize(23, 23)

        self.playButton.setIcon(QIcon('assets/pause.png'))
        self.playButton.setIconSize(size)
        self.playButton.setMinimumSize(size)
        self.playButton.setMaximumSize(size)
        self.playButton.setStyleSheet(css)

        self.refreshButton.setIcon(QIcon('assets/refresh.png'))
        self.refreshButton.setIconSize(size)
        self.refreshButton.setMinimumSize(size)
        self.refreshButton.setMaximumSize(size)
        self.refreshButton.setStyleSheet(css)


        self.nextFrameButton.setIcon(QIcon('assets/next.png'))
        self.nextFrameButton.setIconSize(size)
        self.nextFrameButton.setMinimumSize(size)
        self.nextFrameButton.setMaximumSize(size)
        self.nextFrameButton.setStyleSheet(css)

        self.sourceCBox.setCurrentIndex(0)

        controlsHbox = QHBoxLayout()
        controlsHbox.addWidget(self.playButton)
        controlsHbox.addWidget(self.nextFrameButton)
        controlsHbox.addWidget(self.refreshButton)
        controlsHbox.setAlignment(QtCore.Qt.AlignRight)

        hbox.addWidget(sourceLabel)
        hbox.addWidget(self.sourceCBox)
        hbox.addWidget(self.sourcePath)
        hbox.addWidget(self.sourcePathButton)
        hbox.addLayout(controlsHbox)
        hbox.setAlignment(QtCore.Qt.AlignLeft)
        return hbox
コード例 #13
0
ファイル: gallerydialog.py プロジェクト: darmstard/happypanda
	def __init__(self, parent=None, arg=None):
		super().__init__(parent, Qt.Dialog)
		self.setAttribute(Qt.WA_DeleteOnClose)
		self.parent_widget = parent
		log_d('Triggered Gallery Edit/Add Dialog')
		m_l = QVBoxLayout()
		self.main_layout = QVBoxLayout()
		dummy = QWidget(self)
		scroll_area = QScrollArea(self)
		scroll_area.setWidgetResizable(True)
		scroll_area.setFrameStyle(scroll_area.StyledPanel)
		dummy.setLayout(self.main_layout)
		scroll_area.setWidget(dummy)
		m_l.addWidget(scroll_area, 3)

		final_buttons = QHBoxLayout()
		final_buttons.setAlignment(Qt.AlignRight)
		m_l.addLayout(final_buttons)
		self.done = QPushButton("Done")
		self.done.setDefault(True)
		cancel = QPushButton("Cancel")
		final_buttons.addWidget(cancel)
		final_buttons.addWidget(self.done)

		def new_gallery():
			self.setWindowTitle('Add a new gallery')
			self.newUI()
			self.commonUI()
			self.done.clicked.connect(self.accept)
			cancel.clicked.connect(self.reject)

		if arg:
			if isinstance(arg, list):
				self.setWindowTitle('Edit gallery')
				self.position = arg[0].row()
				for index in arg:
					gallery = index.data(Qt.UserRole+1)
					self.commonUI()
					self.setGallery(gallery)
				self.done.clicked.connect(self.accept_edit)
				cancel.clicked.connect(self.reject_edit)
			elif isinstance(arg, str):
				new_gallery()
				self.choose_dir(arg)
		else:
			new_gallery()

		log_d('GalleryDialog: Create UI: successful')
		#TODO: Implement a way to mass add galleries
		#IDEA: Extend dialog in a ScrollArea with more forms...

		self.setLayout(m_l)
		self.resize(500,560)
		frect = self.frameGeometry()
		frect.moveCenter(QDesktopWidget().availableGeometry().center())
		self.move(frect.topLeft())
コード例 #14
0
ファイル: GUI_forms.py プロジェクト: DKMS-LSL/typeloader
 def fill_UI(self):
     """fills table with data
     """
     self.get_data()
     
     rows = len(self.data) + 1
     self.setRowCount(rows)
     
     self.check_dic = {}
     all_checked = True
     for (i, row) in enumerate(self.data):
         cell_widget = QWidget()
         mini_layout = QHBoxLayout(cell_widget)
         cell_widget.setLayout(mini_layout)
         self.check_dic[i] = QCheckBox(self)
         self.check_dic[i].clicked.connect(self.count_chosen)
         self.check_dic[i].clicked.connect(self.unselect_select_all)
         mini_layout.addWidget(self.check_dic[i])
         mini_layout.setAlignment(Qt.AlignCenter)
         self.setCellWidget(i, 0, cell_widget)
         for (k, item) in enumerate(row):
             self.setItem(i, k + 1, QTableWidgetItem(str(item)))
         if self.allele_status_column:
             status = row[self.allele_status_column]
             color = general.color_dic[general.allele_status_dic[status.lower()]]
             status_item = QTableWidgetItem(status)
             status_item.setBackground(QColor(color))
             if self.instant_accept_status:
                 if status == self.instant_accept_status:
                     self.check_dic[i].setChecked(True)
                     status_item.setFont(general.font_bold)
                 else:
                     all_checked = False
         self.setItem(i, self.allele_status_column + 1, status_item)
     
     # add select-all row:
     cell_widget = QWidget()
     mini_layout = QHBoxLayout(cell_widget)
     cell_widget.setLayout(mini_layout)
     self.check_all = QCheckBox(self)
     mini_layout.addWidget(self.check_all)
     if all_checked:
         self.check_all.setChecked(True)
     mini_layout.setAlignment(Qt.AlignCenter)
     self.check_all.clicked.connect(self.toggle_select_all)
     self.setCellWidget(rows-1, 0, cell_widget)
     self.setItem(rows-1, 1, QTableWidgetItem(""))
     self.setItem(rows-1, 2, QTableWidgetItem("Select All"))
     self.setItem(rows-1, 3, QTableWidgetItem(""))       
     self.setItem(rows-1, 4, QTableWidgetItem(""))
     
     self.resizeColumnsToContents()
     self.count_chosen()
コード例 #15
0
ファイル: error_han.py プロジェクト: roderickmackenzie/gpvdm
	def __init__(self,long_error,error):

		self.error=error
		self.file_path=""
		QWidget.__init__(self)
		self.setWindowTitle(_("Error"))

		self.main_vbox=QVBoxLayout()
		self.setFixedSize(800,400)
		h_widget=QWidget()
		h_box=QHBoxLayout()
		h_widget.setLayout(h_box)
		image=QLabel()
		pixmap = QPixmap(os.path.join(get_image_file_path(),"warning.png"))
		image.setPixmap(pixmap)
		h_box.addWidget(image)

		h_box.setAlignment(image,Qt.AlignTop)
		
		self.message = QTextEdit()
		help_text="<big><b>An error has occurred please report this error by clicking ok:<b></big><br><br>"
		help_text2="<br><br><big><b>It would also help if you e-mailed the error message to [email protected] and described what you were doing with the model to make it crash.  Very often there is not enough information in bug reports alone to fix the problem.<br><br>All error reports are gratefully received.<br><br>Rod 5/9/16<b></big>"
		self.message.setText(help_text+long_error+help_text2)
		h_box.addWidget(self.message)
		
		self.main_vbox.addWidget(h_widget)

		button_widget=QWidget()
		self.main_vbox.addWidget(button_widget)
		
		self.label_reporting=QLabel(_("Reporting error...."))
		self.label_reporting.hide()

		self.spin=spinner()
		self.spin.hide()
		
		okButton = QPushButton("OK")
		cancelButton = QPushButton("Cancel")

		button_layout = QHBoxLayout()
		button_layout.addWidget(self.label_reporting)
		button_layout.addWidget(self.spin)

		button_layout.addStretch(1)
		button_layout.addWidget(okButton)
		button_layout.addWidget(cancelButton)
		button_widget.setLayout(button_layout)

		self.setLayout(self.main_vbox)
	
		okButton.clicked.connect(self.on_ok_clicked) 
		cancelButton.clicked.connect(self.close_clicked)
コード例 #16
0
ファイル: mode.py プロジェクト: krassowski/Anki-Night-Mode
    def init_ui(self, title):
        self.setWindowTitle(title)

        btn_close = create_button('Close', self.close)

        buttons = QHBoxLayout()

        buttons.addWidget(btn_close)
        buttons.setAlignment(Qt.AlignBottom)

        body = QVBoxLayout()
        body.setAlignment(Qt.AlignTop)

        header = QLabel(
            'If you choose an automatic (scheduled) mode '
            'the "ctrl+n" shortcut and menu checkbox for '
            'quick toggle will switch between the manual '
            'and automatic mode (when used for the first '
            'time).'
        )
        header.setWordWrap(True)

        mode_switches = QHBoxLayout()
        mode_switches.addWidget(QLabel('Mode:'))
        self.manual = create_button('Manual', self.on_set_manual)
        self.auto = create_button('Automatic', self.on_set_automatic)
        mode_switches.addWidget(self.manual)
        mode_switches.addWidget(self.auto)

        time_controls = QHBoxLayout()
        time_controls.setAlignment(Qt.AlignTop)

        start_at = TimeEdit(self, self.settings['start_at'], 'From', self.start_update)
        end_at = TimeEdit(self, self.settings['end_at'], 'To', self.end_update)
        time_controls.addWidget(start_at)
        time_controls.addWidget(end_at)

        self.time_controls = time_controls

        self.set_mode(self.settings['mode'], False)

        body.addWidget(header)
        body.addStretch(1)
        body.addLayout(mode_switches)
        body.addLayout(time_controls)
        body.addStretch(1)
        body.addLayout(buttons)
        self.setLayout(body)

        self.setGeometry(300, 300, 470, 255)
        self.show()
コード例 #17
0
ファイル: pk-tool.py プロジェクト: geworfener/pk-tool
    def add_row(self, student=None):
        if not student:
            self.write_lock = True

        idx = self.table_widget.rowCount()
        self.table_widget.setRowCount(idx + 1)

        if student:
            name_item = QTableWidgetItem(student.name)
            name_item.setFlags(name_item.flags() & ~QtCore.Qt.ItemIsEditable)
        else:
            name_item = QTableWidgetItem()
        self.table_widget.setItem(idx, 0, name_item)

        if student:
            matrikelnr_item = QTableWidgetItem(student.matrikelnr)
            matrikelnr_item.setFlags(matrikelnr_item.flags() & ~QtCore.Qt.ItemIsEditable)
        else:
            matrikelnr_item = QTableWidgetItem()
        matrikelnr_item.setTextAlignment(QtCore.Qt.AlignCenter)
        self.table_widget.setItem(idx, 1, matrikelnr_item)

        if student:
            group_item = QTableWidgetItem(self.files_combobox.currentText())
            group_item.setFlags(matrikelnr_item.flags() & ~QtCore.Qt.ItemIsEditable)
        else:
            group_item = QTableWidgetItem()
        group_item.setTextAlignment(QtCore.Qt.AlignCenter)
        self.table_widget.setItem(idx, 2, group_item)

        check_item = QWidget()
        chk_bx = QCheckBox()
        chk_bx.setCheckState(QtCore.Qt.Unchecked)
        chk_bx.stateChanged.connect(self.attendance_changed)
        lay_out = QHBoxLayout(check_item)
        lay_out.addWidget(chk_bx)
        lay_out.setAlignment(QtCore.Qt.AlignCenter)
        lay_out.setContentsMargins(0,0,0,0)
        check_item.setLayout(lay_out)
        self.checked_list.append(chk_bx)
        self.table_widget.setCellWidget(idx, 3, check_item)

        adhoc_item = QTableWidgetItem()
        adhoc_item.setTextAlignment(QtCore.Qt.AlignCenter)
        self.table_widget.setItem(idx, 4, adhoc_item)

        self.table_widget.setItem(idx, 5, QTableWidgetItem())

        if not student:
            self.write_lock = False
コード例 #18
0
ファイル: FrameSelecter.py プロジェクト: 3qwasd/jobs
	def __init__(self):
		super(ToggleToolBar, self).__init__()
		self.setFixedSize(300,560)
		self.container = QVBoxLayout()
		self.container.setAlignment(Qt.AlignLeft)
		self.container.setSpacing(5)
		for i in range(0,self.maxRow):
			row = QHBoxLayout()
			row.setAlignment(Qt.AlignTop)
			row.setSpacing(5)
			self.container.addLayout(row)
			self.rows.append(row)
		self.buttonGroup = QButtonGroup()
		self.buttonGroup.setExclusive(False)
		self.setLayout(self.container)
		self.buttonGroup.buttonClicked[int].connect(self.imageSelected)
コード例 #19
0
    def init_ui(self, title):
        self.setWindowTitle(title)

        btn_close = create_button('Close', self.close)

        buttons = QHBoxLayout()

        buttons.addWidget(btn_close)
        buttons.setAlignment(Qt.AlignBottom)

        body = QVBoxLayout()
        body.setAlignment(Qt.AlignTop)

        header = QLabel(_(
            'Select which parts of Anki should be displayed '
            'in eye-friendly, dark colors.\n\n'
            'To disable all dialog windows, '
            'use the "Enable in dialogs" switch which is available in menu.'
        ))
        header.setAlignment(Qt.AlignCenter)

        stylers = QVBoxLayout()
        stylers.setAlignment(Qt.AlignTop)

        for styler in sorted(self.all_stylers, key=lambda s: s.name):
            styler_checkbox = StylerCheckButton(self, styler)
            self.stylers_checkboxes.append(styler_checkbox)
            stylers.addWidget(styler_checkbox)

        self.stylers_layout = stylers

        checked_boxes = sum(1 for checkbox in self.stylers_checkboxes if checkbox.isChecked())
        check_all = QCheckBox(_('Check/uncheck all'), self)
        check_all.setChecked(checked_boxes > len(self.stylers_checkboxes) / 2)
        check_all.stateChanged.connect(self.check_uncheck_all)

        body.addWidget(header)
        body.addWidget(check_all)
        body.addLayout(stylers)
        body.addStretch(1)
        body.addLayout(buttons)
        self.setLayout(body)

        self.setGeometry(300, 300, 350, 300)
        self.show()
コード例 #20
0
ファイル: configure_dialog.py プロジェクト: jeevanu/moulder
    def _init_ui(self):
        self.regular_grid_btn = QRadioButton("Regular grid (in meters)")
        self.regular_grid_btn.setChecked(True)
        self.custom_grid_btn = QRadioButton("Custom grid")
        self.from_input = QLineEdit()
        self.to_input = QLineEdit()
        self.step_input = QLineEdit()
        self.height_input = QLineEdit()
        self.apply_btn = QPushButton("Apply Changes")
        self.cancel_btn = QPushButton("Cancel")
        self.apply_btn.setDefault(True)

        bold_font = QFont()
        bold_font.setBold(True)

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

        grid = QGridLayout()
        grid.setContentsMargins(25, 0, 0, 0)
        grid.addWidget(QLabel("From:"), 0, 0)
        grid.addWidget(self.from_input, 0, 1)
        grid.addWidget(QLabel("To:"), 0, 2)
        grid.addWidget(self.to_input, 0, 3)
        grid.addWidget(QLabel("Step:"), 0, 4)
        grid.addWidget(self.step_input, 0, 5)
        grid.addWidget(QLabel("Meassurement Height:"), 1, 0)
        grid.addWidget(self.height_input, 1, 1, 1, 5)
        layout.addLayout(grid)

        layout.addWidget(self.custom_grid_btn)

        hbox = QHBoxLayout()
        hbox.setAlignment(Qt.AlignRight)
        hbox.addWidget(self.cancel_btn)
        hbox.addWidget(self.apply_btn)
        layout.addLayout(hbox)

        self.setLayout(layout)
コード例 #21
0
	def setup_ui(self):
		content = QVBoxLayout()
		content.addWidget(QLabel('{}:'.format(self.tr('Title'))), alignment=Qt.AlignLeft)
		content.addWidget(self.title_input)
		content.addWidget(QLabel('{}:'.format(self.tr('Description (optional)'))), alignment=Qt.AlignLeft)
		content.addWidget(self.description_input)
		content.addWidget(QLabel('{}:'.format(self.tr('Date'))), alignment=Qt.AlignLeft)
		content.addWidget(self.date_input)
		content.addWidget(QLabel('{}:'.format(self.tr('Time'))), alignment=Qt.AlignLeft)
		content.addWidget(self.time_input)
		self.repeat_weekly_input.setChecked(False)
		content.addWidget(self.repeat_weekly_input)

		buttons = QHBoxLayout()
		buttons.setAlignment(Qt.AlignRight | Qt.AlignBottom)
		buttons.addWidget(PushButton(self.tr('Save'), 90, 30, self.save_event_click), 0, Qt.AlignRight)
		self.del_btn = PushButton(self.tr('Delete'), 90, 30, self.delete_event)
		buttons.addWidget(self.del_btn)
		buttons.addWidget(PushButton(self.tr('Cancel'), 90, 30, self.close), 0, Qt.AlignRight)
		content.addLayout(buttons)

		self.setLayout(content)
コード例 #22
0
    def _setLayout(self):
        mainLayout = QVBoxLayout()
        mainLayout.addItem(QSpacerItem(10, 10))
        mainLayout.setSpacing(15)
        mainLayout.addLayout(self.input_layout)
        mainLayout.addItem(QSpacerItem(10, 20))

        hlayout = QHBoxLayout()
        hlayout.addItem(QSpacerItem(30, 1))
        hlayout.addWidget(self.btnOpenPolyline)
        hlayout.addWidget(self.polygonNameBox)
        mainLayout.addLayout(hlayout)
        mainLayout.addItem(QSpacerItem(10, 10))
        mainLayout.addStretch()

        glayout = QGridLayout()
        glayout.addWidget(QLabel('     Select the flux to compute'), 1, 1)
        glayout.addWidget(self.fluxBox, 1, 2)
        hlayout = QHBoxLayout()
        hlayout.addWidget(QLabel('Time sampling frequency'))
        hlayout.addWidget(self.timeSampling)
        hlayout.setAlignment(self.timeSampling, Qt.AlignLeft)
        hlayout.addStretch()
        glayout.addLayout(hlayout, 2, 2)

        glayout.setAlignment(Qt.AlignLeft)
        glayout.setSpacing(10)
        mainLayout.addLayout(glayout)

        hlayout = QHBoxLayout()
        hlayout.addItem(QSpacerItem(30, 1))
        hlayout.addWidget(self.btnSubmit)
        hlayout.addWidget(self.csvNameBox)
        mainLayout.addLayout(hlayout)
        mainLayout.addStretch()
        mainLayout.addItem(QSpacerItem(10, 15))
        mainLayout.addWidget(QLabel('   Message logs'))
        mainLayout.addWidget(self.logTextBox.widget)
        self.setLayout(mainLayout)
コード例 #23
0
    def FormatBottomButtonRow(self, total_page_layout):
        from PyQt5.QtWidgets import QHBoxLayout, QVBoxLayout, QSpacerItem
        from PyQt5.QtCore import Qt

        self.netting_values_button = QPushButton('Edit Netting Values')
        self.netting_values_button.clicked.connect(
            self.on_netting_values_clicked)

        self.update_button = QPushButton('Update Page')
        self.update_button.clicked.connect(self.on_update_clicked)

        button_layout = QHBoxLayout()
        button_layout.addWidget(self.netting_values_button)
        button_layout.addSpacerItem(QSpacerItem(self.width() / 2, 0))
        button_layout.addWidget(self.update_button)

        button_layout.setAlignment(Qt.AlignCenter)

        total_page_layout.addSpacerItem(QSpacerItem(0, self.height() / 15))
        total_page_layout.addLayout(button_layout)

        return total_page_layout
コード例 #24
0
	def __init__(self):
		super().__init__()
		self.l_freq = 0.1
		self.h_freq = 12.

		self.l_freq_field = style.create_field(str(self.l_freq))
		self.h_freq_field = style.create_field(str(self.h_freq))


		box = gui.widgetBox(self.controlArea, "Info")
		box.setAlignment(Qt.AlignCenter)
		self.info = gui.widgetLabel(box, 'Fill the lower and upper pass-band edge.')
		gui.separator(self.controlArea)

		self.field_layout = QGridLayout()
		gui.widgetBox(self.controlArea, margin=10, orientation=self.field_layout)

		l_freq_label = QLabel("The lower pass-band edge.")
		l_freq_label.setFont(QFont("Helvetica", pointSize=11))
		l_freq_label.setAlignment(Qt.AlignCenter)
		self.field_layout.addWidget(l_freq_label)
		self.field_layout.addWidget(self.l_freq_field)

		h_freq_label = QLabel("The upper pass-band edge.")
		h_freq_label.setFont(QFont("Helvetica", pointSize=11))
		h_freq_label.setAlignment(Qt.AlignCenter)
		self.field_layout.addWidget(h_freq_label)
		self.field_layout.addWidget(self.h_freq_field)

		layout = QHBoxLayout()
		layout.setAlignment(Qt.AlignCenter)
		gui.widgetBox(self.controlArea, orientation=layout)

		save_btn = QPushButton("Save")
		save_btn.clicked.connect(self.save_values)
		save_btn.setStyleSheet(style.btn_success)
		save_btn.setMinimumSize(QSize(90, 25))
		save_btn.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
		layout.addWidget(save_btn)
コード例 #25
0
    def loadMainMenu(self):
        # ---- Initialize smallest components ---------------------------------------------------------------------
        button_list = []
        button_list.append(
            self.make_button('Commands', self.switch_commands,
                             'Go to Commands Menu'))
        button_list.append(
            self.make_button('Settings', self.switch_settings,
                             'Go to Settings Menu'))
        button_list.append(
            self.make_button('About', self.switch_about,
                             'Information about this software'))
        button_list.append(
            self.make_button('Quit', self.onClickQuit, 'Exit the Application'))

        # ---- Button Container -----------------------------------------------------------------------------------

        # setup layout for the buttons
        layout_buttons = QVBoxLayout()
        layout_buttons.setAlignment(Qt.AlignCenter)
        layout_buttons.setSpacing(0)
        layout_buttons.setContentsMargins(0, 0, 0, 0)
        for button in button_list:
            layout_buttons.addWidget(button)

        container_buttons = QWidget()
        container_buttons.setLayout(layout_buttons)

        # ---- Main Container -----------------------------------------------------------------------------------

        # add components to main layout
        layout_main = QHBoxLayout()
        layout_main.setAlignment(Qt.AlignCenter)
        layout_main.addWidget(container_buttons)

        # widget to be returned
        container_main = QWidget()
        container_main.setLayout(layout_main)
        return container_main
コード例 #26
0
    def __init__(self):
        super().__init__()
        self.setGeometry(100, 200, 1024, 600)
        # In reality we should set it properly with
        # setMinimum/MaximumSize() functions, based on the plot size
        self.setFixedSize(QSize(1024, 600))

        self._example_descriptions = []

        with open(path.join(path.dirname(path.realpath(__file__)), "..", "./examples", "notes")) as nf:
            notes_reader = reader(nf, delimiter=",")

            for note in notes_reader:
                self._example_descriptions.append({"file": note[0], "label": note[1], "description": note[2]})
        
        self._total_examples = len(self._example_descriptions)
        self._current_example = 0

        example_layout = QVBoxLayout()
        self._plot_label = QLabel()
        example_layout.addWidget(self._plot_label)
        nav_box = QHBoxLayout()
        nav_box.setAlignment(Qt.AlignRight)
        self._description_label = QLabel()
        nav_box.addWidget(self._description_label)
        self._prev_button = QPushButton()
        self._prev_button.setText("<")
        self._prev_button.clicked.connect(self._previous_press)
        self._prev_button.setFixedWidth(100)
        nav_box.addWidget(self._prev_button)
        self._next_button = QPushButton()
        self._next_button.setText(">")
        self._next_button.clicked.connect(self._next_press)
        self._next_button.setFixedWidth(100)
        nav_box.addWidget(self._next_button)
        example_layout.addLayout(nav_box)
        self.setLayout(example_layout)

        self._show_example()
コード例 #27
0
    def __init__(self, plot_widget_item: PlotWidgetItem, plot_control: PlotConfig):
        super().__init__()
        self._plot_widget_item = plot_widget_item
        self._plot_control = plot_control
        self._enabled = True

        entry_layout = QHBoxLayout()
        entry_layout.setAlignment(Qt.AlignLeft)
        self.setLayout(entry_layout)

        self._name_label = QLabel(plot_widget_item.name)
        self._enabled_box = QCheckBox(checked=True)
        self._enabled_box.stateChanged.connect(self._enabled_changed_)

        entry_layout.addWidget(self._name_label)
        entry_layout.addWidget(self._enabled_box)

        if plot_widget_item.allow_remove:
            remove_button = QPushButton('x')
            remove_button.clicked.connect(self._remove_)
            remove_button.setFixedWidth(20)
            entry_layout.addWidget(remove_button)
コード例 #28
0
    def _createGUI(self, tableView):

        self.lblInfo = QLabel("")

        self.ledFilePath = QLineEdit()
        self.ledFilePath.setFixedHeight(24)
        self.ledFilePath.setReadOnly(True)

        self.btnBack = QPushButton()
        self.btnBack.setIcon(QIcon('img/up_arrow.png'))
        self.btnBack.setFixedSize(30, 26)
        self.btnCancel = QPushButton("Cancel")
        self.btnCancel.setFixedWidth(90)
        self.btnSelect = QPushButton("Select")
        self.btnSelect.setFixedWidth(90)

        self.tableView = tableView

        layout = QVBoxLayout()

        firstLayout = QHBoxLayout()
        firstLayout.addWidget(self.btnBack)
        firstLayout.addWidget(self.ledFilePath)

        layout.addLayout(firstLayout)

        layout.addWidget(self.tableView)

        secondLayout = QHBoxLayout()

        secondLayout.addWidget(self.btnSelect)
        secondLayout.addWidget(self.btnCancel)
        secondLayout.setAlignment(Qt.AlignRight)
        layout.addLayout(secondLayout)

        layout.addWidget(self.lblInfo)

        layout.setAlignment(Qt.AlignTop)
        self.setLayout(layout)
コード例 #29
0
ファイル: owPlotWelchPSD.py プロジェクト: Iopi/orange3-eeg
    def __init__(self):
        super().__init__()

        box = gui.widgetBox(self.controlArea, "Info")
        box.setAlignment(Qt.AlignCenter)
        self.info = gui.widgetLabel(box, 'Plot PSD Welch.')
        gui.separator(self.controlArea)

        self.field_layout = QGridLayout()
        gui.widgetBox(self.controlArea,
                      margin=10,
                      orientation=self.field_layout)

        layout = QHBoxLayout()
        layout.setAlignment(Qt.AlignCenter)
        gui.widgetBox(self.controlArea, orientation=layout)

        self.show_plot_btn = QPushButton("Show plot")
        self.show_plot_btn.setEnabled(False)
        self.show_plot_btn.setMinimumSize(QSize(120, 25))
        self.show_plot_btn.clicked.connect(self.plotPSD)
        layout.addWidget(self.show_plot_btn)
コード例 #30
0
    def __init__(self, pt, parent=None):
        super().__init__(parent)

        self.setWindowTitle("Pathed-GPU")

        self.timer = QTimer(self)
        self.timer.timeout.connect(self.update)
        self.timer.start(100)

        self.pt = pt
        self.model = self.pt.getSceneModel()

        layout = QHBoxLayout()

        self.gl = RenderWidget(self.pt, self)
        layout.addWidget(self.gl)
        layout.setAlignment(self.gl, Qt.AlignTop)

        self.sidebar = SidebarWidget(self.model, self)
        layout.addWidget(self.sidebar)

        self.setLayout(layout)
コード例 #31
0
    def init_ui(self, title):
        self.setWindowTitle(title)

        btn_close = create_button('Close', self.close)

        buttons = QHBoxLayout()

        buttons.addWidget(btn_close)
        buttons.setAlignment(Qt.AlignBottom)

        body = QVBoxLayout()
        body.setAlignment(Qt.AlignTop)

        header = QLabel(
            'Select which parts of Anki should be displayed '
            'in eye-friendly, dark colors.\n\n'
            'To disable all dialog windows, '
            'use the "Enable in dialogs" switch which is available in menu.'
        )
        header.setAlignment(Qt.AlignCenter)

        stylers = QVBoxLayout()
        stylers.setAlignment(Qt.AlignTop)

        for styler in self.all_stylers:
            styler_checkbox = StylerCheckButton(self, styler)
            stylers.addWidget(styler_checkbox)

        self.stylers_checkboxes = stylers

        body.addWidget(header)
        body.addLayout(stylers)
        body.addStretch(1)
        body.addLayout(buttons)
        self.setLayout(body)

        self.setGeometry(300, 300, 350, 300)
        self.show()
コード例 #32
0
class ChooseScreen(QFrame):

    def __init__(self, parent): # constructor
        super().__init__(parent)
        self.windowClass = parent # allows calling of parent class methods
        self.setStyleSheet(open('css/window.css').read())
        self.initScreen()

    def initScreen(self): # gui
        QtGui.QFontDatabase.addApplicationFont("fonts\Lora\static\Lora-Regular.ttf")
        
        self.verticalBox = QVBoxLayout()
        self.verticalBox.setAlignment(QtCore.Qt.AlignTop)
        self.upperHBox = QHBoxLayout()
        self.upperHBox.setAlignment(QtCore.Qt.AlignCenter)
        self.middleHBox = QHBoxLayout()
        self.middleHBox.setAlignment(QtCore.Qt.AlignCenter)
        self.middleHBox.setSpacing(50)
        self.middleHBox.setContentsMargins(50, 50, 50, 50)
        self.lowerHBox = QHBoxLayout()
        self.lowerHBox.setAlignment(QtCore.Qt.AlignRight)
        self.upperHBox.addSpacing(122)

        self.headerLabel = QLabel('What Game?', self)
        self.headerLabel.setStyleSheet(open("css/headerLabels.css").read())
        self.headerLabel.setFixedSize(490,195)
        self.upperHBox.addWidget(self.headerLabel)

        self.mtgButton = QPushButton('', self)
        self.mtgButton.setFixedSize(350,350)
        self.mtgButton.setStyleSheet(open('css/mtgButton.css').read())
        self.mtgButton.clicked.connect(self.containerScreenEvent)
        self.middleHBox.addWidget(self.mtgButton)

        self.soonButton = QPushButton('Coming Soon...?', self) 
        self.soonButton.setFixedSize(350,350)
        self.soonButton.setStyleSheet(open('css/bigButtons.css').read())
        self.soonButton.setEnabled(False)
        self.middleHBox.addWidget(self.soonButton)

        self.backButton = QPushButton('\u21A9', self) 
        self.backButton.setFixedSize(50,50)
        self.backButton.setStyleSheet(open('css/returnButtons.css').read())
        self.backButton.clicked.connect(self.launchScreenEvent)
        self.lowerHBox.addWidget(self.backButton)

        self.verticalBox.addLayout(self.upperHBox)
        self.verticalBox.addLayout(self.middleHBox)
        self.verticalBox.addSpacing(999999) # large number to ensure max distance
        self.verticalBox.addLayout(self.lowerHBox)
        self.setLayout(self.verticalBox)

    # navigation events
    def launchScreenEvent(self):
        self.windowClass.launchScreen() 
    
    def containerScreenEvent(self):
        self.windowClass.containerScreen() 
コード例 #33
0
    def __init__(self, *args, **kwargs):
        super(ModuleWidget, self).__init__(*args, **kwargs)
        self.setAttribute(Qt.WA_StyledBackground, True)
        main_layout = QVBoxLayout()
        main_layout.setContentsMargins(QMargins(1, 1, 1, 1))
        main_layout.setSpacing(0)
        title_layout = QHBoxLayout()
        title_layout.setContentsMargins(QMargins(8, 0, 8, 0))
        title_layout.setAlignment(Qt.AlignVCenter)
        self.title_label = QLabel(self)
        self.title_label.setFixedHeight(40)  # 固定标题高度
        self.title_label.setObjectName("titleLabel")
        title_layout.addWidget(self.title_label)
        title_layout.addStretch()
        self.more_button = QPushButton("更多>>", self)
        self.more_button.setCursor(Qt.PointingHandCursor)
        title_layout.addWidget(self.more_button)
        main_layout.addLayout(title_layout)
        # 分割线
        h_line = QFrame(self)
        h_line.setLineWidth(2)
        h_line.setFrameStyle(QFrame.HLine | QFrame.Plain)
        h_line.setStyleSheet("color:rgb(228,228,228)")
        main_layout.addWidget(h_line)

        content_layout = QVBoxLayout()
        content_layout.setContentsMargins(QMargins(8, 3, 8, 8))
        self.content_table = ModuleWidgetTable(self)
        content_layout.addWidget(self.content_table)
        main_layout.addLayout(content_layout)

        self.setLayout(main_layout)
        self.more_button.setObjectName("moreButton")
        self.setStyleSheet(
            "#titleLabel{color:rgb(233,66,66);font-size:15px;font-weight:bold}"
            "#moreButton{border:none;font-size:12px;color:rgb(104,104,104)}"
            "#moreButton:hover{color:rgb(233,66,66)}"
        )
コード例 #34
0
    def init_ui(self, title):
        self.setWindowTitle(_(title))

        btn_add_mapping = create_button('+ Add colors mapping', self.on_add)
        btn_close = create_button('Close', self.close)

        buttons = QHBoxLayout()

        buttons.addWidget(btn_close)
        buttons.addWidget(btn_add_mapping)
        buttons.setAlignment(Qt.AlignBottom)

        body = QVBoxLayout()
        body.setAlignment(Qt.AlignTop)

        header = QLabel(_(
            'Specify how particular colors on your cards '
            'should be swapped when the night mode is on.'
        ))
        header.setAlignment(Qt.AlignCenter)

        mappings = QVBoxLayout()
        mappings.setAlignment(Qt.AlignTop)

        for normal_color, night_color in self.color_map.items():
            mapping = ColorMapping(self, normal_color, night_color)
            mappings.addWidget(mapping)

        self.mappings = mappings

        body.addWidget(header)
        body.addLayout(mappings)
        body.addStretch(1)
        body.addLayout(buttons)
        self.setLayout(body)

        self.setGeometry(300, 300, 350, 300)
        self.show()
コード例 #35
0
  def create_my_workouts(self):
    frame = QFrame()
    frame.setFrameStyle(QFrame.StyledPanel)
    
    layout = QVBoxLayout()

    self.workouts_layout = QVBoxLayout()
    self.workouts_layout.setAlignment(Qt.AlignTop)

    label_layout = QHBoxLayout()
    label_layout.setAlignment(Qt.AlignCenter)
    label = QLabel("My Workouts")
    label.setFont(QFont("Ariel", 18, weight=QFont.Bold))
    label_layout.addWidget(label)
    self.workouts_layout.addLayout(label_layout)

    if len(self.fetched_my_workouts.keys()) > 0:
      self.buttons = [None] * len(self.fetched_my_workouts.keys())
      
      for i, workout in enumerate(self.fetched_my_workouts.keys()):
        self.buttons[i] = QPushButton(workout)
        self.buttons[i].setProperty("button_index", i)
        self.buttons[i].clicked.connect(partial(self.select_button, self.buttons[i].property("button_index")))
        self.workouts_layout.addWidget(self.buttons[i])
    
    buttons_layout = QHBoxLayout()
    create_new_workout_button = QPushButton("Create New Workout")
    create_new_workout_button.clicked.connect(lambda: self.create_new_workout())
    edit_workout_button = QPushButton("Edit Workout")
    edit_workout_button.clicked.connect(lambda: self.edit_workout())
    buttons_layout.addWidget(create_new_workout_button)
    buttons_layout.addWidget(edit_workout_button)
    
    layout.addLayout(self.workouts_layout)
    layout.addLayout(buttons_layout)
    frame.setLayout(layout)

    return frame
コード例 #36
0
    def addPortfolioLyt(self, name: str, path: str):
        """ Displays new portfolio """
        portfolio_lyt = QHBoxLayout()
        portfolio_lyt.setAlignment(Qt.AlignHCenter)

        bttn = OpenPortfolioButton(name, path)
        bttn.toggled.connect(lambda: self.goToPortfolio(bttn))
        portfolio_lyt.addWidget(bttn)

        portfolio_path_label = QLabel(path)
        portfolio_path_label.setFont(LightFont())
        portfolio_path_label.setFixedWidth(500)
        portfolio_lyt.addWidget(portfolio_path_label)

        db_version = confighandler.get_database_version(path)
        portfolio_version_label = QLabel(db_version)
        portfolio_version_label.setFixedWidth(60)
        portfolio_lyt.addWidget(portfolio_version_label)

        del_bttn = DeletePortfolioButton(name, path)

        del_bttn.clicked.connect(
            lambda: self.openDeletePortfolioDialog(name))
        del_bttn.deleted.connect(lambda: self.deletePortfolioLyt(name))
        portfolio_lyt.addWidget(del_bttn)

        self.layouts_tracker[name] = (
            bttn, portfolio_path_label, portfolio_version_label, del_bttn)
        # If the database has a version that is superior to the one
        # on the app, hide open button
        if db_version == "Missing":
            bttn.set_unfunctional()
        elif db_version > confighandler.get_version():
            label = QLabel(self.tr("Update App First"))
            portfolio_lyt.addWidget(label)
            self.layouts_tracker[name].append(label)

        self.portfolios_container.addLayout(portfolio_lyt)
コード例 #37
0
ファイル: MainWidget.py プロジェクト: ropusch/StepToBum
    def initUI(self):
        self.setGeometry(self.left, self.top, self.width, self.height)

        self.recordButton = RecordButton()
        self.recordButton.clicked.connect(self.on_recordButton)

        self.playDisorder = QPushButton('Play disorder')
        self.playDisorder.setDisabled(False)
        self.playDisorder.clicked.connect(self.playSample)

        self.lcd_time_counter = TimeCounter()
        self.wavePlot = AudioWavePlot(self)

        labelsLayout = QHBoxLayout()
        labelsLayout.addWidget(self.recordButton)
        labelsLayout.addWidget(self.playDisorder)
        labelsLayout.addWidget(self.lcd_time_counter)
        labelsLayout.setAlignment(Qt.AlignLeft)

        mainLayout = QVBoxLayout(self)
        mainLayout.addLayout(labelsLayout)
        mainLayout.addWidget(self.wavePlot.toolbar)
        mainLayout.addWidget(self.wavePlot.canvas)
コード例 #38
0
ファイル: lab3.py プロジェクト: grudil/Example
    def exchange(self):
        a = GenerTable()
        a.check_file()
        alph = list(a.alphabet[:])

        a.exchange_test(self.grantFromComboBox.currentIndex(),
                        self.grantToComboBox.currentIndex())
        a.check_file()
        for row in range(len(a.name)):
            for col in range(len(alph)):
                chkBoxWidget = QWidget()
                self.chkBox = QCheckBox()

                layoutCheckBox = QHBoxLayout(chkBoxWidget)
                layoutCheckBox.addWidget(self.chkBox)
                layoutCheckBox.setAlignment(Qt.AlignLeft)
                layoutCheckBox.setContentsMargins(0, 0, 0, 0)
                if a.list[a.name[row]][col]:
                    self.chkBox.setChecked(1)
                else:
                    self.chkBox.setChecked(0)

                self.table.setCellWidget(row, col, chkBoxWidget)
コード例 #39
0
    def initUI(self):
        self.unLockBar = UnLockToolBar()

        barLayout = QHBoxLayout()
        barLayout.setAlignment(Qt.AlignHCenter)
        barLayout.addWidget(self.unLockBar)
        barLayout.setContentsMargins(0, 0, 0, 0)

        self.lrcText = DLrcText()
        lrcLayout = QHBoxLayout()
        lrcLayout.addWidget(self.lrcText)
        lrcLayout.setContentsMargins(50, 0, 50, 0)

        mainLayout = QVBoxLayout()
        mainLayout.addLayout(barLayout)
        mainLayout.addStretch()
        mainLayout.addLayout(lrcLayout)
        mainLayout.setSpacing(0)
        mainLayout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(mainLayout)

        self.unLockBar.setVisible(False)
        self.setFixedSize(901, 90)
コード例 #40
0
 def __init__(self):
     QWidget.__init__(self)
     self.placeholder = QWidget()
     hbox = QHBoxLayout()
     hbox.setAlignment(Qt.AlignLeft)
     hbox.setSpacing(10)
     addSection = HyperLink(
         QCoreApplication.translate("PageEditor", "(+) Add Section"))
     addFullSection = HyperLink(
         QCoreApplication.translate("PageEditor",
                                    "(+) Add Full Width Section"))
     l = QVBoxLayout()
     self.layout = QVBoxLayout()
     l.addLayout(self.layout)
     l.addWidget(self.placeholder)
     hbox.addWidget(addSection)
     hbox.addWidget(addFullSection)
     self.layout.addLayout(hbox)
     self.layout.addStretch()
     self.setLayout(l)
     self.setAcceptDrops(True)
     addSection.clicked.connect(self.addNormalSection)
     addFullSection.clicked.connect(self.addFullSection)
コード例 #41
0
ファイル: components.py プロジェクト: dik-b/bauh
    def __init__(self,
                 icon_path: str,
                 action,
                 background: str = None,
                 align: int = Qt.AlignCenter,
                 tooltip: str = None):
        super(IconButton, self).__init__()
        self.bt = QToolButton()
        self.bt.setIcon(QIcon(icon_path))
        self.bt.clicked.connect(action)

        if background:
            self.bt.setStyleSheet('QToolButton { color: white; background: ' +
                                  background + '}')

        if tooltip:
            self.bt.setToolTip(tooltip)

        layout = QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setAlignment(align)
        layout.addWidget(self.bt)
        self.setLayout(layout)
コード例 #42
0
ファイル: mainWindow.py プロジェクト: JYUBBSTeam/Calculator
    def set_form_layout(self):
        """

        :return:
        """
        all_layout = QHBoxLayout()
        all_layout.setSpacing(0)
        self.setLayout(all_layout)

        splitter = QSplitter(Qt.Vertical)
        splitter.addWidget(self.topBar)
        splitter.addWidget(self.messageEdit)

        all_layout.addWidget(self.leftBar)
        all_layout.addWidget(splitter)
        all_layout.addWidget(self.rightBar)

        top_bar_layout = QHBoxLayout()
        self.topBar.setLayout(top_bar_layout)

        top_bar_layout.setAlignment(Qt.AlignRight)
        top_bar_layout.addWidget(self.settingBtn)
        top_bar_layout.addWidget(self.minBtn)
コード例 #43
0
ファイル: components.py プロジェクト: Archman-OS/bauh
    def __init__(self, icon: QIcon, action, i18n: I18n, background: str = None, align: int = Qt.AlignCenter, tooltip: str = None, expanding: bool = False):
        super(IconButton, self).__init__()
        self.bt = QToolButton()
        self.bt.setIcon(icon)
        self.bt.clicked.connect(action)
        self.i18n = i18n
        self.default_tootip = tooltip
        self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
        self.bt.setSizePolicy(QSizePolicy.Expanding if expanding else QSizePolicy.Minimum, QSizePolicy.Minimum)

        if background:
            style = 'QToolButton { color: white; background: ' + background + '} '
            style += 'QToolButton:disabled { color: white; background: grey }'
            self.bt.setStyleSheet(style)

        if tooltip:
            self.bt.setToolTip(tooltip)

        layout = QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setAlignment(align)
        layout.addWidget(self.bt)
        self.setLayout(layout)
コード例 #44
0
ファイル: lrcwindow.py プロジェクト: binwen925/QMusic
    def initUI(self):
        self.unLockBar = UnLockToolBar()

        barLayout = QHBoxLayout()
        barLayout.setAlignment(Qt.AlignHCenter)
        barLayout.addWidget(self.unLockBar)
        barLayout.setContentsMargins(0, 0, 0, 0)

        self.lrcText = DLrcText()
        lrcLayout = QHBoxLayout()
        lrcLayout.addWidget(self.lrcText)
        lrcLayout.setContentsMargins(50, 0, 50, 0)

        mainLayout = QVBoxLayout()
        mainLayout.addLayout(barLayout)
        mainLayout.addStretch()
        mainLayout.addLayout(lrcLayout)
        mainLayout.setSpacing(0)
        mainLayout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(mainLayout)

        self.unLockBar.setVisible(False)
        self.setFixedSize(901, 90)
コード例 #45
0
ファイル: InputLine.py プロジェクト: jeremymdunne/CAW_Winder
class InputLine(QWidget):
    def __init__(self, text, deafaultValue=None, validator=None):
        super().__init__()
        self.label = QLabel(text)
        self.edit = QLineEdit(str(deafaultValue))
        if validator is not None:
            self.edit.setValidator(validator)
        self.layout = QHBoxLayout()
        self.layout.addWidget(self.label)
        self.layout.addWidget(self.edit)
        self.layout.addStretch(1)
        self.layout.setAlignment(Qt.AlignTop)
        self.layout.setAlignment(Qt.AlignLeft)
        self.setLayout(self.layout)

    def setLabel(self, text):
        self.label.text(text)

    def setValue(self, value):
        self.edit.text(value)

    def text(self):
        return self.edit.text()
コード例 #46
0
ファイル: ui_widgets.py プロジェクト: sunreef/PyIGL_viewer
    def __init__(self, text, initial_value, read_only=False):
        super().__init__()
        self.value = str(initial_value)

        label = QLabel(text, self)
        if not read_only:
            self.line_edit = QLineEdit(str(initial_value), self)
            self.line_edit.setAutoFillBackground(True)
            self.line_edit.setStyleSheet("background-color: #eeeeee")
            self.line_edit.setAlignment(Qt.AlignLeft)
            self.line_edit.editingFinished.connect(self.update_value)
        else:
            self.line_edit = QLabel(str(initial_value), self)
            self.line_edit.setAutoFillBackground(True)
            self.line_edit.setAlignment(Qt.AlignLeft)

        horizontal_layout = QHBoxLayout()
        horizontal_layout.addWidget(label)
        horizontal_layout.setAlignment(label, Qt.AlignLeft)
        horizontal_layout.addWidget(self.line_edit)
        horizontal_layout.setAlignment(self.line_edit, Qt.AlignLeft)
        horizontal_layout.setContentsMargins(2, 1, 2, 1)
        self.setLayout(horizontal_layout)
コード例 #47
0
ファイル: accounts.py プロジェクト: gyurivukman/szakdolgozat
    def _setup(self, scrollWidget):
        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)

        scroll = QScrollArea()
        scroll.setFixedHeight(680)
        scroll.setAttribute(Qt.WA_StyledBackground)
        scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        scroll.setWidgetResizable(False)

        scroll.setWidget(scrollWidget)

        controlLayout = QHBoxLayout()
        closeButton = QPushButton("Close")
        closeButton.clicked.connect(self.hide)
        closeButton.setObjectName("closeHelpButton")
        controlLayout.setAlignment(Qt.AlignRight)
        controlLayout.addWidget(closeButton)

        layout.addWidget(scroll)
        layout.addLayout(controlLayout)
        layout.addStretch(1)
        self.setLayout(layout)
コード例 #48
0
    def buildIconButtonGroup(buttonsSetting, alignment=Qt.AlignRight):
        buttonsList = QWidget()
        buttonsListLayout = QHBoxLayout()
        buttonsList.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
        buttonsListLayout.setAlignment(alignment)
        buttonsListLayout.setSpacing(0)
        buttonsListLayout.setContentsMargins(0, 0, 0, 0)
        buttonsList.setLayout(buttonsListLayout)

        for setting in buttonsSetting:
            button = IconButton(QIcon(os.path.join(picturesDir, setting["image"])),
                                buttonsList.windowHandle(),
                                buttonsList.height())
            button.setToolTip(setting["tooltip"])
            button.setFlat(True)
            if setting["checkable"]:
                button.setCheckable(True)
                button.toggled.connect(setting["action"])
            else:
                button.clicked.connect(setting["action"])
            buttonsListLayout.addWidget(button)

        return buttonsList
コード例 #49
0
 def add_line(self):
     self.table.cellChanged.disconnect()
     row = self.table.rowCount()
     self.table.setRowCount(row + 1)
     id = str(self.id)
     ck = QCheckBox()
     h = QHBoxLayout()
     h.setAlignment(Qt.AlignCenter)
     h.addWidget(ck)
     w = QWidget()
     w.setLayout(h)
     name = self.faker.name()
     score = str(random.randint(50, 99))
     add = self.faker.address()
     self.table.setItem(row, 0, QTableWidgetItem(id))
     self.table.setCellWidget(row, 1, w)
     self.table.setItem(row, 2, QTableWidgetItem(name))
     self.table.setItem(row, 3, QTableWidgetItem(score))
     self.table.setItem(row, 4, QTableWidgetItem(add))
     self.id += 1
     self.lines.append([id, ck, name, score, add])
     self.settext('自动生成随机一行数据!,checkbox设置为居中显示')
     self.table.cellChanged.connect(self.cellchange)
コード例 #50
0
    def set_image_infos(self, image_infos):
        hbox = QHBoxLayout()
        hbox.setAlignment(PyQt5.QtCore.Qt.AlignCenter)

        self.label = QLabel("Finding duplicates...")
        self.progress = QProgressBar()

        hbox.addStretch()
        hbox.addWidget(self.label)
        hbox.addWidget(self.progress)
        hbox.addStretch()

        self.setLayout(hbox)

        self.image_infos = image_infos
        self.duplicates = []
        self.find_duplicates_thread = FindDuplicatesThread(image_infos)
        self.find_duplicates_thread.imageProcessed.connect(
            self.on_image_processed)
        self.find_duplicates_thread.duplicatesFound.connect(
            self.on_duplicates_found)
        self.find_duplicates_thread.finished.connect(self.on_finished)
        self.find_duplicates_thread.start()
コード例 #51
0
    def drawWindow(self):
        VLayout = QVBoxLayout()
        titleLblStyleSheet = 'QLabel {font-weight: bold;}'

        rowLayout = QHBoxLayout()
        titleLbl = QLabel('Description:')
        titleLbl.setMinimumWidth(200)
        titleLbl.setStyleSheet(titleLblStyleSheet)
        rowLayout.addWidget(titleLbl)
        # titleLbl = QLabel('Snapshot:')
        # titleLbl.setMinimumWidth(200)
        # titleLbl.setStyleSheet(titleLblStyleSheet)
        # rowLayout.addWidget(titleLbl)
        VLayout.addLayout(rowLayout)

        rowLayout = QHBoxLayout()
        descBox = QPlainTextEdit(self.description)
        descBox.setReadOnly(True)
        rowLayout.addWidget(descBox)
        # descBox = QPlainTextEdit('')
        # rowLayout.addWidget(descBox)
        VLayout.addLayout(rowLayout)

        btnLayout = QHBoxLayout()
        btnLayout.setAlignment(Qt.AlignRight)
        self.importBtn = QPushButton("Import")
        self.importBtn.setFixedWidth(80)
        self.importBtn.clicked.connect(self.importClicked)
        btnLayout.addWidget(self.importBtn)
        self.cancelBtn = QPushButton("Cancel")
        self.cancelBtn.setFixedWidth(80)
        self.cancelBtn.clicked.connect(self.cancelClicked)
        btnLayout.addWidget(self.cancelBtn)
        VLayout.addLayout(btnLayout)
        self.statusLbl = QLabel('')
        VLayout.addWidget(self.statusLbl)
        self.setLayout(VLayout)
コード例 #52
0
ファイル: main.py プロジェクト: tstomoki/navigation_simulator
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)

        # Layout
        LeftBoxLayout  = QVBoxLayout()
        RightBoxLayout = QVBoxLayout()
        MainLayout     = QHBoxLayout()
        LeftBoxLayout.setAlignment(Qt.AlignTop)
        RightBoxLayout.setAlignment(Qt.AlignTop)
        MainLayout.setAlignment(Qt.AlignTop)
        
        # for matplotlib graph
        self.MatplotlibWindow = MatplotlibWindow(width=200,height=200)
        LeftBoxLayout.addWidget(self.MatplotlibWindow)
        
        # ComboBox
        self.combo = QComboBox(self)
        self.combo.addItem("Ubuntu")
        self.combo.addItem("Mandriva")
        self.combo.addItem("Fedora")
        self.combo.addItem("Red Hat")
        self.combo.addItem("Gentoo")
        self.combo.activated.connect(self.onActivated)
        self.combo.activated[str].connect(self.onActivatedstr)
        RightBoxLayout.addWidget(self.combo)
        
        # button
        self.update = QPushButton("&Update")
        self.update.clicked.connect(self.update_graph)
        RightBoxLayout.addWidget(self.update)

        MainLayout.addLayout(LeftBoxLayout)
        MainLayout.addLayout(RightBoxLayout)
        
        self.setLayout(MainLayout)
        self.setWindowTitle("Matplotlib Window")
コード例 #53
0
ファイル: main_window.py プロジェクト: ProjetPC2/SIMM-2.0
    def initUI(self):

        #Création des labels
        titre = QLabel("Consultation et Modification d'un Équipement")
        titre.setFont((QFont('SansSerif', 24)))
        identifiant = QLabel('ID')
        categorie = QLabel('Catégorie')
        marque = QLabel('Marque')
        modele = QLabel('Modèle')
        numeroDeSerie = QLabel('No. de série')
        salle = QLabel('Salle')
        centreDeService = QLabel('Centre de service')
        dateDacquisititon = QLabel("Date d'acquisition")
        dateDuDernierEntretien = QLabel('Date du dernier entretien')
        provenance = QLabel('Provenance')
        etatDeService = QLabel('État de service')
        listeDesBonsDeTravail = QLabel('Liste des bons de travail')
        etatDeConservation = QLabel('État de conservation')
        commentaires = QLabel('Commentaires')


        #Création des champs d'entrée de texte
        identifiantEdit = QLineEdit()
        categorieEdit = QLineEdit()
        marqueEdit = QLineEdit()
        modeleEdit = QLineEdit()
        numeroDeSerieEdit = QLineEdit()
        salleEdit = QLineEdit()
        centreDeServiceEdit = QLineEdit()
        dateDacquisititonEdit = QLineEdit()
        dateDuDernierEntretienEdit = QLineEdit()
        provenanceEdit = QLineEdit()
        etatDeServiceEdit = QLineEdit()
        listeDesBonsDeTravailEdit = QLineEdit()
        etatDeConservationEdit = QLineEdit()


        #Création d'un champ d'entrée multiligne
        commentairesEdit = QTextEdit()

        #Création des boutons
        self.nouveauBonDeTravailButton = QPushButton("Nouveau bon de travail")
        self.nouveauBonDeTravailButton.setIcon(QtGui.QIcon("Add-icon.png"))
        self.nouveauBonDeTravailButton.setIconSize(QtCore.QSize(50, 50))

        self.modifierEquipementButton = QPushButton("Modifier l'équipement")
        self.modifierEquipementButton.setIcon(QtGui.QIcon("Modify-icon.png"))
        self.modifierEquipementButton.setIconSize(QtCore.QSize(50, 50))

        self.afficherBonDeTravailButton = QPushButton("Afficher le bon de travail sélectionné")
        self.afficherBonDeTravailButton.setIcon(QtGui.QIcon("view-icon2.png"))
        self.afficherBonDeTravailButton.setIconSize(QtCore.QSize(50, 50))

        #Création d'un layout horizontal
        hbox = QHBoxLayout()
        #hbox.addStretch(1)

        # Création d'un second layout horizontal pour le titre
        hbox2 = QHBoxLayout()
        #hbox2.addStretch(1)
        hbox2.setAlignment(Qt.AlignCenter)


        #Ajout des widget dans le layout principal
        hbox.addWidget(self.nouveauBonDeTravailButton)
        hbox.addWidget(self.modifierEquipementButton)
        hbox.addWidget(self.afficherBonDeTravailButton)

        # Ajout du label du titre dans le layout horizontal 2
        hbox2.addWidget(titre)

        #Création d'un layout vertical
        vbox = QVBoxLayout()
        vbox.addStretch(1)

        #Création d'une grid layout
        grid = QGridLayout()
        grid.setSpacing(10)

        #Postionnement des differents elements dans le grid layout
        grid.addWidget(identifiant, 1, 0)
        grid.addWidget(identifiantEdit, 1, 1)

        grid.addWidget(categorie, 2, 0)
        grid.addWidget(categorieEdit, 2, 1)

        grid.addWidget(marque, 3, 0)
        grid.addWidget(marqueEdit, 3, 1)

        grid.addWidget(modele, 4, 0)
        grid.addWidget(modeleEdit, 4, 1)

        grid.addWidget(numeroDeSerie, 5, 0)
        grid.addWidget(numeroDeSerieEdit, 5, 1)

        grid.addWidget(salle, 6, 0)
        grid.addWidget(salleEdit, 6, 1)

        grid.addWidget(centreDeService, 7, 0)
        grid.addWidget(centreDeServiceEdit, 7, 1)

        grid.addWidget(dateDacquisititon, 8, 0)
        grid.addWidget(dateDacquisititonEdit, 8, 1)

        grid.addWidget(dateDuDernierEntretien, 9, 0)
        grid.addWidget(dateDuDernierEntretienEdit, 9, 1)

        grid.addWidget(provenance, 10, 0)
        grid.addWidget(provenanceEdit, 10, 1)

        grid.addWidget(etatDeService, 11, 0)
        grid.addWidget(etatDeServiceEdit, 11, 1)

        grid.addWidget(listeDesBonsDeTravail, 12, 0)
        grid.addWidget(listeDesBonsDeTravailEdit, 12, 1)

        grid.addWidget(etatDeConservation, 13, 0)
        grid.addWidget(etatDeConservationEdit, 13, 1)

        grid.addWidget(commentaires, 14, 0)
        grid.addWidget(commentairesEdit, 14, 1, 5, 1)

        # Mise en place de la forme de la fenetre
        self.setGeometry(200, 100, 200, 1000)
        self.resize(1000, 1000)
        self.setWindowTitle("SIMM 2.0")
        self.setWindowIcon(QIcon('PC2.png'))

        # Connection des differents actions au click d'un bouton
        self.nouveauBonDeTravailButton.clicked.connect(self.NouveauBonDeTravail)

        #On ajoute la grid layout et le layout horizontal dans le layout vertical
        vbox.addLayout(hbox2)
        vbox.addLayout(hbox)
        vbox.addLayout(grid)

        #On met en place le layout
        self.setLayout(vbox)

        #Mise a jour des fenetres
        self.setGeometry(300, 300, 350, 300)
        self.setWindowTitle('PC2')
        self.show()
コード例 #54
0
ファイル: misc.py プロジェクト: gitter-badger/happypanda
	def initUI(self):
		main_layout = QVBoxLayout()

		f_web = QGroupBox("From the Web")
		f_web.setCheckable(False)
		main_layout.addWidget(f_web)
		web_layout = QHBoxLayout()
		f_web.setLayout(web_layout)

		f_local = QGroupBox("From local folder")
		f_local.setCheckable(False)
		main_layout.addWidget(f_local)
		local_layout = QHBoxLayout()
		f_local.setLayout(local_layout)

		f_series = QGroupBox("Series Info")
		f_series.setCheckable(False)
		main_layout.addWidget(f_series)
		series_layout = QFormLayout()
		f_series.setLayout(series_layout)

		def basic_web(name):
			return QLabel(name), QLineEdit(), QPushButton("Fetch")

		exh_lbl, exh_edit, exh_btn = basic_web("ExHentai:")
		web_layout.addWidget(exh_lbl, 0, Qt.AlignLeft)
		web_layout.addWidget(exh_edit, 0)
		web_layout.addWidget(exh_btn, 0, Qt.AlignRight)

		choose_folder = QPushButton("Choose Folder")
		choose_folder.clicked.connect(self.choose_dir)
		local_layout.addWidget(choose_folder, Qt.AlignLeft)

		self.title_edit = QLineEdit()
		self.title_edit.setFocus()
		self.author_edit = QLineEdit()
		self.descr_edit = QTextEdit()
		self.descr_edit.setFixedHeight(70)
		self.descr_edit.setPlaceholderText("HTML 4 tags are supported")
		self.lang_box = QComboBox()
		self.lang_box.addItems(["English", "Japanese", "Other"])
		self.lang_box.setCurrentIndex(0)
		self.tags_edit = QLineEdit()
		self.tags_edit.setPlaceholderText("namespace1:tag1, tag2, namespace3:tag3, etc..")
		self.type_box = QComboBox()
		self.type_box.addItems(["Manga", "Doujinshi", "Other"])
		self.type_box.setCurrentIndex(0)
		#self.type_box.currentIndexChanged[int].connect(self.doujin_show)
		#self.doujin_parent = QLineEdit()
		#self.doujin_parent.setVisible(False)
		self.status_box = QComboBox()
		self.status_box.addItems(["Unknown", "Ongoing", "Completed"])
		self.status_box.setCurrentIndex(0)
		self.pub_edit = QDateEdit()
		self.pub_edit.setCalendarPopup(True)
		self.pub_edit.setDate(QDate.currentDate())
		self.path_lbl = QLabel("unspecified...")
		self.path_lbl.setWordWrap(True)

		series_layout.addRow("Title:", self.title_edit)
		series_layout.addRow("Author:", self.author_edit)
		series_layout.addRow("Description:", self.descr_edit)
		series_layout.addRow("Language:", self.lang_box)
		series_layout.addRow("Tags:", self.tags_edit)
		series_layout.addRow("Type:", self.type_box)
		series_layout.addRow("Publication Date:", self.pub_edit)
		series_layout.addRow("Path:", self.path_lbl)

		final_buttons = QHBoxLayout()
		final_buttons.setAlignment(Qt.AlignRight)
		main_layout.addLayout(final_buttons)
		done = QPushButton("Done")
		done.setDefault(True)
		done.clicked.connect(self.accept)
		cancel = QPushButton("Cancel")
		cancel.clicked.connect(self.reject)
		final_buttons.addWidget(cancel)
		final_buttons.addWidget(done)


		self.setLayout(main_layout)
コード例 #55
0
ファイル: misc.py プロジェクト: gitter-badger/happypanda
	def setSeries(self, series):
		"To be used for when editing a series"
		self.series = series
		main_layout = QVBoxLayout()

		f_web = QGroupBox("Fetch metadata from Web")
		f_web.setCheckable(False)
		main_layout.addWidget(f_web)
		web_layout = QHBoxLayout()
		f_web.setLayout(web_layout)

		f_series = QGroupBox("Series Info")
		f_series.setCheckable(False)
		main_layout.addWidget(f_series)
		series_layout = QFormLayout()
		f_series.setLayout(series_layout)

		def basic_web(name):
			return QLabel(name), QLineEdit(), QPushButton("Fetch")

		exh_lbl, exh_edit, exh_btn = basic_web("ExHentai:")
		web_layout.addWidget(exh_lbl, 0, Qt.AlignLeft)
		web_layout.addWidget(exh_edit, 0)
		web_layout.addWidget(exh_btn, 0, Qt.AlignRight)

		self.title_edit = QLineEdit()
		self.title_edit.setText(series.title)
		self.author_edit = QLineEdit()
		self.author_edit.setText(series.artist)
		self.descr_edit = QTextEdit()
		self.descr_edit.setText(series.info)
		self.descr_edit.setAcceptRichText(True)
		self.descr_edit.setFixedHeight(70)
		self.lang_box = QComboBox()
		self.lang_box.addItems(["English", "Japanese", "Other"])
		if series.language is "English":
			self.lang_box.setCurrentIndex(0)
		elif series.language is "Japanese":
			self.lang_box.setCurrentIndex(1)
		else:
			self.lang_box.setCurrentIndex(2)

		self.tags_edit = QLineEdit() #TODO Finish this..
		self.tags_edit.setPlaceholderText("namespace1:tag1, tag2, namespace3:tag3, etc..")
		self.type_box = QComboBox()
		self.type_box.addItems(["Manga", "Doujinshi", "Other"])
		if series.type is "Manga":
			self.type_box.setCurrentIndex(0)
		elif series.type is "Doujinshi":
			self.type_box.setCurrentIndex(1)
		else:
			self.type_box.setCurrentIndex(2)
		#self.type_box.currentIndexChanged[int].connect(self.doujin_show)
		#self.doujin_parent = QLineEdit()
		#self.doujin_parent.setVisible(False)
		self.status_box = QComboBox()
		self.status_box.addItems(["Unknown", "Ongoing", "Completed"])
		if series.status is "Ongoing":
			self.status_box.setCurrentIndex(1)
		elif series.status is "Completed":
			self.status_box.setCurrentIndex(2)
		else:
			self.status_box.setCurrentIndex(0)

		self.pub_edit = QDateEdit() # TODO: Finish this..
		self.pub_edit.setCalendarPopup(True)
		series_pub_date = "{}".format(series.pub_date)
		qdate_pub_date = QDate.fromString(series_pub_date, "yyyy-MM-dd")
		self.pub_edit.setDate(qdate_pub_date)
		self.path_lbl = QLabel("unspecified...")
		self.path_lbl.setWordWrap(True)
		self.path_lbl.setText(series.path)

		series_layout.addRow("Title:", self.title_edit)
		series_layout.addRow("Author:", self.author_edit)
		series_layout.addRow("Description:", self.descr_edit)
		series_layout.addRow("Language:", self.lang_box)
		series_layout.addRow("Tags:", self.tags_edit)
		series_layout.addRow("Type:", self.type_box)
		series_layout.addRow("Publication Date:", self.pub_edit)
		series_layout.addRow("Path:", self.path_lbl)

		final_buttons = QHBoxLayout()
		final_buttons.setAlignment(Qt.AlignRight)
		main_layout.addLayout(final_buttons)
		done = QPushButton("Done")
		done.setDefault(True)
		done.clicked.connect(self.accept_edit)
		cancel = QPushButton("Cancel")
		cancel.clicked.connect(self.reject_edit)
		final_buttons.addWidget(cancel)
		final_buttons.addWidget(done)

		self.setLayout(main_layout)
コード例 #56
0
ファイル: padulator.py プロジェクト: sparsile/padulator
    def __init__(self):
        super().__init__()
        load_data()

        card_tags = ['leader','sub1','sub2','sub3','sub4','friend']
        self.cards = { t: CardIcon() for t in card_tags }

        self.vlayout = QVBoxLayout(self)
        self.vlayout.setSpacing(0)
        self.setLayout(self.vlayout)

        self.userbox = QHBoxLayout()
        userfield = QLineEdit()
        userbutton = QPushButton('Load')
        userbutton.clicked.connect(lambda: self.set_user(userfield.text()))
        self.userbox.addWidget(userfield)
        self.userbox.addWidget(userbutton)
        userfield.returnPressed.connect(userbutton.click)
        self.vlayout.addLayout(self.userbox)

        maxcheckbox = QCheckBox('Use maxed stats?')
        maxcheckbox.stateChanged[int].connect(self.setMaxed)
        self.vlayout.addWidget(maxcheckbox)


        self.teamchooser = QComboBox(self)
        self.teamchooser.currentIndexChanged[int].connect(self.set_team)
        self.vlayout.addWidget(self.teamchooser)

        teambox = QHBoxLayout()
        teambox.addStretch(1)
        for card in card_tags:
            teambox.addWidget(self.cards[card])

        teambox.setSpacing(0)
        teambox.addStretch(1)
        teambox.setAlignment(Qt.AlignCenter)
        self.vlayout.addLayout(teambox)

        self.board = Board()
        self.vlayout.addWidget(self.board)
        self.vlayout.itemAt(self.vlayout.indexOf(self.board)).setAlignment(Qt.AlignCenter)

        self.orbchooser = QHBoxLayout()
        b = OrbButton(value = 0)
        b.clicked.connect(functools.partial(self.setPaintOrb,Orb.Null))
        self.orbchooser.addWidget(b)
        for i in ORBS:
            b = OrbButton(value=i)
            #print('Setting click value of button %s to %s' % (id(b),i))
            b.clicked.connect(functools.partial(self.setPaintOrb,i))
            self.orbchooser.addWidget(b)

        self.vlayout.addLayout(self.orbchooser)

        self.damagereadout = QLabel()
        font = QFont()
        font.setPointSize(30)
        self.damagereadout.setAlignment(Qt.AlignCenter)
        self.damagereadout.setFont(font)
        self.vlayout.addWidget(self.damagereadout)
        self.board.valueChanged.connect(self.update_damage)

        labels = ['atk','combos','leaders','enhance','prongs','rows']
        lfont = QFont()
        lfont.setPointSize(9)
        vfont = QFont()
        vfont.setPointSize(12)
        self.details = {key: QVBoxLayout() for key in labels}
        for i in labels:
            label = QLabel(i)
            label.setFont(lfont)
            label.setAlignment(Qt.AlignCenter)
            label.setMargin(0)
            label.setContentsMargins(0,0,0,0)
            label.setIndent(0)
            self.details[i].label = label
            self.details[i].addWidget(self.details[i].label)
            value = QLabel('1')
            value.setFont(vfont)
            value.setAlignment(Qt.AlignCenter)
            value.setMargin(0)
            value.setIndent(0)
            value.setContentsMargins(0,0,0,0)
            self.details[i].value = value
            self.details[i].addWidget(self.details[i].value)
            self.details[i].setContentsMargins(1,1,1,1)

        self.detailreadout = QHBoxLayout()
        for i in labels:
            self.detailreadout.addLayout(self.details[i])
            timeslabel = QLabel('\u00d7')
            timeslabel.setMargin(0)
            timeslabel.setIndent(0)
            timeslabel.setAlignment(Qt.AlignCenter)
            timeslabel.setContentsMargins(0,0,0,0)
            self.detailreadout.addWidget(timeslabel)

        self.detailreadout.takeAt(self.detailreadout.count()-1)
        self.vlayout.addLayout(self.detailreadout)

        self.vlayout.addStretch(1000)
        self.skillbox = QHBoxLayout()
        self.vlayout.addLayout(self.skillbox)
コード例 #57
0
ファイル: widgets.py プロジェクト: curme/AutoTrading
    def atoTrdPage(self):

        for pi in range(0,len(self.pages)):
            self.toolButtons[pi].setStyleSheet(self.toolButtonHideQSS)
            self.pages[pi].hide()

        print "in monitor page"
        ci = 2
        page = self.pages[ci]
        self.toolButtons[ci].setStyleSheet(self.toolButtonFocusQSS)

        if self.pagesStatus[ci] == 0:

            if not page.layout() == None:
                while page.layout().count() > 0:
                    page.layout().takeAt(0).widget().setParent(None)

            if page.layout() == None:
                self.pageAutoTrdPageMainVerticalBox = QVBoxLayout()
                self.pageAutoTrdPageMainVerticalBox.setContentsMargins(0, 5, 0, 0)
                page.setLayout(self.pageAutoTrdPageMainVerticalBox)

            self.pageAutoTrdTitleLabel = QLabel("Monitor", page)
            self.pageAutoTrdTitleLabel.setFixedSize(860, 25)
            self.pageAutoTrdTitleLabel.setStyleSheet(self.pageTitleQSS)
            self.pageAutoTrdPageMainVerticalBox.addWidget(self.pageAutoTrdTitleLabel)

            pnlReport = self.ATM.report
            if not len(self.ATM.strategies.strategiesPool.keys()) == 0:
                self.pageAtoTrdPageScroll = QScrollArea(page)
                self.pageAtoTrdPageScroll.setWidgetResizable(True)
                self.pageAtoTrdPageScroll.setBackgroundRole(QPalette.NoRole)
                self.pageAtoTrdPageScroll.setStyleSheet("background: transparent")
                self.pageAtoTrdPageScroll.setFixedSize(860, 635)
                self.pageAtoTrdScrollContentsWidget = QWidget(page)
                scrollContentVBox = QVBoxLayout()
                scrollContentVBox.setAlignment(Qt.AlignTop)
                scrollContentVBox.setContentsMargins(0, 0, 0, 0)

                self.pageAtoTrdSignalPlotLabel = QLabel("Signals Plots", page)
                self.pageAtoTrdSignalPlotLabel.setFixedSize(860, 25)
                self.pageAtoTrdSignalPlotLabel.setStyleSheet(self.pageSubTitleQSS)
                scrollContentVBox.addWidget(self.pageAtoTrdSignalPlotLabel)

                path = "./strategies/image/"
                for file in os.listdir(path):
                    if file.endswith(".png") and file.split('.')[0] in self.ATM.strategies.strategiesPool.keys():
                        pageAtoTrdSignalPlotStrategyLabel = QLabel(file.split('.')[0], page)
                        pageAtoTrdSignalPlotStrategyLabel.setFixedSize(860, 25)
                        pageAtoTrdSignalPlotStrategyLabel.setStyleSheet(self.pageSubSubTitleQSS)
                        scrollContentVBox.addWidget(pageAtoTrdSignalPlotStrategyLabel)

                        widget = QWidget()
                        widget.setFixedHeight(300)
                        hbox = QHBoxLayout()
                        hbox.setContentsMargins(0, 0, 0, 0)
                        hbox.setAlignment(Qt.AlignCenter)
                        lbl = QLabel()
                        pixmap = QPixmap(path + file)
                        scaled_pixmap = pixmap.scaled(860, 330, Qt.KeepAspectRatio)
                        lbl.setPixmap(scaled_pixmap)
                        hbox.addWidget(lbl)
                        widget.setLayout(hbox)
                        scrollContentVBox.addWidget(widget)

                self.pageAtoTrdAllSignalsLabel = QLabel("All Signals", page)
                self.pageAtoTrdAllSignalsLabel.setFixedSize(860, 25)
                self.pageAtoTrdAllSignalsLabel.setStyleSheet(self.pageSubTitleQSS)
                scrollContentVBox.addWidget(self.pageAtoTrdAllSignalsLabel)

                self.pageAtoTrdAllSignalsTitle = QWidget(page)
                self.pageAtoTrdAllSignalsTitle.setFixedSize(860, 25)
                self.pageAtoTrdAllSignalsTitle.setStyleSheet(self.pageSubSubTitleQSS)
                titlesHBox = QHBoxLayout()
                titlesHBox.setContentsMargins(10, 0, 20, 0)
                titlesHBox.addWidget(QLabel("Code"))
                titlesHBox.addWidget(QLabel("Time"))
                titlesHBox.addWidget(QLabel("Action"))
                titlesHBox.addWidget(QLabel("Qnt"))
                titlesHBox.addWidget(QLabel("Price"))
                titlesHBox.addWidget(QLabel("Volumn"))
                titlesHBox.addWidget(QLabel("Strategy"))
                self.pageAtoTrdAllSignalsTitle.setLayout(titlesHBox)
                scrollContentVBox.addWidget(self.pageAtoTrdAllSignalsTitle)

                signals = self.ATM.strategies.signals
                if not len(signals) == 0:
                    for i in xrange(len(signals)):
                        widget = QWidget(page)
                        widget.setFixedHeight(15)
                        widget.setStyleSheet("color:#ffffff")
                        signalHBox = QHBoxLayout()
                        signalHBox.setContentsMargins(20, 0, 10, 0)
                        signalHBox.addWidget(QLabel(signals.ix[i]["Code"]))
                        signalHBox.addWidget(QLabel(str(signals.ix[i]["Time"])))
                        signalHBox.addWidget(QLabel(signals.ix[i]["Action"]))
                        signalHBox.addWidget(QLabel(str(signals.ix[i]["Qnt"])))
                        signalHBox.addWidget(QLabel(str(signals.ix[i]["Price"])))
                        signalHBox.addWidget(QLabel(str(signals.ix[i]["Volume"])))
                        signalHBox.addWidget(QLabel(signals.ix[i]["Strategy"]))
                        widget.setLayout(signalHBox)
                        scrollContentVBox.addWidget(widget)

                else:
                    widget = QLabel("No Data.")
                    widget.setFixedSize(860, 550)
                    widget.setStyleSheet(self.noDataLabelQSS)
                    widget.setAlignment(Qt.AlignCenter)
                    scrollContentVBox.addWidget(widget)

                self.pageAtoTrdScrollContentsWidget.setLayout(scrollContentVBox)
                self.pageAtoTrdPageScroll.setWidget(self.pageAtoTrdScrollContentsWidget)
                self.pageAutoTrdPageMainVerticalBox.addWidget(self.pageAtoTrdPageScroll)

            else:
                widget = QLabel("No Data.")
                widget.setFixedSize(860, 550)
                widget.setStyleSheet(self.noDataLabelQSS)
                widget.setAlignment(Qt.AlignCenter)
                self.pageAutoTrdPageMainVerticalBox.addWidget(widget)

            self.pagesStatus[ci] = 1

        page.show()
コード例 #58
0
ファイル: SearchReplaceWidget.py プロジェクト: testmana2/test
class SearchReplaceSlidingWidget(QWidget):
    """
    Class implementing the search and replace widget with sliding behavior.
    
    @signal searchListChanged() emitted to indicate a change of the search list
    """
    searchListChanged = pyqtSignal()
    
    def __init__(self, replace, vm, parent=None):
        """
        Constructor
        
        @param replace flag indicating a replace widget is called
        @param vm reference to the viewmanager object
        @param parent parent widget of this widget (QWidget)
        """
        super(SearchReplaceSlidingWidget, self).__init__(parent)
        
        self.__searchReplaceWidget = \
            SearchReplaceWidget(replace, vm, self, True)
        
        self.__layout = QHBoxLayout(self)
        self.setLayout(self.__layout)
        self.__layout.setContentsMargins(0, 0, 0, 0)
        self.__layout.setAlignment(Qt.AlignTop)
        
        self.__leftButton = QToolButton(self)
        self.__leftButton.setArrowType(Qt.LeftArrow)
        self.__leftButton.setSizePolicy(
            QSizePolicy.Minimum, QSizePolicy.MinimumExpanding)
        self.__leftButton.setAutoRepeat(True)
        
        self.__scroller = QScrollArea(self)
        self.__scroller.setWidget(self.__searchReplaceWidget)
        self.__scroller.setSizePolicy(
            QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.__scroller.setFrameShape(QFrame.NoFrame)
        self.__scroller.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.__scroller.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.__scroller.setWidgetResizable(False)
        
        self.__rightButton = QToolButton(self)
        self.__rightButton.setArrowType(Qt.RightArrow)
        self.__rightButton.setSizePolicy(
            QSizePolicy.Minimum, QSizePolicy.MinimumExpanding)
        self.__rightButton.setAutoRepeat(True)
        
        self.__layout.addWidget(self.__leftButton)
        self.__layout.addWidget(self.__scroller)
        self.__layout.addWidget(self.__rightButton)
        
        self.setMaximumHeight(self.__searchReplaceWidget.sizeHint().height())
        self.adjustSize()
        
        self.__searchReplaceWidget.searchListChanged.connect(
            self.searchListChanged)
        self.__leftButton.clicked.connect(self.__slideLeft)
        self.__rightButton.clicked.connect(self.__slideRight)
    
    def changeEvent(self, evt):
        """
        Protected method handling state changes.

        @param evt event containing the state change (QEvent)
        """
        if evt.type() == QEvent.FontChange:
            self.setMaximumHeight(
                self.__searchReplaceWidget.sizeHint().height())
            self.adjustSize()
    
    def findNext(self):
        """
        Public slot to find the next occurrence of text.
        """
        self.__searchReplaceWidget.findNext()
    
    def findPrev(self):
        """
        Public slot to find the next previous of text.
        """
        self.__searchReplaceWidget.findPrev()
    
    def selectionChanged(self):
        """
        Public slot tracking changes of selected text.
        """
        editor = self.sender()
        self.__searchReplaceWidget.updateSelectionCheckBox(editor)
    
    @pyqtSlot(Editor)
    def updateSelectionCheckBox(self, editor):
        """
        Public slot to update the selection check box.
        
        @param editor reference to the editor (Editor)
        """
        self.__searchReplaceWidget.updateSelectionCheckBox(editor)

    def show(self, text=''):
        """
        Public slot to show the widget.
        
        @param text text to be shown in the findtext edit (string)
        """
        self.__searchReplaceWidget.show(text)
        super(SearchReplaceSlidingWidget, self).show()
        self.__enableScrollerButtons()
    
    def __slideLeft(self):
        """
        Private slot to move the widget to the left, i.e. show contents to the
        right.
        """
        self.__slide(True)
    
    def __slideRight(self):
        """
        Private slot to move the widget to the right, i.e. show contents to
        the left.
        """
        self.__slide(False)
    
    def __slide(self, toLeft):
        """
        Private method to move the sliding widget.
        
        @param toLeft flag indicating to move to the left (boolean)
        """
        scrollBar = self.__scroller.horizontalScrollBar()
        stepSize = scrollBar.singleStep()
        if toLeft:
            stepSize = -stepSize
        newValue = scrollBar.value() + stepSize
        if newValue < 0:
            newValue = 0
        elif newValue > scrollBar.maximum():
            newValue = scrollBar.maximum()
        scrollBar.setValue(newValue)
        self.__enableScrollerButtons()
    
    def __enableScrollerButtons(self):
        """
        Private method to set the enabled state of the scroll buttons.
        """
        scrollBar = self.__scroller.horizontalScrollBar()
        self.__leftButton.setEnabled(scrollBar.value() > 0)
        self.__rightButton.setEnabled(scrollBar.value() < scrollBar.maximum())
    
    def resizeEvent(self, evt):
        """
        Protected method to handle resize events.
        
        @param evt reference to the resize event (QResizeEvent)
        """
        self.__enableScrollerButtons()
        
        super(SearchReplaceSlidingWidget, self).resizeEvent(evt)
コード例 #59
0
ファイル: morsetrainer.py プロジェクト: Mebus/PyMorsetrainer
    def initUI(self):
        self.centralWidget = QWidget()
        self.setCentralWidget(self.centralWidget)

        self.receivedTextEdit = QTextEdit()
        self.receivedTextEdit.setAcceptRichText(False)
        monospaceFont = QFont("Monospace")
        monospaceFont.setStyleHint(QFont.Monospace)
        self.receivedTextEdit.setFont(monospaceFont)
        
        playExerciseButton = QPushButton("Play exercise text")
        playExerciseButton.clicked.connect(self.playExercise)
        
        stopButton = QPushButton("Stop playing")
        stopButton.clicked.connect(self.stopPlaying)
        
        validateButton = QPushButton("Check input / Generate next exercise")
        validateButton.clicked.connect(self.checkInput)
        
        self.wpmLineEdit = QLineEdit("20")
        wpmLabel = QLabel("WPM")
        
        self.ewpmLineEdit = QLineEdit("15")
        ewpmLabel = QLabel("effective WPM")
        
        self.freqLineEdit = QLineEdit("800")
        freqLabel = QLabel("Frequency (Hz)")
        
        self.durationLineEdit = QLineEdit("1")
        durationLabel = QLabel("Duration (min)")
        
        lessonBox = QHBoxLayout()
        lessonBox.setAlignment(Qt.AlignLeft)
        
        lessonCombo = QComboBox()
        lessonCombo.setMaximumWidth(75)
        lessonCombo.addItem("1 - K M")
        for lesson in range(2, len(KOCH_LETTERS)):
            lessonCombo.addItem(str(lesson) + " - " + KOCH_LETTERS[lesson])
        lessonCombo.setCurrentIndex(self.lesson-1)
        lessonCombo.currentIndexChanged.connect(self.newLessonSelected)
        
        lessonIdLabel = QLabel("Lesson:")
        lessonIdLabel.setMaximumWidth(50)
        
        self.lessonLabel = QLabel(' '.join(KOCH_LETTERS[:self.lesson+1]))
        lessonBox.addWidget(lessonIdLabel)
        lessonBox.addWidget(lessonCombo)
        lessonBox.addWidget(self.lessonLabel)
        
        grid = QGridLayout()
        grid.setSpacing(10)
        grid.addWidget(self.receivedTextEdit, 1, 1, 7, 1)
        grid.addWidget(playExerciseButton, 1, 2, 1, 2)
        grid.addWidget(stopButton, 2, 2, 1, 2)
        grid.addWidget(validateButton, 3, 2, 1, 2)
        grid.addWidget(self.wpmLineEdit, 4, 2)
        grid.addWidget(wpmLabel, 4, 3)
        grid.addWidget(self.ewpmLineEdit, 5, 2)
        grid.addWidget(ewpmLabel, 5, 3)
        grid.addWidget(self.freqLineEdit, 6, 2)
        grid.addWidget(freqLabel, 6, 3)
        grid.addWidget(self.durationLineEdit, 7, 2)
        grid.addWidget(durationLabel, 7, 3)
        grid.addLayout(lessonBox, 8, 1, 1, 3)
        
        self.centralWidget.setLayout(grid)
        
        self.setWindowTitle('PyMorsetrainer')
        self.show()
コード例 #60
0
ファイル: add.py プロジェクト: z411/trackma
    def __init__(self, parent, worker, current_status, default=None):
        QDialog.__init__(self, parent)
        self.resize(950, 700)
        self.setWindowTitle('Search/Add from Remote')
        self.worker = worker
        self.current_status = current_status
        self.default = default
        if default:
            self.setWindowTitle('Search/Add from Remote for new show: %s' % default)
        
        # Get available search methods and default to keyword search if not reported by the API
        search_methods = self.worker.engine.mediainfo.get('search_methods', [utils.SEARCH_METHOD_KW])

        layout = QVBoxLayout()

        # Create top layout
        top_layout = QHBoxLayout()

        if utils.SEARCH_METHOD_KW in search_methods:
            self.search_rad = QRadioButton('By keyword:')
            self.search_rad.setChecked(True)
            self.search_txt = QLineEdit()
            self.search_txt.returnPressed.connect(self.s_search)
            if default:
                self.search_txt.setText(default)
            self.search_btn = QPushButton('Search')
            self.search_btn.clicked.connect(self.s_search)
            top_layout.addWidget(self.search_rad)
            top_layout.addWidget(self.search_txt)
        else:
            top_layout.setAlignment(QtCore.Qt.AlignRight)

        top_layout.addWidget(self.search_btn)
        
        # Create filter line
        filters_layout = QHBoxLayout()
        
        if utils.SEARCH_METHOD_SEASON in search_methods:
            self.season_rad = QRadioButton('By season:')
            self.season_combo = QComboBox()
            self.season_combo.addItem('Winter', utils.SEASON_WINTER)
            self.season_combo.addItem('Spring', utils.SEASON_SPRING)
            self.season_combo.addItem('Summer', utils.SEASON_SUMMER)
            self.season_combo.addItem('Fall', utils.SEASON_FALL)
        
            self.season_year = QSpinBox()

            today = date.today()
            current_season = (today.month - 1) / 3

            self.season_year.setRange(1900, today.year)
            self.season_year.setValue(today.year)
            self.season_combo.setCurrentIndex(current_season)

            filters_layout.addWidget(self.season_rad)
            filters_layout.addWidget(self.season_combo)
            filters_layout.addWidget(self.season_year)
        
            filters_layout.setAlignment(QtCore.Qt.AlignLeft)
            filters_layout.addWidget(QSplitter())
        else:
            filters_layout.setAlignment(QtCore.Qt.AlignRight)
        
        view_combo = QComboBox()
        view_combo.addItem('Table view')
        view_combo.addItem('Card view')
        view_combo.currentIndexChanged.connect(self.s_change_view)
        
        filters_layout.addWidget(view_combo)

        # Create central content
        self.contents = QStackedWidget()
        
        # Set up views
        tableview = AddTableDetailsView(None, self.worker)
        tableview.changed.connect(self.s_selected)
        self.contents.addWidget(tableview)
        
        cardview = AddCardView(api_info=self.worker.engine.api_info)
        cardview.changed.connect(self.s_selected)
        cardview.activated.connect(self.s_show_details)
        self.contents.addWidget(cardview)
        
        # Use for testing
        #self.set_results([{'id': 1, 'title': 'Hola', 'image': 'https://omaera.org/icon.png'}])

        bottom_buttons = QDialogButtonBox()
        bottom_buttons.addButton("Cancel", QDialogButtonBox.RejectRole)
        self.add_btn = bottom_buttons.addButton("Add", QDialogButtonBox.AcceptRole)
        self.add_btn.setEnabled(False)
        bottom_buttons.accepted.connect(self.s_add)
        bottom_buttons.rejected.connect(self.close)

        # Finish layout
        layout.addLayout(top_layout)
        layout.addLayout(filters_layout)
        layout.addWidget(self.contents)
        layout.addWidget(bottom_buttons)
        self.setLayout(layout)

        if utils.SEARCH_METHOD_SEASON in search_methods:
            self.search_txt.setFocus()