def setup_ui(self): self.splitter = QSplitter(self) self.l = l = QVBoxLayout(self) l.addWidget(self.splitter) l.addWidget(self.bb) self.w = w = QGroupBox(_('Theme Metadata'), self) self.splitter.addWidget(w) l = w.l = QFormLayout(w) self.missing_icons_group = mg = QGroupBox(self) self.mising_icons = mi = QListWidget(mg) mi.setSelectionMode(mi.NoSelection) mg.l = QVBoxLayout(mg) mg.l.addWidget(mi) self.splitter.addWidget(mg) self.title = QLineEdit(self) l.addRow(_('&Title:'), self.title) self.author = QLineEdit(self) l.addRow(_('&Author:'), self.author) self.version = v = QSpinBox(self) v.setMinimum(1), v.setMaximum(1000000) l.addRow(_('&Version:'), v) self.description = QTextEdit(self) l.addRow(self.description) self.refresh_button = rb = self.bb.addButton(_('&Refresh'), self.bb.ActionRole) rb.setIcon(QIcon(I('view-refresh.png'))) rb.clicked.connect(self.refresh) self.apply_report()
def setup_ui(self): acnames = all_actions().all_action_names self.available_actions = ActionsList(acnames - frozenset(current_actions()), parent=self) self.current_actions = ActionsList(current_actions(), parent=self, is_source=False) self.l = l = QVBoxLayout(self) self.la = la = QLabel(_('Choose the actions you want on the toolbar.' ' Drag and drop items in the right hand list to re-arrange the toolbar.')) la.setWordWrap(True) l.addWidget(la) self.bv = bv = QVBoxLayout() bv.addStretch(10) self.add_button = b = QToolButton(self) b.setIcon(QIcon(I('forward.png'))), b.setToolTip(_('Add selected actions to the toolbar')) bv.addWidget(b), bv.addStretch(10) b.clicked.connect(self.add_actions) self.remove_button = b = QToolButton(self) b.setIcon(QIcon(I('back.png'))), b.setToolTip(_('Remove selected actions from the toolbar')) b.clicked.connect(self.remove_actions) bv.addWidget(b), bv.addStretch(10) self.h = h = QHBoxLayout() l.addLayout(h) self.lg = lg = QGroupBox(_('A&vailable actions'), self) lg.v = v = QVBoxLayout(lg) v.addWidget(self.available_actions) h.addWidget(lg) self.rg = rg = QGroupBox(_('&Current actions'), self) rg.v = v = QVBoxLayout(rg) v.addWidget(self.current_actions) h.addLayout(bv), h.addWidget(rg) l.addWidget(self.bb) self.rdb = b = self.bb.addButton(_('Restore defaults'), self.bb.ActionRole) b.clicked.connect(self.restore_defaults)
def __init__(self, parent=None): QWidget.__init__(self, parent) self.l = gl = QGridLayout(self) self.setLayout(gl) self.changed = False self.bars = b = QComboBox(self) b.addItem(_('Choose which toolbar you want to customize')) ft = _('Tools for %s editors') for name, text in ( ('global_book_toolbar', _('Book wide actions'),), ('global_tools_toolbar', _('Book wide tools'),), ('global_plugins_toolbar', _('Book wide tools from third party plugins'),), ('editor_common_toolbar', ft % _('all')), ('editor_html_toolbar', ft % 'HTML',), ('editor_css_toolbar', ft % 'CSS',), ('editor_xml_toolbar', ft % 'XML',), ('editor_format_toolbar', _('Text formatting actions'),), ): b.addItem(text, name) self.la = la = QLabel(_('&Toolbar to customize:')) la.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) la.setBuddy(b) gl.addWidget(la), gl.addWidget(b, 0, 1) self.sl = l = QGridLayout() gl.addLayout(l, 1, 0, 1, -1) self.gb1 = gb1 = QGroupBox(_('A&vailable actions'), self) self.gb2 = gb2 = QGroupBox(_('&Current actions'), self) gb1.setFlat(True), gb2.setFlat(True) gb1.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) gb2.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) l.addWidget(gb1, 0, 0, -1, 1), l.addWidget(gb2, 0, 2, -1, 1) self.available, self.current = ToolbarList(self), ToolbarList(self) self.ub = b = QToolButton(self) b.clicked.connect(partial(self.move, up=True)) b.setToolTip(_('Move selected action up')), b.setIcon(QIcon(I('arrow-up.png'))) self.db = b = QToolButton(self) b.clicked.connect(partial(self.move, up=False)) b.setToolTip(_('Move selected action down')), b.setIcon(QIcon(I('arrow-down.png'))) self.gl1 = gl1 = QVBoxLayout() gl1.addWidget(self.available), gb1.setLayout(gl1) self.gl2 = gl2 = QGridLayout() gl2.addWidget(self.current, 0, 0, -1, 1) gl2.addWidget(self.ub, 0, 1), gl2.addWidget(self.db, 2, 1) gb2.setLayout(gl2) self.lb = b = QToolButton(self) b.setToolTip(_('Add selected actions to toolbar')), b.setIcon(QIcon(I('forward.png'))) l.addWidget(b, 1, 1), b.clicked.connect(self.add_action) self.rb = b = QToolButton(self) b.setToolTip(_('Remove selected actions from toolbar')), b.setIcon(QIcon(I('back.png'))) l.addWidget(b, 3, 1), b.clicked.connect(self.remove_action) self.si = QSpacerItem(20, 10, hPolicy=QSizePolicy.Preferred, vPolicy=QSizePolicy.Expanding) l.setRowStretch(0, 10), l.setRowStretch(2, 10), l.setRowStretch(4, 10) l.addItem(self.si, 4, 1) self.read_settings() self.toggle_visibility(False) self.bars.currentIndexChanged.connect(self.bar_changed)
def configWidgets(self): self.grid.setAlignment(Qt.AlignTop) self.grid.setSpacing(5) self.menu_bar = QMenuBar(self) self.database_menu = self.menu_bar.addMenu("Database") self.database_menu.addAction(self.new_db_action) self.database_menu.addSeparator() self.database_menu.addAction(self.exit_action) self.concept_menu = self.menu_bar.addMenu("Concept") self.concept_menu.addAction(self.edit_concept_action) self.concept_menu.addAction(self.delete_сoncept_action) self.concept_menu.addAction(self.delete_subcategory_action) self.relation_menu = self.menu_bar.addMenu("Relation") self.relation_menu.addAction(self.edit_relation_action) self.relation_menu.addAction(self.delete_relation_action) self.help_menu = self.menu_bar.addMenu("Help") self.help_menu.addAction(self.help_action) self.help_menu.addAction(self.about_action) self.grid.setMenuBar(self.menu_bar) self.concept_box = QGroupBox("Concepts") self.concept_grid = QGridLayout() self.concept_grid.setContentsMargins(0, 10, 0, 0) self.concept_grid.addWidget(self.concept_list) self.concept_box.setLayout(self.concept_grid) self.relation_box = QGroupBox("Relations") self.relation_grid = QGridLayout() self.relation_grid.setContentsMargins(0, 10, 0, 0) self.relation_grid.addWidget(self.relation_list) self.relation_box.setLayout(self.relation_grid) self.description_box = QGroupBox("Description") self.description_grid = QGridLayout() self.description_grid.setContentsMargins(0, 10, 0, 0) self.description_grid.addWidget(self.result_table) self.description_box.setLayout(self.description_grid) self.concept_splitter = QSplitter(self) self.concept_splitter.addWidget(self.concept_box) self.concept_splitter.addWidget(self.relation_box) self.description_splitter = QSplitter(self) self.description_splitter.setOrientation(Qt.Vertical) self.description_splitter.addWidget(self.concept_splitter) self.description_splitter.addWidget(self.description_box) self.grid.addWidget(self.add_data_button, 1, 0, Qt.AlignLeft) self.grid.addWidget(self.export_button, 1, 1, Qt.AlignRight) self.grid.addWidget(self.search_box, 2, 0, 1, 2) self.grid.addWidget(self.description_splitter, 5, 0, 1, 2) self.setLayout(self.grid)
def __init__(self, plugin_action): QWidget.__init__(self) self.plugin_action = plugin_action layout = QVBoxLayout(self) self.setLayout(layout) # --- Directory Options --- directory_group_box = QGroupBox(_('Default Unpack Directory:'), self) layout.addWidget(directory_group_box) directory_group_box_layout = QVBoxLayout() directory_group_box.setLayout(directory_group_box_layout) # Directory path Textbox # Load the textbox with the current preference setting self.directory_txtBox = QLineEdit(plugin_prefs['Unpack_Folder'], self) self.directory_txtBox.setToolTip(_('<p>Default directory to extract files to')) directory_group_box_layout.addWidget(self.directory_txtBox) self.directory_txtBox.setReadOnly(True) # Folder select button directory_button = QPushButton(_('Select/Change Unpack Directory'), self) directory_button.setToolTip(_('<p>Select/Change directory to extract files to.')) # Connect button to the getDirectory function directory_button.clicked.connect(self.getDirectory) directory_group_box_layout.addWidget(directory_button) self.default_folder_check = QCheckBox(_('Always use the Default Unpack Directory'), self) self.default_folder_check.setToolTip(_('<p>When unchecked... you will be prompted to select a destination '+ 'directory for the extracted content each time you use Mobiunpack.')) directory_group_box_layout.addWidget(self.default_folder_check) # Load the checkbox with the current preference setting self.default_folder_check.setChecked(plugin_prefs['Always_Use_Unpack_Folder']) misc_group_box = QGroupBox(_('Default settings:'), self) layout.addWidget(misc_group_box) misc_group_box_layout = QVBoxLayout() misc_group_box.setLayout(misc_group_box_layout) self.use_hd_images = QCheckBox(_('Always use HD images if present'), self) self.use_hd_images.setToolTip(_('<p>When checked... any HD images present in the kindlebook '+ 'will be used for creating the ePub.')) misc_group_box_layout.addWidget(self.use_hd_images) # Load the checkbox with the current preference setting self.use_hd_images.setChecked(plugin_prefs['Use_HD_Images']) combo_label = QLabel('Select epub version output:', self) misc_group_box_layout.addWidget(combo_label) self.epub_version_combobox = QComboBox() self.epub_version_combobox.setToolTip(_('<p>Select the type of OPF file to create.')) misc_group_box_layout.addWidget(self.epub_version_combobox) self.epub_version_combobox.addItems(['Auto-detect', 'ePub2', 'ePub3']) if plugin_prefs['Epub_Version'] == 'A': self.epub_version_combobox.setCurrentIndex(0) else: self.epub_version_combobox.setCurrentIndex(int(plugin_prefs['Epub_Version'])-1)
def add_declarant(self, var=True, gl=None): if not gl: gl = self.dec_layout dc = {} gb_l = QGridLayout() if self.cb.currentIndex() == 0 or gl != self.dec_layout: # Add Individual gb = QGroupBox(tr('Физическое лицо *')) gb_l.addWidget(QLabel(tr('Фамилия <em style="color: red">*</em>'))) w = QLineEdit() gb_l.addWidget(w, 0, 1, 1, 1) dc['surname'] = w gb_l.addWidget(QLabel(tr('Имя <em style="color: red">*</em>'))) w = QLineEdit() gb_l.addWidget(w) dc['first_name'] = w gb_l.addWidget(QLabel(tr('Отчество'))) w = QLineEdit() gb_l.addWidget(w) dc['patronymic'] = w adr = QGroupBox(tr('Адрес регистрации *')) adr_l = QGridLayout() dc['address'] = self.__add_address(adr_l) adr.setLayout(adr_l) gb_l.addWidget(adr, gb_l.rowCount() + 1, 0, 1, 2) gb.setLayout(gb_l) gl.addWidget(gb, gl.rowCount() + 1, 0, 1, 2) self.individuals.append(dc) else: # Add LegalEntity gb = QGroupBox( tr('Юридическое лицо/Индивидуальный предприниматель *')) gb_l.addWidget( QLabel( tr('Краткое наименование ЮЛ <em style="color: red">*</em>') )) w = QLineEdit() gb_l.addWidget(w, 0, 1, 1, 1) dc['name'] = w adr = QGroupBox(tr('Юридический адрес *')) adr_l = QGridLayout() dc['address'] = self.__add_address(adr_l) adr.setLayout(adr_l) gb_l.addWidget(adr, gb_l.rowCount() + 1, 0, 1, 2) gb.setLayout(gb_l) gl.addWidget(gb, gl.rowCount() + 1, 0, 1, 2) self.entities.append(dc)
def createCalibrationControls(): gb = QGroupBox("Calibration") #------------------------------------------ layout = QGridLayout() arduino = createArduinoCalibrationControls() pc = createPcCalibrationControls() gui = createGuiCalibration() layout.addWidget(arduino, 0, 0, 1, 1) layout.addWidget(pc, 1, 0, 1, 1) layout.addWidget(gui, 0, 1, 2, 1) layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(5) upper = QWidget() upper.setLayout(layout) #------------------------------------------ vbox = QVBoxLayout() vbox.addWidget(upper) vbox.addStretch(1) vbox.setContentsMargins(0, 0, 0, 0) vbox.setSpacing(0) gb.setLayout(vbox) return gb
def createSpeedControls(): speed_gb = QGroupBox("Speed") speed_gb.setMaximumWidth(50) layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) speed1_btn = QPushButton("1") speed2_btn = QPushButton("2") speed3_btn = QPushButton("3") speed4_btn = QPushButton("4") speed5_btn = QPushButton("5") speed6_btn = QPushButton("6") speed1_btn.clicked.connect(lambda: send_cmd(["1"])) speed2_btn.clicked.connect(lambda: send_cmd(["2"])) speed3_btn.clicked.connect(lambda: send_cmd(["3"])) speed4_btn.clicked.connect(lambda: send_cmd(["4"])) speed5_btn.clicked.connect(lambda: send_cmd(["5"])) speed6_btn.clicked.connect(lambda: send_cmd(["6"])) layout.addWidget(speed1_btn) layout.addWidget(speed2_btn) layout.addWidget(speed3_btn) layout.addWidget(speed4_btn) layout.addWidget(speed5_btn) layout.addWidget(speed6_btn) layout.addStretch(1) speed_gb.setLayout(layout) return speed_gb
def initialize_controls(self): self.setWindowTitle(DIALOG_NAME) layout = QVBoxLayout(self) self.setLayout(layout) title_layout = ImageTitleLayout(self, 'images/icon.png', 'Update custom columns in Library') layout.addLayout(title_layout) column_group = QGroupBox(_("Columns to update"), self) layout.addWidget(column_group) column_layout = QGridLayout() column_group.setLayout(column_layout) pos = 0 self.checkbox = {} for key in sorted (self.custom_cols): value = self.custom_cols[key] self.checkbox[key] = self.createCheckbox (value) column_layout.addWidget(self.checkbox[key], int ((pos / 2)), int ((pos % 2)* 2 + 1), 1, 1) pos = pos + 1 layout.addStretch(1) # Dialog buttons button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) button_box.accepted.connect(self.ok_clicked) button_box.rejected.connect(self.reject) layout.addWidget(button_box)
def __init__(self, plugin): QWidget.__init__(self) self.plugin = plugin self.overl = l = QVBoxLayout(self) self.gb = QGroupBox(_('Metadata fields to download'), self) if plugin.config_help_message: self.pchm = QLabel(plugin.config_help_message) self.pchm.setWordWrap(True) self.pchm.setOpenExternalLinks(True) l.addWidget(self.pchm, 10) l.addWidget(self.gb) self.gb.l = g = QVBoxLayout(self.gb) g.setContentsMargins(0, 0, 0, 0) self.fields_view = v = FieldsList(self) g.addWidget(v) v.setFlow(QListView.Flow.LeftToRight) v.setWrapping(True) v.setResizeMode(QListView.ResizeMode.Adjust) self.fields_model = FieldsModel(self.plugin) self.fields_model.initialize() v.setModel(self.fields_model) self.memory = [] self.widgets = [] self.l = QGridLayout() self.l.setContentsMargins(0, 0, 0, 0) l.addLayout(self.l, 100) for opt in plugin.options: self.create_widgets(opt)
def _initUI(self): self.setWindowIcon(QIcon("logo.png")) self.setWindowTitle('GraphNotes') self.resize(1000, 700) self.initActions() self.add_data_button = QPushButton("Add data", self) self.search_box = QGroupBox() self._initSearchFrame(self.search_box) self.concept_list = QListWidget(self) self.relation_list = QListWidget(self) self.result_table = QTextEdit(self) self.concept_list.itemClicked.connect(self.searchRelations) self.concept_list.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) self.concept_list.setContextMenuPolicy(Qt.CustomContextMenu) self.concept_list.customContextMenuRequested.connect(self._showConceptContextMenu) self.relation_list.setContextMenuPolicy(Qt.CustomContextMenu) self.relation_list.customContextMenuRequested.connect(self._showRelationContextMenu) self.relation_list.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) self.relation_list.itemClicked.connect(self.setRelationDescription) self.grid = QGridLayout() self.result_table.setReadOnly(True) self.search() self._configWidgets() self._bindWidgets() self.show()
def initSearchFrame(self, frame): self.search_line = QLineEdit(frame) checkboxes = QGroupBox() checkboxes.setStyleSheet("border:0;") self.concept_checkbox = QCheckBox("Concept", checkboxes) self.description_checkbox = QCheckBox("Description", checkboxes) self.study_checkbox = QCheckBox("Study", checkboxes) self.reference_checkbox = QCheckBox("Reference", checkboxes) self.in_selected_checkbox = QCheckBox("Search in selected concepts", checkboxes) self.search_button = QPushButton("Search", checkboxes) checkboxes_layout = QGridLayout(checkboxes) checkboxes_layout.addWidget(self.concept_checkbox, 0, 0) checkboxes_layout.addWidget(self.description_checkbox, 0, 1) checkboxes_layout.addWidget(self.study_checkbox, 0, 2) checkboxes_layout.addWidget(self.reference_checkbox, 0, 3) checkboxes_layout.addWidget(self.in_selected_checkbox, 0, 4) checkboxes_layout.setContentsMargins(0, 0, 0, 0) self.concept_checkbox.setChecked(True) self.in_selected_checkbox.setChecked(True) grid = QGridLayout(frame) grid.addWidget(self.search_line, 1, 0) grid.addWidget(self.search_button, 1, 1) grid.addWidget(checkboxes, 2, 0, Qt.AlignLeft) frame.setLayout(grid)
def _initialise_controls(self): layout = QVBoxLayout(self) self.setLayout(layout) cust_col = self.library_config.get(PREFS_KEY_UPDATE_COLUMN, '') cust_val = self.library_config.get(PREFS_KEY_UPDATE_VALUE, '') content_groupbox = QGroupBox('After generating cover:', self) layout.addWidget(content_groupbox) col_layout = QGridLayout() content_groupbox.setLayout(col_layout) update_custom_columns = self._get_custom_columns(['text', 'bool']) self.update_column_combo = CustomColumnComboBox( self, update_custom_columns, cust_col, ['', 'tags']) self.update_column_combo.setMinimumWidth(120) self.update_value_ledit = QLineEdit(cust_val, self) col_layout.addWidget(QLabel('Update column:', self), 0, 0, 1, 1) col_layout.addWidget(QLabel('Update value:', self), 1, 0, 1, 1) col_layout.addWidget(self.update_column_combo, 0, 1, 1, 1) col_layout.addWidget(self.update_value_ledit, 1, 1, 1, 1) keyboard_shortcuts_button = QPushButton('Keyboard shortcuts...', self) keyboard_shortcuts_button.setToolTip( _('Edit the keyboard shortcuts associated with this plugin')) keyboard_shortcuts_button.clicked.connect(self._edit_shortcuts) layout.addWidget(keyboard_shortcuts_button) view_prefs_button = QPushButton('&View library preferences...', self) view_prefs_button.setToolTip( _('View data stored in the library database for this plugin')) view_prefs_button.clicked.connect(self._view_prefs) layout.addWidget(view_prefs_button)
def __init__(self, plugin): QWidget.__init__(self) self.plugin = plugin self.l = l = QGridLayout() self.setLayout(l) self.gb = QGroupBox(_('Metadata fields to download'), self) if plugin.config_help_message: self.pchm = QLabel(plugin.config_help_message) self.pchm.setWordWrap(True) self.pchm.setOpenExternalLinks(True) l.addWidget(self.pchm, 0, 0, 1, 2) l.addWidget(self.gb, l.rowCount(), 0, 1, 2) self.gb.l = QGridLayout() self.gb.setLayout(self.gb.l) self.fields_view = v = QListView(self) self.gb.l.addWidget(v, 0, 0) v.setFlow(v.LeftToRight) v.setWrapping(True) v.setResizeMode(v.Adjust) self.fields_model = FieldsModel(self.plugin) self.fields_model.initialize() v.setModel(self.fields_model) self.memory = [] self.widgets = [] for opt in plugin.options: self.create_widgets(opt)
def __init__(self, parent=None,): QDialog.__init__(self, parent) self.parent = parent self.setWindowTitle("{0} {1}: Add New Mobipocket PID".format(PLUGIN_NAME, PLUGIN_VERSION)) layout = QVBoxLayout(self) self.setLayout(layout) data_group_box = QGroupBox("", self) layout.addWidget(data_group_box) data_group_box_layout = QVBoxLayout() data_group_box.setLayout(data_group_box_layout) key_group = QHBoxLayout() data_group_box_layout.addLayout(key_group) key_group.addWidget(QLabel("PID:", self)) self.key_ledit = QLineEdit("", self) self.key_ledit.setToolTip("Enter a Mobipocket PID. Mobipocket PIDs are 8 or 10 characters long. Mobipocket PIDs are case-sensitive, so be sure to enter the upper and lower case letters unchanged.") key_group.addWidget(self.key_ledit) self.button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.button_box.accepted.connect(self.accept) self.button_box.rejected.connect(self.reject) layout.addWidget(self.button_box) self.resize(self.sizeHint())
def __init__(self, plugin): DefaultConfigWidget.__init__(self, plugin) c = plugin_prefs[STORE_NAME] other_group_box = QGroupBox('Other options', self) self.l.addWidget(other_group_box, self.l.rowCount(), 0, 1, 2) other_group_box_layout = QHBoxLayout() other_group_box.setLayout(other_group_box_layout) max_label = QLabel( 'Maximum title/author search matches to evaluate (1 = fastest):', self) max_label.setToolTip( 'Libri.hu do not always have links to large covers for every ISBN\n' 'of the same book. Increasing this value will take effect when doing\n' 'title/author searches to consider more ISBN editions.\n\n' 'This will increase the potential likelihood of getting a larger cover\n' 'though does not guarantee it.') other_group_box_layout.addWidget(max_label) self.max_downloads_spin = QtGui.QSpinBox(self) self.max_downloads_spin.setMinimum(5) self.max_downloads_spin.setMaximum(50) self.max_downloads_spin.setProperty( 'value', c.get(KEY_MAX_DOWNLOADS, DEFAULT_STORE_VALUES[KEY_MAX_DOWNLOADS])) other_group_box_layout.addWidget(self.max_downloads_spin) other_group_box_layout.insertStretch(-1)
def __init__(self): QWidget.__init__(self) self.layout_1 = QVBoxLayout() self.setLayout(self.layout_1) self.layout_1.setSpacing(0) self.layout_1.setContentsMargins(QMargins(0, 0, 0, 0)) self.paths_groupbox = QGroupBox('Preferences') self.layout_1.addWidget(self.paths_groupbox) self.paths_layout = QGridLayout() self.paths_groupbox.setLayout(self.paths_layout) font = QFont() font.setBold(False) font.setPointSize(10) self.label1 = QLabel() self.label1.setTextFormat(1) self.label1.setText( "<center><font color='#0404B4'> Please Customize Directly Within Library Codes </font></center>" ) self.label1.setFont(font) self.paths_layout.addWidget(self.label1) self.resize(self.sizeHint())
def initUI(self): self.initActions() self.add_data_button = QPushButton("Add data", self) self.export_button = QPushButton("Export references", self) self.search_box = QGroupBox() self.concept_list = QListWidget(self) self.relation_list = QListWidget(self) self.result_table = QTextEdit(self) self.concept_list.selectionModel().selectionChanged.connect(self.searchRelations) self.concept_list.setSelectionMode(QAbstractItemView.ContiguousSelection) self.concept_list.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) self.concept_list.setContextMenuPolicy(Qt.CustomContextMenu) self.concept_list.customContextMenuRequested.connect(self.showConceptContextMenu) self.relation_list.setContextMenuPolicy(Qt.CustomContextMenu) self.relation_list.customContextMenuRequested.connect(self.showRelationContextMenu) self.relation_list.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) self.relation_list.selectionModel().selectionChanged.connect(self.setRelationDescription) self.initSearchFrame(self.search_box) self.grid = QGridLayout() self.result_table.setReadOnly(True) self.search() self.configWidgets() self.bindWidgets() self.show()
def __init__( self, parent=None, ): QDialog.__init__(self, parent) self.parent = parent self.setWindowTitle("{0} {1}: Add New eInk Kobo Serial Number".format( PLUGIN_NAME, PLUGIN_VERSION)) layout = QVBoxLayout(self) self.setLayout(layout) data_group_box = QGroupBox(u"", self) layout.addWidget(data_group_box) data_group_box_layout = QVBoxLayout() data_group_box.setLayout(data_group_box_layout) key_group = QHBoxLayout() data_group_box_layout.addLayout(key_group) key_group.addWidget(QLabel("EInk Kobo Serial Number:", self)) self.key_ledit = QLineEdit("", self) self.key_ledit.setToolTip( "Enter an eInk Kobo serial number. EInk Kobo serial numbers are 13 characters long and usually start with a 'N'. Kobo Serial Numbers are case-sensitive, so be sure to enter the upper and lower case letters unchanged." ) key_group.addWidget(self.key_ledit) self.button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.button_box.accepted.connect(self.accept) self.button_box.rejected.connect(self.reject) layout.addWidget(self.button_box) self.resize(self.sizeHint())
def __init__(self, parent=None,): print(repr(self), repr(parent)) QDialog.__init__(self, parent) self.parent = parent self.setWindowTitle("{0} {1}: Rename {0}".format(PLUGIN_NAME, PLUGIN_VERSION, parent.key_type_name)) layout = QVBoxLayout(self) self.setLayout(layout) data_group_box = QGroupBox('', self) layout.addWidget(data_group_box) data_group_box_layout = QVBoxLayout() data_group_box.setLayout(data_group_box_layout) data_group_box_layout.addWidget(QLabel('New Key Name:', self)) self.key_ledit = QLineEdit(self.parent.listy.currentItem().text(), self) self.key_ledit.setToolTip("Enter a new name for this existing {0}.".format(parent.key_type_name)) data_group_box_layout.addWidget(self.key_ledit) layout.addSpacing(20) self.button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.button_box.accepted.connect(self.accept) self.button_box.rejected.connect(self.reject) layout.addWidget(self.button_box) self.resize(self.sizeHint())
def __init__(self, metadata, parent=None): QDialog.__init__(self, parent=parent) self.setWindowFlags(Qt.Window) buttonBox = QDialogButtonBox(QDialogButtonBox.Close) origbrowser = QTextBrowser() origbrowser.setText('') origbrowser.setReadOnly(True) browser = QTextBrowser() browser.setText('') browser.setReadOnly(True) gpbox2 = QGroupBox('Metadata: Original') lay2 = QHBoxLayout() gpbox2.setLayout(lay2) lay2.addWidget(origbrowser) gpbox4 = QGroupBox('Metadata: After scrambling') lay4 = QHBoxLayout() gpbox4.setLayout(lay4) lay4.addWidget(browser) splitter = QSplitter(Qt.Horizontal) splitter.addWidget(gpbox2) splitter.addWidget(gpbox4) splitter.setMinimumHeight(500) splitter.setMinimumWidth(1000) lay = QVBoxLayout() self.setLayout(lay) lay.addWidget(splitter) lay.addWidget(buttonBox) # create connect signals/slots buttonBox.rejected.connect(self.reject) metaorig = metadata.get('orig', '') metaorig = re.sub(r'\n\s*', r'\n ', metaorig) origbrowser.setText(metaorig) browser.setText(metadata.get('scramb', '')) self.setWindowTitle('%s: Metadata' % CAPTION) if not 'scramb' in metadata: gpbox4.setVisible(False)
def make_groupbox(self, group, parent): groupbox = QGroupBox(group["Title"], self) setattr(self, group["Name"] + "_box", groupbox) parent.addWidget(groupbox) groupbox_layout = QGridLayout() setattr(self, group["Name"] + "_layout", groupbox_layout) groupbox.setLayout(groupbox_layout) return groupbox_layout
def createNavigationControls(): gb = QGroupBox("Navigation Controls") #------------------------------------------- layout = QGridLayout() pause_both_btn = QPushButton("Pause vector && time") pause_btn = QPushButton("Pause vector") pause_time_btn = QPushButton("Pause time") continue_btn = QPushButton("Continue") release_btn = QPushButton("Release") cwHalfStep_btn = QPushButton("=> half step") ccwHalfStep_btn = QPushButton("<= half step") ccwDir_btn = QPushButton("CCW direction") cwDir_btn = QPushButton("CW direction") continue_btn.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) pause_both_btn.clicked.connect(pause_vector_and_time) pause_btn.clicked.connect(lambda: send_cmd(["p"])) pause_time_btn.clicked.connect(tracker.pause_time) continue_btn.clicked.connect(continue_) release_btn.clicked.connect(lambda: send_cmd(["r"])) cwHalfStep_btn.clicked.connect(lambda: send_cmd([">", "h", "<"])) ccwHalfStep_btn.clicked.connect(lambda: send_cmd(["<", "h"])) ccwDir_btn.clicked.connect(lambda: send_cmd(["<"])) cwDir_btn.clicked.connect(lambda: send_cmd([">"])) layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) layout.setVerticalSpacing(0) layout.addWidget(pause_both_btn, 0, 0) layout.addWidget(pause_btn, 1, 0) layout.addWidget(pause_time_btn, 2, 0) layout.addWidget(continue_btn, 0, 1, 3, 1) layout.addWidget(ccwHalfStep_btn, 3, 0) layout.addWidget(cwHalfStep_btn, 3, 1) layout.addWidget(ccwDir_btn, 4, 0) layout.addWidget(cwDir_btn, 4, 1) layout.addWidget(createGotoControls(), 5, 0, 1, 2) layout.addWidget(release_btn, 6, 0, 1, 2) upper = QWidget() upper.setLayout(layout) #------------------------------------------- vbox = QVBoxLayout() vbox.addWidget(upper) vbox.addStretch(1) vbox.setContentsMargins(0, 0, 0, 0) vbox.setSpacing(0) gb.setLayout(vbox) return gb
def wrap_many_in_group_box(widgets, parent, name, alignment=Qt.AlignTop): group_box = QGroupBox(name, parent) group_box_layout = QVBoxLayout(group_box) for widget in widgets: if alignment is not None: group_box_layout.addWidget(widget, alignment) else: group_box_layout.addWidget(widget) return group_box
def setup_ui(self, parent): self._box = QGroupBox(parent) self._box.setTitle('&'+self.col_metadata['name']) self._layout = QVBoxLayout() self._tb = QPlainTextEdit(self._box) self._tb.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum) self._layout.addWidget(self._tb) self._box.setLayout(self._layout) self.widgets = [self._box]
def __init__(self, plugin): DefaultConfigWidget.__init__(self, plugin) c = plugin_prefs[STORE_NAME] other_group_box = QGroupBox('Other options', self) self.l.addWidget(other_group_box, self.l.rowCount(), 0, 1, 2) other_group_box_layout = QGridLayout() other_group_box.setLayout(other_group_box_layout) # Guess Series guess_series_label = QLabel( 'Guess Series and Series Index from Title:', self) guess_series_label.setToolTip('DNB only rarely provides data about a book\'s series.\n' 'This plugin can try to extract series and series_index from the book title.\n') other_group_box_layout.addWidget(guess_series_label, 0, 0, 1, 1) self.guess_series_checkbox = QtGui.QCheckBox(self) self.guess_series_checkbox.setChecked( c.get(KEY_GUESS_SERIES, DEFAULT_STORE_VALUES[KEY_GUESS_SERIES])) other_group_box_layout.addWidget( self.guess_series_checkbox, 0, 1, 1, 1) # Append Edition to Title append_edition_to_title_label = QLabel( 'Append Edition to Title:', self) append_edition_to_title_label.setToolTip('For some books DNB has information about the edition.\n' 'This plugin can fetch this information and append it to the book\'s title,\n' 'e.g. "Mord am Tegernsee : Ein Bayern-Krimi : 2. Aufl.".\n' 'Of course this only works reliable if you search for a book with a known unique identifier such as dnb-idn or ISBN.') other_group_box_layout.addWidget( append_edition_to_title_label, 1, 0, 1, 1) self.append_edition_to_title_checkbox = QtGui.QCheckBox(self) self.append_edition_to_title_checkbox.setChecked(c.get( KEY_APPEND_EDITION_TO_TITLE, DEFAULT_STORE_VALUES[KEY_APPEND_EDITION_TO_TITLE])) other_group_box_layout.addWidget( self.append_edition_to_title_checkbox, 1, 1, 1, 1) # Fetch Subjects fetch_subjects_label = QLabel('Fetch Subjects:', self) fetch_subjects_label.setToolTip('DNB provides several types of subjects:\n' ' - Standardized subjects according to the GND\n' ' - Subjects delivered by the publisher\n' 'You can choose which ones to fetch.') other_group_box_layout.addWidget(fetch_subjects_label, 2, 0, 1, 1) self.fetch_subjects_radios_group = QtGui.QButtonGroup(other_group_box) titles = ['only GND subjects', 'GND subjects if available, otherwise non-GND subjects', 'GND and non-GND subjects', 'non-GND subjects if available, otherwise GND subjects', 'only non-GND subjects', 'none'] self.fetch_subjects_radios = [ QtGui.QRadioButton(title) for title in titles] for i, radio in enumerate(self.fetch_subjects_radios): if i == c.get(KEY_FETCH_SUBJECTS, DEFAULT_STORE_VALUES[KEY_FETCH_SUBJECTS]): radio.setChecked(True) self.fetch_subjects_radios_group.addButton(radio, i) other_group_box_layout.addWidget(radio, 2 + i, 1, 1, 1)
def setup_ui(self): self.l = l = QVBoxLayout(self) self.setLayout(l) self.gb = gb = QGroupBox(_('&Images in book'), self) self.v = v = QVBoxLayout(gb) gb.setLayout(v), gb.setFlat(True) self.names, self.names_filter = create_filterable_names_list( sorted(self.image_names, key=sort_key), filter_text=_('Filter the list of images'), parent=self) self.names.doubleClicked.connect( self.double_clicked, type=Qt.ConnectionType.QueuedConnection) self.cover_view = CoverView(self) l.addWidget(self.names_filter) v.addWidget(self.names) self.splitter = s = QSplitter(self) l.addWidget(s) s.addWidget(gb) s.addWidget(self.cover_view) self.h = h = QHBoxLayout() self.preserve = p = QCheckBox(_('Preserve aspect ratio')) p.setToolTip( textwrap.fill( _('If enabled the cover image you select will be embedded' ' into the book in such a way that when viewed, its aspect' ' ratio (ratio of width to height) will be preserved.' ' This will mean blank spaces around the image if the screen' ' the book is being viewed on has an aspect ratio different' ' to the image.'))) p.setChecked(tprefs['add_cover_preserve_aspect_ratio']) p.setVisible(self.container.book_type != 'azw3') def on_state_change(s): tprefs.set('add_cover_preserve_aspect_ratio', s == Qt.CheckState.Checked) p.stateChanged.connect(on_state_change) self.info_label = il = QLabel('\xa0') h.addWidget(p), h.addStretch(1), h.addWidget(il) l.addLayout(h) l.addWidget(self.bb) b = self.bb.addButton(_('Import &image'), QDialogButtonBox.ButtonRole.ActionRole) b.clicked.connect(self.import_image) b.setIcon(QIcon(I('document_open.png'))) self.names.setFocus(Qt.FocusReason.OtherFocusReason) self.names.selectionModel().currentChanged.connect( self.current_image_changed) cname = get_raster_cover_name(self.container) if cname: row = self.names.model().find_name(cname) if row > -1: self.names.setCurrentIndex(self.names.model().index(row))
def createArduinoCalibrationControls(): gb = QGroupBox("Arduino Calibration") vbox = QVBoxLayout() #------------------------------------------- layout = QHBoxLayout() label = QLabel("Set current position as:") lineEdit = QLineEdit() degreesLabel = QLabel("deg") set_btn = QPushButton("Set") lineEdit.setMaximumWidth(30) set_btn.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) set_btn.clicked.connect(lambda: send_cmd(["=" + lineEdit.displayText()])) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(label) layout.addWidget(lineEdit) layout.addWidget(degreesLabel) layout.addWidget(set_btn) upper = QWidget() upper.setLayout(layout) #------------------------------------------- layout = QHBoxLayout() btn0 = QPushButton("Set as 0") btn180 = QPushButton("Set as 180") btn0.clicked.connect(lambda: send_cmd(["=0"])) btn180.clicked.connect(lambda: send_cmd(["=180"])) layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) layout.addWidget(btn0) layout.addWidget(btn180) layout.addStretch(1) lower = QWidget() lower.setLayout(layout) #------------------------------------------- vbox.setContentsMargins(0, 0, 0, 0) vbox.setSpacing(0) vbox.addWidget(upper) vbox.addWidget(lower) gb.setLayout(vbox) return gb
def setup_ui(self, parent): self._box = QGroupBox(parent) self._box.setTitle('&'+self.col_metadata['name']) self._layout = QVBoxLayout() self._tb = CommentsEditor(self._box, toolbar_prefs_name=u'metadata-comments-editor-widget-hidden-toolbars') self._tb.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum) # self._tb.setTabChangesFocus(True) self._layout.addWidget(self._tb) self._box.setLayout(self._layout) self.widgets = [self._box]
def _set_tab(self): self.tab_widget = QTabWidget() # self.tab_widget.currentChanged.connect(self.switch_tab) # tab_widget.setMaximumHeight(self.window.geometry().height() // 2) self.main_layout.addWidget(self.tab_widget) toolbox1 = QToolBox() toolbox2 = QToolBox() toolbox3 = QToolBox() toolbox4 = QToolBox() toolbox5 = QToolBox() groupbox1 = QGroupBox() groupbox2 = QGroupBox() groupbox3 = QGroupBox() groupbox4 = QGroupBox() groupbox5 = QGroupBox() toolbox1.addItem(groupbox1, "") toolbox2.addItem(groupbox2, "") toolbox3.addItem(groupbox3, "") toolbox4.addItem(groupbox4, "") toolbox5.addItem(groupbox5, "") self.tab_widget.addTab(toolbox1, "uArm") self.tab_widget.addTab(toolbox2, "xArm") self.tab_widget.addTab(toolbox3, "OpenMV") self.tab_widget.addTab(toolbox4, "Gcode") self.tab_widget.addTab(toolbox5, "WebView") uarm_layout = QVBoxLayout(groupbox1) xarm_layout = QVBoxLayout(groupbox2) openmv_layout = QHBoxLayout(groupbox3) gcode_layout = QVBoxLayout(groupbox4) webview_layout = QVBoxLayout(groupbox5) self.uarm_ui = UArmUI(self, uarm_layout) self.xarm_ui = XArmUI(self, xarm_layout) self.openmv_ui = OpenMV_UI(self, openmv_layout) self.gcode_ui = GcodeUI(self, gcode_layout) self.webview_ui = WebViewUI(self, webview_layout) self.tab_widget.setCurrentIndex(0)