def __init__(self): super().__init__() self.setWindowTitle('...') self.url_le = QLineEdit('http://qt-project.org/') self.go_pb = QPushButton('Go') self.go_pb.clicked.connect(self._on_load_url) url_layout = QHBoxLayout() url_layout.addWidget(self.url_le) url_layout.addWidget(self.go_pb) self.view = QWebEngineView() self.view.urlChanged.connect(self._on_url_changed) self.view.titleChanged.connect(self.setWindowTitle) main_layout = QVBoxLayout() main_layout.addLayout(url_layout) main_layout.addWidget(self.view) self.setLayout(main_layout)
def setupUi(self, *a): Ui_Form.setupUi(self, *a) v = self.page_margins_box.v = QVBoxLayout(self.page_margins_box) self.opt_pdf_use_document_margins = c = QCheckBox( _('Use page margins from the &document being converted')) v.addWidget(c) c.stateChanged.connect(self.toggle_margins) h = self.page_margins_box.h = QHBoxLayout() l = self.page_margins_box.l = QFormLayout() r = self.page_margins_box.r = QFormLayout() h.addLayout(l), h.addLayout(r) v.addLayout(h) def margin(which): w = QDoubleSpinBox(self) w.setRange(-100, 500), w.setSuffix(' pt'), w.setDecimals(1) setattr(self, 'opt_pdf_page_margin_' + which, w) return w l.addRow(_('&Left:'), margin('left')) l.addRow(_('&Right:'), margin('right')) r.addRow(_('&Top:'), margin('top')) r.addRow(_('&Bottom:'), margin('bottom'))
def __initUI(self): self.__btn_loadData.clicked.connect(self.__loadData) self.__btn_loadData.setEnabled(True) texte = "Load current X, Y, VX, VY & T vectors" self.__btn_loadData.setStatusTip(texte) self.__btn_clearData.clicked.connect(self.__clearData) self.__btn_clearData.setEnabled(True) texte = "Clears all data" self.__btn_clearData.setStatusTip(texte) vbox = QVBoxLayout() self.setLayout(vbox) hbox = QHBoxLayout() hbox.addWidget(self.__btn_loadData) hbox.addWidget(self.__btn_clearData) vbox.addLayout(hbox) vbox.addWidget(self.__IpythonConsole) self.__IpythonConsole.setFocus() # give focus to the IPython console
def __init__(self): super().__init__() self._layout = QHBoxLayout() self.setLayout(self._layout) message_label = QLabel("""\ Welcome to <b>EvilOSX</b>:<br/> An evil RAT (Remote Administration Tool) for macOS / OS X.<br/><br/><br/> Author: Marten4n6<br/> License: GPLv3<br/> Version: <b>{}</b> """.format(VERSION)) logo_label = QLabel() logo_path = path.join(path.dirname(__file__), path.pardir, path.pardir, "data", "images", "logo_334x600.png") logo_label.setPixmap(QPixmap(logo_path)) self._layout.setAlignment(Qt.AlignCenter) self._layout.setSpacing(50) self._layout.addWidget(message_label) self._layout.addWidget(logo_label)
def initUi(self): self.setGeometry(600, 300, 400, 200) self.setWindowTitle('Combo Box Layout') button1 = QPushButton('Button1', self) button2 = QPushButton('Button2', self) button3 = QPushButton('Button3', self) button4 = QPushButton('Button4', self) v1 = QVBoxLayout() v1.addWidget(button1) v1.addWidget(button2) v2 = QVBoxLayout() v2.addWidget(button3) v2.addWidget(button4) hbox = QHBoxLayout() hbox.addLayout(v1) hbox.addLayout(v2) self.setLayout(hbox)
def __init__(self, msg, name, parent, config_set=dynamic, icon='dialog_warning.png', title=None, confirm_msg=None, show_cancel_button=True): QDialog.__init__(self, parent) self.setWindowTitle(title or _("Are you sure?")) self.setWindowIcon(QIcon(I(icon))) self.l = l = QVBoxLayout(self) self.h = h = QHBoxLayout() l.addLayout(h) self.icon_widget = Icon(self) self.icon_widget.set_icon(QIcon(I(icon))) self.msg = m = QLabel(self) m.setOpenExternalLinks(True) m.setMinimumWidth(350), m.setWordWrap(True), m.setObjectName("msg") m.setText(msg) h.addWidget(self.icon_widget), h.addSpacing(10), h.addWidget(m) self.again = a = QCheckBox((confirm_msg or _("&Show this warning again")), self) a.setChecked(True), a.setObjectName("again") a.stateChanged.connect(self.toggle) l.addWidget(a) buttons = QDialogButtonBox.Ok if show_cancel_button: buttons |= QDialogButtonBox.Cancel self.buttonBox = bb = QDialogButtonBox(buttons, self) bb.setObjectName("buttonBox") bb.setFocus(Qt.OtherFocusReason) bb.accepted.connect(self.accept), bb.rejected.connect(self.reject) l.addWidget(bb) self.name = name self.config_set = config_set self.resize(self.sizeHint())
def __init__(self, console): self.console = console self.openPorts = [] super().__init__() self.layout = QVBoxLayout(self) self.titleText = QLabel("<H1>Portscanner</H1>\nIP-Adresse") self.layout.addWidget(self.titleText) self.ipField = QLineEdit("192.168.178.1") self.layout.addWidget(self.ipField) self.hbox = QHBoxLayout() self.startLabel = QLabel("Von Port") self.endLabel = QLabel("Bis Port") self.startField = QLineEdit("1") self.endField = QLineEdit("65535") self.hbox.addWidget(self.startLabel) self.hbox.addWidget(self.startField) self.hbox.addWidget(self.endLabel) self.hbox.addWidget(self.endField) self.layout.addLayout(self.hbox) self.startButton = QPushButton() self.startButton.setText("Starte Scan") self.portScanner = PortScanner() self.startButton.clicked.connect(self.btnClicked) self.layout.addWidget(self.startButton) self.output = Console("Output") self.layout.addWidget(self.output)
def __init__(self, parent, index): super(PlayerInfoField, self).__init__(parent) self.index = index self.layout = QHBoxLayout() self.auto_button = Button(self, 'Auto') self.auto_button.setFixedWidth(60) self.auto_button.clicked.connect(self.generate_name) self.layout.addWidget(self.auto_button) self.name_field = QLineEdit() self.name_field.setPalette(QPalette(Qt.white)) self.name_field.setPlaceholderText('Name') self.name_field.setClearButtonEnabled(True) self.name_field.setFixedWidth(250) self.layout.addWidget(self.name_field) self.AItoggle = QCheckBox() self.AItoggle.setText('Computer') self.AItoggle.setFixedWidth(100) self.layout.addWidget(self.AItoggle) self.AItoggle.stateChanged.connect(self.AIToggled) self.AIdifficulty = QComboBox() self.AIdifficulty.setPalette(QPalette(Qt.white)) self.AIdifficulty.setFixedWidth(100) self.AIdifficulty.addItems(['Braindead', 'Easy', 'Normal', 'Hard', 'HAL-9000']) self.AIdifficulty.setCurrentIndex(2) self.AIdifficulty.setDisabled(True) self.layout.addWidget(self.AIdifficulty) self.spacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.layout.addItem(self.spacer) self.layout.setContentsMargins(0, 0, 0, 0) self.setLayout(self.layout)
def setup_ui(self): from calibre.gui2.preferences.look_feel import DisplayedFields, move_field_up, move_field_down self.l = QVBoxLayout(self) self.field_display_order = fdo = QListView(self) self.model = DisplayedFields(self.db, fdo, pref_name='popup_book_display_fields') self.model.initialize() fdo.setModel(self.model) fdo.setAlternatingRowColors(True) del self.db self.l.addWidget(QLabel(_('Select displayed metadata'))) h = QHBoxLayout() h.addWidget(fdo) v = QVBoxLayout() self.mub = b = QToolButton(self) connect_lambda(b.clicked, self, lambda self: move_field_up(fdo, self.model)) b.setIcon(QIcon(I('arrow-up.png'))) b.setToolTip(_('Move the selected field up')) v.addWidget(b), v.addStretch(10) self.mud = b = QToolButton(self) b.setIcon(QIcon(I('arrow-down.png'))) b.setToolTip(_('Move the selected field down')) connect_lambda(b.clicked, self, lambda self: move_field_down(fdo, self.model)) v.addWidget(b) h.addLayout(v) self.l.addLayout(h) self.l.addWidget(QLabel('<p>' + _( 'Note that <b>comments</b> will always be displayed at the end, regardless of the order you assign here'))) b = self.bb.addButton(_('Restore &defaults'), self.bb.ActionRole) b.clicked.connect(self.restore_defaults) b = self.bb.addButton(_('Select &all'), self.bb.ActionRole) b.clicked.connect(self.select_all) b = self.bb.addButton(_('Select &none'), self.bb.ActionRole) b.clicked.connect(self.select_none) self.l.addWidget(self.bb) self.setMinimumHeight(500)
def setup_ui(self): from calibre.gui2.convert.look_and_feel_ui import Ui_Form f, w = Ui_Form(), QWidget() f.setupUi(w) self.l = l = QFormLayout(self) self.setLayout(l) l.addRow( QLabel( _('Select what style information you want completely removed:') )) self.h = h = QHBoxLayout() for name, text in ( ('fonts', _('&Fonts')), ('margins', _('&Margins')), ('padding', _('&Padding')), ('floats', _('Flo&ats')), ('colors', _('&Colors')), ): c = QCheckBox(text) setattr(self, 'opt_' + name, c) h.addWidget(c) c.setToolTip(getattr(f, 'filter_css_' + name).toolTip()) l.addRow(h) self.others = o = QLineEdit(self) l.addRow(_('&Other CSS properties:'), o) o.setToolTip(f.filter_css_others.toolTip()) if self.current_name is not None: self.filter_current = c = QCheckBox( _('Only filter CSS in the current file (%s)') % self.current_name) l.addRow(c) l.addRow(self.bb)
def setup_ui(self): self.use_stemmer = us = QCheckBox(_('Match on related English words')) us.setChecked(gprefs['browse_annots_use_stemmer']) us.setToolTip(fill(_( 'With this option searching for words will also match on any related English words. For' ' example: correction matches correcting and corrected as well'))) us.stateChanged.connect(lambda state: gprefs.set('browse_annots_use_stemmer', state != Qt.Unchecked)) l = QVBoxLayout(self) self.splitter = s = QSplitter(self) l.addWidget(s) s.setChildrenCollapsible(False) self.browse_panel = bp = BrowsePanel(self) bp.open_annotation.connect(self.do_open_annotation) s.addWidget(bp) self.details_panel = dp = DetailsPanel(self) s.addWidget(dp) dp.open_annotation.connect(self.do_open_annotation) dp.show_book.connect(self.show_book) dp.delete_annotation.connect(self.delete_annotation) dp.edit_annotation.connect(self.edit_annotation) bp.current_result_changed.connect(dp.show_result) h = QHBoxLayout() l.addLayout(h) h.addWidget(us), h.addStretch(10), h.addWidget(self.bb) self.delete_button = b = self.bb.addButton(_('Delete all selected'), self.bb.ActionRole) b.setToolTip(_('Delete the selected annotations')) b.setIcon(QIcon(I('trash.png'))) b.clicked.connect(self.delete_selected) self.export_button = b = self.bb.addButton(_('Export all selected'), self.bb.ActionRole) b.setToolTip(_('Export the selected annotations')) b.setIcon(QIcon(I('save.png'))) b.clicked.connect(self.export_selected)
def _setup_ui(self): layout = QHBoxLayout() layout.addWidget(QLabel(self._parm.get_name())) # IntParameter if isinstance(self._parm, IntParameter): spin_box = QSpinBox() spin_box.setMaximum(99999) spin_box.setValue(self._parm.get_value()) spin_box.valueChanged.connect(self._update) layout.addWidget(spin_box) # RangeParameter elif isinstance(self._parm, RangeParameter): range_slider = RangeSlider() range_slider.setRangeLimit(0, 255) range_slider.setRange(*self._parm.get_value()) range_slider.valueChanged.connect(self._update) range_label = RangeLabel(range_slider) layout.addWidget(range_slider) layout.addWidget(range_label) # ColorParameter elif isinstance(self._parm, ColorParameter): color_picker = ColorPicker(self._parm.get_value()) color_picker.valueChanged.connect(self._update) layout.addWidget(color_picker) # FileParameter elif isinstance(self._parm, FileParameter): file_picker = FilePicker() file_picker.valueChanged.connect(self._update) layout.addWidget(file_picker) self.setLayout(layout)
def _init_controls(self): layout = QVBoxLayout(self) self.setLayout(layout) ml = QHBoxLayout() layout.addLayout(ml, 1) self.keys_list = QListWidget(self) self.keys_list.setSelectionMode(QAbstractItemView.SingleSelection) self.keys_list.setFixedWidth(150) self.keys_list.setAlternatingRowColors(True) ml.addWidget(self.keys_list) self.value_text = QTextEdit(self) self.value_text.setTabStopWidth(24) self.value_text.setReadOnly(True) ml.addWidget(self.value_text, 1) button_box = QDialogButtonBox(QDialogButtonBox.Ok) button_box.accepted.connect(self.accept) self.clear_button = button_box.addButton('Clear', QDialogButtonBox.ResetRole) self.clear_button.setIcon(get_icon('trash.png')) self.clear_button.setToolTip('Clear all settings for this plugin') self.clear_button.clicked.connect(self._clear_settings) layout.addWidget(button_box)
def setup_ui(self): self.setMinimumWidth(300) self.setMinimumHeight(300) layout = QVBoxLayout(self) self.setLayout(layout) main_layout = QHBoxLayout() layout.addLayout(main_layout) self.listy = QListWidget() # self.listy.setSelectionMode(QAbstractItemView.ExtendedSelection) main_layout.addWidget(self.listy) self.listy.addItems(self.files) button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) button_box = QDialogButtonBox() ok_button = button_box.addButton(_("See what changed"), QDialogButtonBox.AcceptRole) cancel_button = button_box.addButton(_("Close"), QDialogButtonBox.RejectRole) button_box.accepted.connect(self.accept) button_box.rejected.connect(self.reject) layout.addWidget(button_box)
def setup_ui(self): from calibre.gui2.tweak_book.editor.text import TextEdit self.l = l = QVBoxLayout(self) self.bb.setStandardButtons(self.bb.Close) self.la = la = QLabel(self.LABEL) l.addWidget(la) self.css = t = TextEdit(self) t.load_text( '/* %s */\n' % _('Enter CSS rules below and click the Test button'), 'css') la.setBuddy(t) c = t.textCursor() c.movePosition(c.End) t.setTextCursor(c) self.h = h = QHBoxLayout() l.addLayout(h) h.addWidget(t) self.test_button = b = QPushButton(_('&Test'), self) b.clicked.connect(self.do_test) h.addWidget(b) self.result = la = TextEdit(self) la.setReadOnly(True) l.addWidget(la) l.addWidget(self.bb)
def __init__(self, window, msg, formats, show_open_with=False): QDialog.__init__(self, window) self.resize(507, 377) self.setWindowIcon(QIcon(I("mimetypes/unknown.png"))) self.setWindowTitle(_('Choose Format')) self.l = l = QVBoxLayout(self) self.msg = QLabel(msg) l.addWidget(self.msg) self.formats = QListWidget(self) self.formats.setIconSize(QSize(64, 64)) self.formats.activated[QModelIndex].connect(self.activated_slot) l.addWidget(self.formats) self.h = h = QHBoxLayout() h.setContentsMargins(0, 0, 0, 0) l.addLayout(h) if show_open_with: self.owb = QPushButton(_('&Open With...'), self) h.addWidget(self.owb) self.own = QMenu(self.owb.text()) self.owb.setMenu(self.own) self.own.aboutToShow.connect(self.populate_open_with) self.buttonBox = bb = QDialogButtonBox(self) bb.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) bb.accepted.connect(self.accept), bb.rejected.connect(self.reject) h.addStretch(10), h.addWidget(self.buttonBox) for format in formats: self.formats.addItem( QListWidgetItem( file_icon_provider().icon_from_ext(format.lower()), format.upper())) self._formats = formats self.formats.setCurrentRow(0) self._format = self.open_with_format = None if show_open_with: self.populate_open_with()
def __init__(self, parent, closeButton=True): QFrame.__init__(self, parent) self.setMaximumSize(QSize(9999999, 22)) self.setObjectName("windowTitle") self.hboxlayout = QHBoxLayout(self) self.hboxlayout.setSpacing(0) self.hboxlayout.setContentsMargins(0, 0, 4, 0) self.label = QLabel(self) self.label.setObjectName("label") self.label.setStyleSheet( "padding-left:4px; font:bold 11px; color: #FFFFFF;") self.hboxlayout.addWidget(self.label) spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.hboxlayout.addItem(spacerItem) if closeButton: self.pushButton = QPushButton(self) self.pushButton.setFocusPolicy(Qt.NoFocus) self.pushButton.setObjectName("pushButton") self.pushButton.setStyleSheet("font:bold;") self.pushButton.setText("X") self.hboxlayout.addWidget(self.pushButton) self.dragPosition = None self.mainwidget = self.parent() self.setStyleSheet(""" QFrame#windowTitle {background-color:#222222;color:#FFF;} """) # Initial position to top left self.dragPosition = self.mainwidget.frameGeometry().topLeft()
def initialize_controls(self, title, initial_value): self.setWindowTitle('Lock Series Index') layout = QVBoxLayout(self) self.setLayout(layout) title_layout = ImageTitleLayout(self, 'images/lock32.png', 'Lock Series Index') layout.addLayout(title_layout) layout.addSpacing(10) self.title_label = QLabel('Series index for book: \'%s\'' % title, self) layout.addWidget(self.title_label) hlayout = QHBoxLayout() layout.addLayout(hlayout) self.value_spinbox = QDoubleSpinBox(self) self.value_spinbox.setRange(0, 99000000) self.value_spinbox.setDecimals(2) if initial_value is not None: self.value_spinbox.setValue(initial_value) self.value_spinbox.selectAll() hlayout.addWidget(self.value_spinbox, 0) hlayout.addStretch(1) self.assign_same_checkbox = QCheckBox( '&Assign this index value to all remaining books', self) layout.addWidget(self.assign_same_checkbox) layout.addStretch(1) # Dialog buttons button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) button_box.accepted.connect(self.accept) button_box.rejected.connect(self.reject) layout.addWidget(button_box)
def setup_ui(self): self.resize(678, 430) self.setWindowTitle(_("Add books by ISBN")) self.setWindowIcon(QIcon(I('add_book.png'))) self.l = l = QVBoxLayout(self) self.h = h = QHBoxLayout() l.addLayout(h) self.bb = bb = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self) bb.button(bb.Ok).setShortcut(QKeySequence(Qt.Key_O | Qt.ALT)) l.addWidget(bb), bb.accepted.connect(self.accept), bb.rejected.connect( self.reject) self.ll = l = QVBoxLayout() h.addLayout(l) self.isbn_box = i = QPlainTextEdit(self) l.addWidget(i) self.paste_button = b = QPushButton(_("&Paste from clipboard"), self) l.addWidget(b), b.clicked.connect(self.paste) self.lll = l = QVBoxLayout() h.addLayout(l) self.label = la = QLabel( _("<p>Enter a list of ISBNs in the box to the left, one per line. calibre will automatically" " create entries for books based on the ISBN and download metadata and covers for them.</p>\n" "<p>Any invalid ISBNs in the list will be ignored.</p>\n" "<p>You can also specify a file that will be added with each ISBN. To do this enter the full" " path to the file after a <code>>></code>. For example:</p>\n" "<p><code>9788842915232 >> %s</code></p>"), self) l.addWidget(la), la.setWordWrap(True) l.addSpacing(20) self.la2 = la = QLabel(_("&Tags to set on created book entries:"), self) l.addWidget(la) self.add_tags = le = QLineEdit(self) la.setBuddy(le) l.addWidget(le) l.addStretch(10)
def __init__(self, parent): QWidget.__init__(self, parent) h = QHBoxLayout(self) h.setContentsMargins(0, 0, 0, 0) h.addWidget(QLabel(_('Restrict to') + ': ')) la = QLabel(_('Types:')) h.addWidget(la) self.types_box = tb = QComboBox(self) tb.la = la tb.currentIndexChanged.connect(self.restrictions_changed) connect_lambda(tb.currentIndexChanged, tb, lambda tb: gprefs.set('browse_annots_restrict_to_type', tb.currentData())) la.setBuddy(tb) tb.setToolTip(_('Show only annotations of the specified type')) h.addWidget(tb) la = QLabel(_('User:'******'browse_annots_restrict_to_user', ub.currentData())) la.setBuddy(ub) ub.setToolTip(_('Show only annotations created by the specified user')) h.addWidget(ub) h.addStretch(10)
def setup_ui(self): self.l = l = QVBoxLayout(self) self.recipes = r = QTreeView(self) r.setAnimated(True) r.setHeaderHidden(True) self.model = ChooseBuiltinRecipeModel(self) self.model.setSourceModel(self.recipe_model) r.setModel(self.model) r.doubleClicked.connect(self.accept) self.search = s = SearchBox2(self) self.search.initialize('scheduler_search_history') self.search.setMinimumContentsLength(15) self.search.search.connect(self.recipe_model.search) self.recipe_model.searched.connect(self.search.search_done, type=Qt.ConnectionType.QueuedConnection) self.recipe_model.searched.connect(self.search_done) self.go_button = b = QToolButton(self) b.setText(_("Go")) b.clicked.connect(self.search.do_search) h = QHBoxLayout() h.addWidget(s), h.addWidget(b) l.addLayout(h) l.addWidget(self.recipes) l.addWidget(self.bb) self.search.setFocus(Qt.FocusReason.OtherFocusReason)
def make_widgets(self, parent, main_widget_class, extra_label_text='', add_tags_edit_button=False): w = QWidget(parent) self.widgets = [QLabel('&'+self.col_metadata['name']+':', w), w] l = QHBoxLayout() l.setContentsMargins(0, 0, 0, 0) w.setLayout(l) self.main_widget = main_widget_class(w) l.addWidget(self.main_widget) l.setStretchFactor(self.main_widget, 10) if add_tags_edit_button: self.edit_tags_button = QToolButton(parent) self.edit_tags_button.setToolTip(_('Open Item Editor')) self.edit_tags_button.setIcon(QIcon(I('chapters.png'))) l.addWidget(self.edit_tags_button) self.a_c_checkbox = QCheckBox(_('Apply changes'), w) l.addWidget(self.a_c_checkbox) self.ignore_change_signals = True # connect to the various changed signals so we can auto-update the # apply changes checkbox if hasattr(self.main_widget, 'editTextChanged'): # editable combobox widgets self.main_widget.editTextChanged.connect(self.a_c_checkbox_changed) if hasattr(self.main_widget, 'textChanged'): # lineEdit widgets self.main_widget.textChanged.connect(self.a_c_checkbox_changed) if hasattr(self.main_widget, 'currentIndexChanged'): # combobox widgets self.main_widget.currentIndexChanged[int].connect(self.a_c_checkbox_changed) if hasattr(self.main_widget, 'valueChanged'): # spinbox widgets self.main_widget.valueChanged.connect(self.a_c_checkbox_changed) if hasattr(self.main_widget, 'dateTimeChanged'): # dateEdit widgets self.main_widget.dateTimeChanged.connect(self.a_c_checkbox_changed)
def get_search_widget(self): """ Create and return the search QWidget :return: search QWidget :rtype: QWidget """ widget = QWidget() layout = QHBoxLayout() layout.setSpacing(0) layout.setContentsMargins(5, 20, 5, 10) widget.setLayout(layout) # Search label search_lbl = QLabel(_('Search Problems')) search_lbl.setObjectName('bordertitle') search_lbl.setFixedHeight(25) search_lbl.setToolTip(_('Search Problems')) layout.addWidget(search_lbl) # QLineEdit self.line_search.setFixedHeight(search_lbl.height()) self.line_search.setPlaceholderText( _('Type text to filter problems...')) layout.addWidget(self.line_search) # Refresh button refresh_btn = QPushButton(_('Refresh')) refresh_btn.setObjectName('ok') refresh_btn.setFixedSize(120, search_lbl.height()) refresh_btn.setToolTip(_('Refresh problems')) refresh_btn.clicked.connect(self.update_problems_data) layout.addWidget(refresh_btn) return widget
def __init__(self, main): super(MainWidget, self).__init__() self.main_win = main self.setObjectName("MainWidget") v_layout = QVBoxLayout() label = QLabel(self) label.setAlignment(Qt.AlignCenter) movie = QMovie("main_bg.gif") label.setMovie(movie) movie.start() v_layout.addWidget(label) h_layout = QHBoxLayout() btn1 = QPushButton("愛") btn1.setFixedWidth(30) btn1.clicked.connect(self.sub_pack) h_layout.addWidget(btn1, alignment=Qt.AlignLeft | Qt.AlignBottom) btn2 = QPushButton("嫌") btn2.setFixedWidth(30) btn2.clicked.connect(self.to_pack) h_layout.addWidget(btn2, alignment=Qt.AlignRight | Qt.AlignBottom) v_layout.addLayout(h_layout) self.setLayout(v_layout)
def __init__(self, plugin_action): QWidget.__init__(self) self.plugin_action = plugin_action self.gui = plugin_action.gui self.library = get_library_config(self.gui.current_db) self.views = self.library[KEY_VIEWS] self.all_columns = self.get_current_columns() self.view_name = None self.has_pin_view = hasattr(self.gui.library_view, 'pin_view') toplayout = QVBoxLayout(self) self.setLayout(toplayout) ## wrap config in a scrollable area for smaller displays. scrollable = QScrollArea() scrollcontent = QWidget() scrollable.setWidget(scrollcontent) scrollable.setWidgetResizable(True) toplayout.addWidget(scrollable) layout = QVBoxLayout() scrollcontent.setLayout(layout) select_view_layout = QHBoxLayout() layout.addLayout(select_view_layout) select_view_label = QLabel('Select view to customize:', self) select_view_layout.addWidget(select_view_label) self.select_view_combo = ViewComboBox(self, self.views) self.select_view_combo.setMinimumSize(150, 20) select_view_layout.addWidget(self.select_view_combo) self.add_view_button = QtGui.QToolButton(self) self.add_view_button.setToolTip('Add view') self.add_view_button.setIcon(QIcon(I('plus.png'))) self.add_view_button.clicked.connect(self.add_view) select_view_layout.addWidget(self.add_view_button) self.delete_view_button = QtGui.QToolButton(self) self.delete_view_button.setToolTip('Delete view') self.delete_view_button.setIcon(QIcon(I('minus.png'))) self.delete_view_button.clicked.connect(self.delete_view) select_view_layout.addWidget(self.delete_view_button) self.rename_view_button = QtGui.QToolButton(self) self.rename_view_button.setToolTip('Rename view') self.rename_view_button.setIcon(QIcon(I('edit-undo.png'))) self.rename_view_button.clicked.connect(self.rename_view) select_view_layout.addWidget(self.rename_view_button) select_view_layout.insertStretch(-1) view_group_box = QGroupBox('Column Options', self) layout.addWidget(view_group_box) view_group_box_layout = QVBoxLayout() view_group_box.setLayout(view_group_box_layout) customise_layout = QGridLayout() view_group_box_layout.addLayout(customise_layout, 1) if self.has_pin_view: columns_label = 'Columns in Default (Left) pane' else: columns_label = 'Columns in view' self.columns_label = QLabel(columns_label, self) self.columns_list = ColumnListWidget(self, self.gui) self.move_column_up_button = QtGui.QToolButton(self) self.move_column_up_button.setToolTip('Move column up') self.move_column_up_button.setIcon(QIcon(I('arrow-up.png'))) self.move_column_down_button = QtGui.QToolButton(self) self.move_column_down_button.setToolTip('Move column down') self.move_column_down_button.setIcon(QIcon(I('arrow-down.png'))) self.move_column_up_button.clicked.connect( self.columns_list.move_column_up) self.move_column_down_button.clicked.connect( self.columns_list.move_column_down) if self.has_pin_view: self.apply_pin_columns_checkbox = QCheckBox( 'Columns in Split (Right) Pane', self) self.apply_pin_columns_checkbox.setToolTip( 'Split Book List will <i>only</i> be shown if this is checked. This will be checked if you save a Split View.' ) self.pin_columns_list = ColumnListWidget(self, self.gui) self.move_pin_column_up_button = QtGui.QToolButton(self) self.move_pin_column_up_button.setToolTip('Move column up') self.move_pin_column_up_button.setIcon(QIcon(I('arrow-up.png'))) self.move_pin_column_down_button = QtGui.QToolButton(self) self.move_pin_column_down_button.setToolTip('Move column down') self.move_pin_column_down_button.setIcon(QIcon( I('arrow-down.png'))) self.move_pin_column_up_button.clicked.connect( self.pin_columns_list.move_column_up) self.move_pin_column_down_button.clicked.connect( self.pin_columns_list.move_column_down) def group_abled(elems, cb): for el in elems: el.setEnabled(cb.isChecked()) pin_abled = partial(group_abled, [ self.pin_columns_list, self.move_pin_column_up_button, self.move_pin_column_down_button ], self.apply_pin_columns_checkbox) pin_abled() self.apply_pin_columns_checkbox.stateChanged.connect(pin_abled) self.sort_label = QLabel('Sort order', self) self.sort_list = SortColumnListWidget(self, self.gui) self.move_sort_up_button = QtGui.QToolButton(self) self.move_sort_up_button.setToolTip('Move sort column up') self.move_sort_up_button.setIcon(QIcon(I('arrow-up.png'))) self.move_sort_down_button = QtGui.QToolButton(self) self.move_sort_down_button.setToolTip('Move sort down') self.move_sort_down_button.setIcon(QIcon(I('arrow-down.png'))) self.move_sort_up_button.clicked.connect(self.sort_list.move_column_up) self.move_sort_down_button.clicked.connect( self.sort_list.move_column_down) layout_col = 0 # calculate layout because pin column only shown if available. customise_layout.addWidget(self.columns_label, 0, layout_col, 1, 1) customise_layout.addWidget(self.columns_list, 1, layout_col, 3, 1) layout_col = layout_col + 1 customise_layout.addWidget(self.move_column_up_button, 1, layout_col, 1, 1) customise_layout.addWidget(self.move_column_down_button, 3, layout_col, 1, 1) layout_col = layout_col + 1 if self.has_pin_view: customise_layout.addWidget(self.apply_pin_columns_checkbox, 0, layout_col, 1, 1) customise_layout.addWidget(self.pin_columns_list, 1, layout_col, 3, 1) layout_col = layout_col + 1 customise_layout.addWidget(self.move_pin_column_up_button, 1, layout_col, 1, 1) customise_layout.addWidget(self.move_pin_column_down_button, 3, layout_col, 1, 1) layout_col = layout_col + 1 customise_layout.addWidget(self.sort_label, 0, layout_col, 1, 1) customise_layout.addWidget(self.sort_list, 1, layout_col, 3, 1) layout_col = layout_col + 1 customise_layout.addWidget(self.move_sort_up_button, 1, layout_col, 1, 1) customise_layout.addWidget(self.move_sort_down_button, 3, layout_col, 1, 1) layout_col = layout_col + 1 search_group_box = QGroupBox("Search and Virtual Library Options", self) layout.addWidget(search_group_box) search_group_box_layout = QVBoxLayout() search_group_box.setLayout(search_group_box_layout) other_layout = QGridLayout() search_group_box_layout.addLayout(other_layout) self.apply_search_checkbox = QCheckBox('Apply saved &search', self) self.apply_search_checkbox.setToolTip( "Apply the selected saved search when the View is activated.") self.saved_search_combo = SearchComboBox( self, entries=saved_searches().names(), empty="(Clear Search)") self.saved_search_combo.setToolTip("Saved search to apply.") # enable/disable combo based on check. self.saved_search_combo.setEnabled( self.apply_search_checkbox.isChecked()) self.apply_search_checkbox.stateChanged.connect( lambda x: self.saved_search_combo.setEnabled( self.apply_search_checkbox.isChecked())) self.apply_virtlib_checkbox = QCheckBox('Switch to &Virtual library', self) self.apply_virtlib_checkbox.setToolTip( "Switch to the selected Virtual library when the View is activated." ) self.virtlib_combo = SearchComboBox( self, entries=self.gui.library_view.model().db.prefs.get( 'virtual_libraries', {}), empty="(No Virtual library)") self.virtlib_combo.setToolTip("Virtual library to switch to.") # enable/disable combo based on check. self.virtlib_combo.setEnabled(self.apply_virtlib_checkbox.isChecked()) self.apply_virtlib_checkbox.stateChanged.connect( lambda x: self.virtlib_combo.setEnabled(self.apply_virtlib_checkbox .isChecked())) self.apply_restriction_checkbox = QCheckBox( 'Apply VL additional search &restriction', self) self.apply_restriction_checkbox.setToolTip( "Apply the selected saved search as a Virtual library additional restriction when the View is activated." ) self.search_restriction_combo = SearchComboBox( self, entries=saved_searches().names(), empty="(Clear VL restriction search)") self.search_restriction_combo.setToolTip( "Saved search to apply as VL additional search restriction.") # enable/disable combo based on check. self.search_restriction_combo.setEnabled( self.apply_restriction_checkbox.isChecked()) self.apply_restriction_checkbox.stateChanged.connect( lambda x: self.search_restriction_combo.setEnabled( self.apply_restriction_checkbox.isChecked())) other_layout.addWidget(self.apply_search_checkbox, 0, 0, 1, 1) other_layout.addWidget(self.saved_search_combo, 0, 1, 1, 1) other_layout.addWidget(self.apply_virtlib_checkbox, 1, 0, 1, 1) other_layout.addWidget(self.virtlib_combo, 1, 1, 1, 1) other_layout.addWidget(self.apply_restriction_checkbox, 2, 0, 1, 1) other_layout.addWidget(self.search_restriction_combo, 2, 1, 1, 1) # other_layout.setRowStretch(4, 1) #layout.addSpacing(10) other_group_box = QGroupBox('General Options', self) layout.addWidget(other_group_box) other_group_box_layout = QGridLayout() other_group_box.setLayout(other_group_box_layout) self.jump_to_top_checkbox = QCheckBox( 'Jump to the top when applying this View', self) jump_to_top = self.library.get(KEY_JUMP_TO_TOP, False) self.jump_to_top_checkbox.setCheckState( Qt.Checked if jump_to_top else Qt.Unchecked) restart_label = QLabel( 'When restarting Calibre or switching to this library...') self.auto_apply_checkbox = QCheckBox('&Automatically apply view:', self) auto_apply = self.library.get(KEY_AUTO_APPLY_VIEW, False) self.auto_apply_checkbox.setCheckState( Qt.Checked if auto_apply else Qt.Unchecked) self.auto_view_combo = ViewComboBox(self, self.views, special=LAST_VIEW_ITEM) self.auto_view_combo.select_view( self.library.get(KEY_VIEW_TO_APPLY, LAST_VIEW_ITEM)) self.auto_view_combo.setMinimumSize(150, 20) info_apply_label = QLabel( 'Enabling this option may override any startup search restriction or ' 'title sort set in Preferences -> Behaviour/Tweaks.') info_apply_label.setWordWrap(True) other_group_box_layout.addWidget(self.jump_to_top_checkbox, 0, 0, 1, 2) other_group_box_layout.addWidget(restart_label, 1, 0, 1, 2) other_group_box_layout.addWidget(self.auto_apply_checkbox, 2, 0, 1, 1) other_group_box_layout.addWidget(self.auto_view_combo, 2, 1, 1, 1) other_group_box_layout.addWidget(info_apply_label, 3, 0, 1, 2) #other_group_box.setMaximumHeight(other_group_box.sizeHint().height()) keyboard_layout = QHBoxLayout() layout.addLayout(keyboard_layout) 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) 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) keyboard_layout.addWidget(keyboard_shortcuts_button) keyboard_layout.addWidget(view_prefs_button) keyboard_layout.addStretch(1) # Force an initial display of view information if KEY_LAST_VIEW in list(self.library.keys()): last_view = self.library[KEY_LAST_VIEW] if last_view in self.views: self.select_view_combo.select_view(self.library[KEY_LAST_VIEW]) self.select_view_combo_index_changed(save_previous=False) self.select_view_combo.currentIndexChanged.connect( partial(self.select_view_combo_index_changed, save_previous=True))
def __init__(self, main): super(GameListWidget, self).__init__() self.main_win = main self.keystore_exchanged = False self.setObjectName("GameListWidget") v_layout = QVBoxLayout() h_layout1 = QHBoxLayout() self.game_list_view = QListView() self.game_list_view.setViewMode(QListView.ListMode) self.game_list_view.setEditTriggers(QAbstractItemView.NoEditTriggers) self.game_list_model = GameListModel(self.main_win.games) self.game_list_view.setModel(self.game_list_model) self.game_list_view.clicked.connect(self.list_item_onclick) h_layout1.addWidget(self.game_list_view, 1) self.game_list_view.setCurrentIndex( self.game_list_model.index(self.main_win.game_index)) self.game = self.main_win.games[self.main_win.game_index] form_layout = QFormLayout() form_layout.setContentsMargins(20, 50, 20, 50) self.game_name_value = QLineEdit() form_layout.addRow("游戏名称:", self.game_name_value) self.game_desc_value = QTextEdit() form_layout.addRow("游戏简介:", self.game_desc_value) self.game_appid_value = QLabel() self.game_appid_value.setTextInteractionFlags(Qt.TextSelectableByMouse) form_layout.addRow("游戏ID:", self.game_appid_value) self.game_appkey_value = QLabel() self.game_appkey_value.setTextInteractionFlags( Qt.TextSelectableByMouse) form_layout.addRow("客户端Key:", self.game_appkey_value) h_layout = QHBoxLayout() self.keystore_path = QLineEdit() select_key_btn = QPushButton("浏览") select_key_btn.setStyleSheet('QPushButton{border-radius: 0px;}') select_key_btn.clicked.connect(self.select_ketstore) h_layout.addWidget(self.keystore_path) h_layout.addWidget(select_key_btn) form_layout.addRow("KeyStore:", h_layout) self.keystore_pwd_value = QLineEdit() form_layout.addRow("KeyPass:"******"Alias:", self.keystore_alias_value) self.keystore_aliaspwd_value = QLineEdit() form_layout.addRow("AliasPass:"******"更换Icon") icon_exchange_btn.setFixedWidth(100) icon_exchange_btn.clicked.connect(self.exchange_icon) v_layout1.addWidget(icon_exchange_btn, alignment=Qt.AlignHCenter) v_layout1.addStretch(2) h_layout1.addLayout(v_layout1, 1) v_layout.addLayout(h_layout1) h_layout2 = QHBoxLayout() create_game_btn = QPushButton("返 回") create_game_btn.setFixedWidth(100) create_game_btn.clicked.connect(self.back) h_layout2.addWidget(create_game_btn, alignment=Qt.AlignLeft | Qt.AlignBottom) back_btn = QPushButton("创建游戏") back_btn.setFixedWidth(100) back_btn.clicked.connect(self.add_game) h_layout2.addWidget(back_btn, alignment=Qt.AlignHCenter) next_btn = QPushButton("下一步") next_btn.setFixedWidth(100) next_btn.clicked.connect(self.next) h_layout2.addWidget(next_btn, alignment=Qt.AlignRight | Qt.AlignBottom) v_layout.addLayout(h_layout2) self.setLayout(v_layout) self.set_game_info()
def __init__(self, parent): QWidget.__init__(self, parent) self.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Preferred) parent = parent.parent() self.l = l = QHBoxLayout(self) l.setContentsMargins(0, 0, 0, 0) self.alter_tb = parent.alter_tb = b = QToolButton(self) b.setAutoRaise(True) b.setText(_('Configure')), b.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) b.setCursor(Qt.PointingHandCursor) b.setPopupMode(b.InstantPopup) b.setToolTip(textwrap.fill(_( 'Change how the Tag browser works, such as,' ' how it is sorted, what happens when you click' ' items, etc.' ))) b.setIcon(QIcon(I('config.png'))) b.m = QMenu() b.setMenu(b.m) self.item_search = FindBox(parent) self.item_search.setMinimumContentsLength(5) self.item_search.setSizeAdjustPolicy(self.item_search.AdjustToMinimumContentsLengthWithIcon) self.item_search.initialize('tag_browser_search') self.item_search.completer().setCaseSensitivity(Qt.CaseSensitive) self.item_search.setToolTip( '<p>' +_( 'Search for items. If the text begins with equals (=) the search is ' 'exact match, otherwise it is "contains" finding items containing ' 'the text anywhere in the item name. Both exact and contains ' 'searches ignore case. You can limit the search to particular ' 'categories using syntax similar to search. For example, ' 'tags:foo will find foo in any tag, but not in authors etc. Entering ' '*foo will collapse all categories then showing only those categories ' 'with items containing the text "foo"') + '</p') ac = QAction(parent) parent.addAction(ac) parent.keyboard.register_shortcut('tag browser find box', _('Find next match'), default_keys=(), action=ac, group=_('Tag browser')) ac.triggered.connect(self.set_focus_to_find_box) self.search_button = QToolButton() self.search_button.setAutoRaise(True) self.search_button.setCursor(Qt.PointingHandCursor) self.search_button.setIcon(QIcon(I('search.png'))) self.search_button.setToolTip(_('Find the first/next matching item')) ac = QAction(parent) parent.addAction(ac) parent.keyboard.register_shortcut('tag browser find button', _('Find in Tag browser'), default_keys=(), action=ac, group=_('Tag browser')) ac.triggered.connect(self.search_button.click) self.toggle_search_button = b = QToolButton(self) le = self.item_search.lineEdit() le.addAction(QIcon(I('window-close.png')), le.LeadingPosition).triggered.connect(self.close_find_box) b.setText(_('Find')), b.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) b.setCursor(Qt.PointingHandCursor) b.setIcon(QIcon(I('search.png'))) b.setCheckable(True) b.setChecked(gprefs.get('tag browser search box visible', False)) b.setToolTip(_('Search for items in the Tag browser')) b.setAutoRaise(True) b.toggled.connect(self.update_searchbar_state) self.update_searchbar_state()
def __init__(self, parent): QWidget.__init__(self, parent) self.l = l = QFormLayout(self) l.setFieldGrowthPolicy(l.ExpandingFieldsGrow) self.hm = hm = QLabel( _('Create a basic news recipe, by adding RSS feeds to it.\n' 'For some news sources, you will have to use the "Switch to advanced mode" ' 'button below to further customize the fetch process.')) hm.setWordWrap(True) l.addRow(hm) self.title = t = QLineEdit(self) l.addRow(_('Recipe &title:'), t) t.setStyleSheet('QLineEdit { font-weight: bold }') self.oldest_article = o = QSpinBox(self) o.setSuffix(' ' + _('day(s)')) o.setToolTip(_("The oldest article to download")) o.setMinimum(1), o.setMaximum(36500) l.addRow(_('&Oldest article:'), o) self.max_articles = m = QSpinBox(self) m.setMinimum(5), m.setMaximum(100) m.setToolTip(_("Maximum number of articles to download per feed.")) l.addRow(_("&Max. number of articles per feed:"), m) self.fg = fg = QGroupBox(self) fg.setTitle(_("Feeds in recipe")) self.feeds = f = QListWidget(self) fg.h = QHBoxLayout(fg) fg.h.addWidget(f) fg.l = QVBoxLayout() self.up_button = b = QToolButton(self) b.setIcon(QIcon(I('arrow-up.png'))) b.setToolTip(_('Move selected feed up')) fg.l.addWidget(b) b.clicked.connect(self.move_up) self.remove_button = b = QToolButton(self) b.setIcon(QIcon(I('list_remove.png'))) b.setToolTip(_('Remove selected feed')) fg.l.addWidget(b) b.clicked.connect(self.remove_feed) self.down_button = b = QToolButton(self) b.setIcon(QIcon(I('arrow-down.png'))) b.setToolTip(_('Move selected feed down')) fg.l.addWidget(b) b.clicked.connect(self.move_down) fg.h.addLayout(fg.l) l.addRow(fg) self.afg = afg = QGroupBox(self) afg.setTitle(_('Add feed to recipe')) afg.l = QFormLayout(afg) afg.l.setFieldGrowthPolicy(l.ExpandingFieldsGrow) self.feed_title = ft = QLineEdit(self) afg.l.addRow(_('&Feed title:'), ft) self.feed_url = fu = QLineEdit(self) afg.l.addRow(_('Feed &URL:'), fu) self.afb = b = QPushButton(QIcon(I('plus.png')), _('&Add feed'), self) b.setToolTip(_('Add this feed to the recipe')) b.clicked.connect(self.add_feed) afg.l.addRow(b) l.addRow(afg)
def __init__(self, parent=None, one_line_toolbar=False, toolbar_prefs_name=None): QWidget.__init__(self, parent) self.toolbar_prefs_name = toolbar_prefs_name or self.toolbar_prefs_name self.toolbar1 = QToolBar(self) self.toolbar2 = QToolBar(self) self.toolbar3 = QToolBar(self) for i in range(1, 4): t = getattr(self, 'toolbar%d' % i) t.setIconSize(QSize(18, 18)) self.editor = EditorWidget(self) self.editor.data_changed.connect(self.data_changed) self.set_base_url = self.editor.set_base_url self.set_html = self.editor.set_html self.tabs = QTabWidget(self) self.tabs.setTabPosition(self.tabs.South) self.wyswyg = QWidget(self.tabs) self.code_edit = QPlainTextEdit(self.tabs) self.source_dirty = False self.wyswyg_dirty = True self._layout = QVBoxLayout(self) self.wyswyg.layout = l = QVBoxLayout(self.wyswyg) self.setLayout(self._layout) l.setContentsMargins(0, 0, 0, 0) if one_line_toolbar: tb = QHBoxLayout() l.addLayout(tb) else: tb = l tb.addWidget(self.toolbar1) tb.addWidget(self.toolbar2) tb.addWidget(self.toolbar3) l.addWidget(self.editor) self._layout.addWidget(self.tabs) self.tabs.addTab(self.wyswyg, _('N&ormal view')) self.tabs.addTab(self.code_edit, _('&HTML source')) self.tabs.currentChanged[int].connect(self.change_tab) self.highlighter = Highlighter(self.code_edit.document()) self.layout().setContentsMargins(0, 0, 0, 0) if self.toolbar_prefs_name is not None: hidden = gprefs.get(self.toolbar_prefs_name) if hidden: self.hide_toolbars() # toolbar1 {{{ self.toolbar1.addAction(self.editor.action_undo) self.toolbar1.addAction(self.editor.action_redo) self.toolbar1.addAction(self.editor.action_select_all) self.toolbar1.addAction(self.editor.action_remove_format) self.toolbar1.addAction(self.editor.action_clear) self.toolbar1.addSeparator() for x in ('copy', 'cut', 'paste'): ac = getattr(self.editor, 'action_' + x) self.toolbar1.addAction(ac) self.toolbar1.addSeparator() self.toolbar1.addAction(self.editor.action_background) # }}} # toolbar2 {{{ for x in ('', 'un'): ac = getattr(self.editor, 'action_%sordered_list' % x) self.toolbar2.addAction(ac) self.toolbar2.addSeparator() for x in ('superscript', 'subscript', 'indent', 'outdent'): self.toolbar2.addAction(getattr(self.editor, 'action_' + x)) if x in ('subscript', 'outdent'): self.toolbar2.addSeparator() self.toolbar2.addAction(self.editor.action_block_style) w = self.toolbar2.widgetForAction(self.editor.action_block_style) if hasattr(w, 'setPopupMode'): w.setPopupMode(w.InstantPopup) self.toolbar2.addAction(self.editor.action_insert_link) self.toolbar2.addAction(self.editor.action_insert_hr) # }}} # toolbar3 {{{ for x in ('bold', 'italic', 'underline', 'strikethrough'): ac = getattr(self.editor, 'action_' + x) self.toolbar3.addAction(ac) self.toolbar3.addSeparator() for x in ('left', 'center', 'right', 'justified'): ac = getattr(self.editor, 'action_align_' + x) self.toolbar3.addAction(ac) self.toolbar3.addSeparator() self.toolbar3.addAction(self.editor.action_color) # }}} self.code_edit.textChanged.connect(self.code_dirtied) self.editor.page().contentsChanged.connect(self.wyswyg_dirtied)
def __init__(self, parent_dialog, plugin_action): self.parent_dialog = parent_dialog self.plugin_action = plugin_action QWidget.__init__(self) self.l = QVBoxLayout() self.setLayout(self.l) label = QLabel( _('These settings control the basic features of the plugin.')) label.setWordWrap(True) self.l.addWidget(label) self.l.addSpacing(5) self.titlenavpoints = QCheckBox( _('Insert Table of Contents entry for each title?'), self) self.titlenavpoints.setToolTip( _('''If set, a new TOC entry will be made for each title and it's existing TOC nested underneath it.''')) self.titlenavpoints.setChecked(prefs['titlenavpoints']) self.l.addWidget(self.titlenavpoints) self.originalnavpoints = QCheckBox( _('Copy Table of Contents entries from each input epub?'), self) self.originalnavpoints.setToolTip( _('''If set, the original TOC entries will be merged into the new epub.''' )) self.originalnavpoints.setChecked(prefs['originalnavpoints']) self.l.addWidget(self.originalnavpoints) self.flattentoc = QCheckBox(_('Flatten Table of Contents?'), self) self.flattentoc.setToolTip( _('Remove nesting and make TOC all on one level.')) self.flattentoc.setChecked(prefs['flattentoc']) self.l.addWidget(self.flattentoc) self.includecomments = QCheckBox(_("Include Books' Comments?"), self) self.includecomments.setToolTip( _('''Include all the merged books' comments in the new book's comments. Default is a list of included titles only.''')) self.includecomments.setChecked(prefs['includecomments']) self.l.addWidget(self.includecomments) self.keepmeta = QCheckBox(_('Keep UnMerge Metadata?'), self) self.keepmeta.setToolTip( _('''If set, a copy of the original metadata for each merged book will be included, allowing for UnMerge. This includes your calibre custom columns. Leave off if you plan to distribute the epub to others.''')) self.keepmeta.setChecked(prefs['keepmeta']) self.l.addWidget(self.keepmeta) # self.showunmerge = QCheckBox(_('Show UnMerge Option?'),self) # self.showunmerge.setToolTip(_('''If set, the UnMerge Epub option will be shown on the EpubMerge menu. # Only Epubs merged with 'Keep UnMerge Metadata' can be UnMerged.''')) # self.showunmerge.setChecked(prefs['showunmerge']) # self.l.addWidget(self.showunmerge) horz = QHBoxLayout() horz.addWidget(QLabel(_("Add tags to merged books:"))) self.mergetags = QLineEdit(self) self.mergetags.setText(prefs['mergetags']) self.mergetags.setToolTip( _('Tags you enter here will be added to all new merged books')) horz.addWidget(self.mergetags) self.l.addLayout(horz) horz = QHBoxLayout() horz.addWidget(QLabel(_("Merged Book Word:"))) self.mergeword = QLineEdit(self) self.mergeword.setText(prefs['mergeword']) self.mergeword.setToolTip( _('''Word use to describe merged books in default title and summary. For people who don't like the word Anthology.''')) ## Defaults back to Anthology if cleared. horz.addWidget(self.mergeword) self.l.addLayout(horz) self.l.addSpacing(15) label = QLabel( _("These controls aren't plugin settings as such, but convenience buttons for setting Keyboard shortcuts and getting all the EpubMerge confirmation dialogs back again." )) label.setWordWrap(True) self.l.addWidget(label) self.l.addSpacing(5) keyboard_shortcuts_button = QPushButton(_('Keyboard shortcuts...'), self) keyboard_shortcuts_button.setToolTip( _('Edit the keyboard shortcuts associated with this plugin')) keyboard_shortcuts_button.clicked.connect(parent_dialog.edit_shortcuts) self.l.addWidget(keyboard_shortcuts_button) reset_confirmation_button = QPushButton( _('Reset disabled &confirmation dialogs'), self) reset_confirmation_button.setToolTip( _('Reset all show me again dialogs for the EpubMerge plugin')) reset_confirmation_button.clicked.connect(self.reset_dialogs) self.l.addWidget(reset_confirmation_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) self.l.addWidget(view_prefs_button) self.l.insertStretch(-1)