def __init__(self, *args): QWidget.__init__(self, *args) lo = QHBoxLayout(self) lo.setContentsMargins(0, 0, 0, 0) lo.setSpacing(5) # type selector self.wtypesel = QComboBox(self) for i, tp in enumerate(self.ValueTypes): self.wtypesel.addItem(tp.__name__) QObject.connect(self.wtypesel, SIGNAL("activated(int)"), self._selectTypeNum) typesel_lab = QLabel("&Type:", self) typesel_lab.setBuddy(self.wtypesel) lo.addWidget(typesel_lab, 0) lo.addWidget(self.wtypesel, 0) self.wvalue = QLineEdit(self) self.wvalue_lab = QLabel("&Value:", self) self.wvalue_lab.setBuddy(self.wvalue) self.wbool = QComboBox(self) self.wbool.addItems(["false", "true"]) self.wbool.setCurrentIndex(1) lo.addWidget(self.wvalue_lab, 0) lo.addWidget(self.wvalue, 1) lo.addWidget(self.wbool, 1) self.wvalue.hide() # make input validators self._validators = {int: QIntValidator(self), float: QDoubleValidator(self)} # select bool type initially self._selectTypeNum(0)
def __init__(self, parent): QWidget.__init__(self, parent) self._radius = 350 self._gw_distance = 2 * self._radius self._bus_distance = 4 * self._radius self._last_bus_pos = [0, 0] self._last_bus_steps = [0, 0] self._bus_node = {} self._bus_position = {} self._ecu_terminals = {} self._ecu_position = {} self._ecu_node = {} self._show_dict = {} self.lastClicked = [] self._all_points = [] self.create_widgets(parent) self.map_points = {} self.COLOR_ECU_AUTH = (255, 0, 0) self.COLOR_STR_AUTH = (0, 255, 0) self.COLOR_SIMPLE = (0, 0, 255) self.COLOR_PROCESS = (123, 123, 0) self.COLOR_PROCESS_2 = (0, 123, 123) self._init_categories() self._mode = 'LW_AUTH' self._pts_ecu = {}
def __init__(self, parent, label, filename=None, dialog_label=None, file_types=None, default_suffix=None, file_mode=QFileDialog.AnyFile): QWidget.__init__(self, parent) lo = QHBoxLayout(self) lo.setContentsMargins(0, 0, 0, 0) lo.setSpacing(5) # label lab = QLabel(label, self) lo.addWidget(lab, 0) # text field self.wfname = QLineEdit(self) self.wfname.setReadOnly(True) self.setFilename(filename) lo.addWidget(self.wfname, 1) # selector wsel = QToolButton(self) wsel.setText("Choose...") QObject.connect(wsel, SIGNAL("clicked()"), self._chooseFile) lo.addWidget(wsel, 0) # other init self._file_dialog = None self._dialog_label = dialog_label or label self._file_types = file_types or "All files (*)" self._file_mode = file_mode self._default_suffix = default_suffix self._dir = None
def __init__(self, plugin): QWidget.__init__(self) self.plugin = plugin self.l = l = QGridLayout() self.setLayout(l) self.gb = QGroupBox(_('Downloaded metadata fields'), 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): QWidget.__init__(self) self.ui = Ui_KeyboardWidget() self.ui.setupUi(self) index = 0 # comboBox.addItem doesn't increase the currentIndex self.default_layout_index = None locales = sorted([(country, data) for country, data in yali.localedata.locales.items()]) for country, data in locales: if data["xkbvariant"]: i = 0 for variant in data["xkbvariant"]: _d = dict(data) _d["xkbvariant"] = variant[0] _d["name"] = variant[1] _d["consolekeymap"] = data["consolekeymap"][i] self.ui.keyboard_list.addItem(_d["name"], QVariant(_d)) i += 1 else: self.ui.keyboard_list.addItem(data["name"], QVariant(data)) if ctx.consts.lang == country: if ctx.consts.lang == "tr": self.default_layout_index = index + 1 else: self.default_layout_index = index index += 1 self.ui.keyboard_list.setCurrentIndex(self.default_layout_index) self.connect(self.ui.keyboard_list, SIGNAL("currentIndexChanged(int)"), self.slotLayoutChanged)
def __init__(self): QWidget.__init__(self) self.ui = Ui_InstallWidget() self.ui.setupUi(self) self.installProgress = InstallProgressWidget(self) self.timer = QTimer(self) QObject.connect(self.timer, SIGNAL("timeout()"), self.changeSlideshows) self.poll_timer = QTimer(self) QObject.connect(self.poll_timer, SIGNAL("timeout()"), self.checkQueueEvent) if ctx.consts.lang == "tr": self.installProgress.ui.progress.setFormat("%%p") self.iter_slideshows = iter_slideshows() # show first pic self.changeSlideshows() self.total = 0 self.cur = 0 self.has_errors = False # mutual exclusion self.mutex = None self.wait_condition = None self.queue = None self.retry_answer = False self.sys_copier = None
def __init__(self, gui): QWidget.__init__(self, gui) self.setObjectName('jobs_pointer') self.setVisible(False) self.resize(100, 80) self.animation = QPropertyAnimation(self, "geometry", self) self.animation.setDuration(750) self.animation.setLoopCount(2) self.animation.setEasingCurve(QEasingCurve.Linear) self.animation.finished.connect(self.hide) taily, heady = 0, 55 self.arrow_path = QPainterPath(QPointF(40, taily)) self.arrow_path.lineTo(40, heady) self.arrow_path.lineTo(20, heady) self.arrow_path.lineTo(50, self.height()) self.arrow_path.lineTo(80, heady) self.arrow_path.lineTo(60, heady) self.arrow_path.lineTo(60, taily) self.arrow_path.closeSubpath() c = self.palette().color(QPalette.Active, QPalette.WindowText) self.color = QColor(c) self.color.setAlpha(100) self.brush = QBrush(self.color, Qt.SolidPattern)
def __init__(self, motor, glpane): QWidget.__init__(self) self.setupUi(self) self.connect(self.cancel_btn,SIGNAL("clicked()"),self.reject) self.connect(self.ok_btn,SIGNAL("clicked()"),self.accept) self.connect(self.choose_color_btn,SIGNAL("clicked()"),self.change_jig_color) self.connect(self.lengthLineEdit,SIGNAL("returnPressed()"),self.change_motor_size) self.connect(self.radiusLineEdit,SIGNAL("returnPressed()"),self.change_motor_size) self.connect(self.sradiusLineEdit,SIGNAL("returnPressed()"),self.change_motor_size) self.jig = motor self.glpane = glpane self.nameLineEdit.setWhatsThis("""<b>Name</b><p>Name of Rotary Motor that appears in the Model Tree</p>""") self.torqueLineEdit.setWhatsThis("""<b>Torque </b><p>Simulations will begin with the motor's torque set to this value.</p>""") self.speedLineEdit.setWhatsThis("""<b>Final Speed</b><p>The final velocity of the motor's flywheel during simulations.</p>""") self.initialSpeedLineEdit.setWhatsThis("""<b>Initial Speed</b><p>Simulations will begin with the motor's flywheel rotating at this velocity.</p>""") self.dampers_textlabel.setWhatsThis("""<b>Dampers</b><p>If checked, the dampers are enabled for this motor during a simulation. See the Rotary Motor web page on the NanoEngineer-1 Wiki for more information.</p>""") self.textLabel1_5.setWhatsThis("""<b>Enable in Minimize <i>(experimental)</i></b><p>If checked, the torque specified above will be applied to the motor atoms during a structure minimization. While intended to allow simulations to begin with rotary motors running at speed, this feature requires more work to be useful.</p>""") self.dampers_checkbox.setWhatsThis("""<b>Dampers</b><p>If checked, the dampers are enabled for this motor during a simulation. See the Rotary Motor web page on the NanoEngineer-1 Wiki for more information.</p>""") self.enable_minimize_checkbox.setWhatsThis("""<b>Enable in Minimize <i>(experimental)</i></b><p>If checked, the torque specified above will be applied to the motor atoms during a structure minimization. While intended to allow simulations to begin with rotary motors running at speed, this feature requires more work to be useful.</p>""")
def __init__(self, parent=None): QWidget.__init__(self, parent) self.l = l = QGridLayout(self) self.setLayout(l) l.setContentsMargins(0, 0, 0, 0) self.view = QTreeWidget(self) self.delegate = Delegate(self.view) self.view.setItemDelegate(self.delegate) self.view.setHeaderHidden(True) self.view.setAnimated(True) self.view.setContextMenuPolicy(Qt.CustomContextMenu) self.view.customContextMenuRequested.connect(self.show_context_menu, type=Qt.QueuedConnection) self.view.itemActivated.connect(self.emit_navigate) self.view.itemPressed.connect(self.item_pressed) pi = plugins['progress_indicator'][0] if hasattr(pi, 'set_no_activate_on_click'): pi.set_no_activate_on_click(self.view) self.view.itemDoubleClicked.connect(self.emit_navigate) l.addWidget(self.view) self.refresh_action = QAction(QIcon(I('view-refresh.png')), _('&Refresh'), self) self.refresh_action.triggered.connect(self.refresh) self.refresh_timer = t = QTimer(self) t.setInterval(1000), t.setSingleShot(True) t.timeout.connect(self.auto_refresh) self.toc_name = None self.currently_editing = None
def __init__(self): QWidget.__init__(self) self.ui = Ui_AutoPartWidget() self.ui.setupUi(self) self.storage = ctx.storage self.intf = ctx.interface self.connect(self.ui.autopartType, SIGNAL("currentRowChanged(int)"), self.typeChanged)
def __init__(self, model, parent=None): QWidget.__init__(self, parent) self.l = l = QGridLayout(self) self.setLayout(l) self.setContentsMargins(0, 0, 0, 0) self.view = v = QListView(self) self.d = SpacedDelegate(v) v.doubleClicked.connect(self.double_clicked) v.setItemDelegate(self.d) v.setModel(model) l.addWidget(v, 0, 0, 1, -1) model.dataChanged.connect(self.data_changed) self.rb = b = QPushButton(QIcon(I('edit-undo.png')), _('&Revert to'), self) b.setToolTip(_('Revert the book to the selected checkpoint')) b.clicked.connect(self.revert_clicked) l.addWidget(b, 1, 1) self.cb = b = QPushButton(QIcon(I('diff.png')), _('&Compare'), self) b.setToolTip( _('Compare the state of the book at the selected checkpoint with the current state' )) b.clicked.connect(self.compare_clicked) l.addWidget(b, 1, 0)
def __init__(self, rootWidget): QWidget.__init__(self, ctx.mainScreen) self.ui = Ui_connectionWidget() self.ui.setupUi(self) self.setStyleSheet(""" QFrame#mainFrame { background-image: url(:/gui/pics/transBlack.png); border: 1px solid #BBB; border-radius:8px; } QWidget#autoPartQuestion { background-image: url(:/gui/pics/trans.png); } """) self.rootWidget = rootWidget self.needsExecute = False self.connect(self.ui.buttonCancel, SIGNAL("clicked()"), self.hide) self.connect(self.ui.buttonConnect, SIGNAL("clicked()"), self.slotUseSelected) self.connections = getConnectionList() if self.connections: for package in self.connections.keys(): for connection in self.connections[package]: ci = ConnectionItem(self.ui.connectionList, unicode(str(connection)), package) self.ui.connectionList.setCurrentRow(0) self.resize(ctx.mainScreen.size())
def __init__(self, parent=None): QWidget.__init__(self, parent) self.l = l = QVBoxLayout() self.setLayout(l) l.setContentsMargins(0, 0, 0, 0) self.view = WebView(self) self.inspector = self.view.inspector self.inspector.setPage(self.view.page()) l.addWidget(self.view) self.bar = QToolBar(self) l.addWidget(self.bar) ac = actions['auto-reload-preview'] ac.setCheckable(True) ac.setChecked(True) ac.toggled.connect(self.auto_reload_toggled) self.auto_reload_toggled(ac.isChecked()) self.bar.addAction(ac) ac = actions['reload-preview'] ac.triggered.connect(self.refresh) self.bar.addAction(ac) actions['preview-dock'].toggled.connect(self.visibility_changed) self.current_name = None self.last_sync_request = None self.refresh_timer = QTimer(self) self.refresh_timer.timeout.connect(self.refresh) parse_worker.start()
def __init__(self, store): QWidget.__init__(self) self.setupUi(self) self.store = store self.load_setings()
def __init__(self, parent=None): QWidget.__init__(self, parent) self._layout = l = QGridLayout() self.setLayout(self._layout) self.header = QLabel( _('Double click on any entry to change the' ' keyboard shortcuts associated with it')) l.addWidget(self.header, 0, 0, 1, 3) self.view = QTreeView(self) self.view.setAlternatingRowColors(True) self.view.setHeaderHidden(True) self.view.setAnimated(True) l.addWidget(self.view, 1, 0, 1, 3) self.delegate = Delegate() self.view.setItemDelegate(self.delegate) self.delegate.sizeHintChanged.connect(self.editor_opened, type=Qt.QueuedConnection) self.delegate.changed_signal.connect(self.changed_signal) self.search = SearchBox2(self) self.search.initialize('shortcuts_search_history', help_text=_('Search for a shortcut by name')) self.search.search.connect(self.find) l.addWidget(self.search, 2, 0, 1, 1) self.nb = QPushButton(QIcon(I('arrow-down.png')), _('&Next'), self) self.pb = QPushButton(QIcon(I('arrow-up.png')), _('&Previous'), self) self.nb.clicked.connect(self.find_next) self.pb.clicked.connect(self.find_previous) l.addWidget(self.nb, 2, 1, 1, 1) l.addWidget(self.pb, 2, 2, 1, 1) l.setColumnStretch(0, 100)
def __init__(self): QWidget.__init__(self) self.l = QVBoxLayout() self.setLayout(self.l) self.url_label = QLabel('Casanova server:') self.l.addWidget(self.url_label) self.url_msg = QLineEdit(self) self.url_msg.setText(prefs['base_url']) self.l.addWidget(self.url_msg) self.url_label.setBuddy(self.url_msg) self.username_label = QLabel('Username:'******'username']) self.l.addWidget(self.username_msg) self.username_label.setBuddy(self.username_msg) self.password_label = QLabel('password:'******'password']) self.l.addWidget(self.password_msg) self.password_label.setBuddy(self.password_msg)
def __init__(self, parent): QWidget.__init__(self, parent) self.setupUi(self) self.connect(self.test_button, SIGNAL('clicked()'), self.do_test) self.connect(self.re.lineEdit(), SIGNAL('returnPressed()'), self.do_test) self.re.lineEdit().textChanged.connect(lambda x: self.changed_signal.emit())
def __init__(self): QWidget.__init__(self) self.ui = Ui_KeyboardWidget() self.ui.setupUi(self) index = 0 # comboBox.addItem doesn't increase the currentIndex self.default_layout_index = None locales = sorted([(country, data) for country, data in yali.localedata.locales.items() ]) for country, data in locales: if data["xkbvariant"]: i = 0 for variant in data["xkbvariant"]: _d = dict(data) _d["xkbvariant"] = variant[0] _d["name"] = variant[1] _d["consolekeymap"] = data["consolekeymap"][i] self.ui.keyboard_list.addItem(_d["name"], QVariant(_d)) i += 1 else: self.ui.keyboard_list.addItem(data["name"], QVariant(data)) if ctx.consts.lang == country: if ctx.consts.lang == "tr": self.default_layout_index = index + 1 else: self.default_layout_index = index index += 1 self.ui.keyboard_list.setCurrentIndex(self.default_layout_index) self.connect(self.ui.keyboard_list, SIGNAL("currentIndexChanged(int)"), self.slotLayoutChanged)
def __init__(self, parent): QWidget.__init__(self, parent=None) self.setupUi(self) self.gui = parent.gui self.parent = parent self.prefs = parent.prefs self.verbose = parent.verbose
def __init__(self, *args): QWidget.__init__(self, *args) lo = QHBoxLayout(self) lo.setContentsMargins(0, 0, 0, 0) lo.setSpacing(5) # type selector self.wtypesel = QComboBox(self) for i, tp in enumerate(self.ValueTypes): self.wtypesel.addItem(tp.__name__) QObject.connect(self.wtypesel, SIGNAL("activated(int)"), self._selectTypeNum) typesel_lab = QLabel("&Type:", self) typesel_lab.setBuddy(self.wtypesel) lo.addWidget(typesel_lab, 0) lo.addWidget(self.wtypesel, 0) self.wvalue = QLineEdit(self) self.wvalue_lab = QLabel("&Value:", self) self.wvalue_lab.setBuddy(self.wvalue) self.wbool = QComboBox(self) self.wbool.addItems(["false", "true"]) self.wbool.setCurrentIndex(1) lo.addWidget(self.wvalue_lab, 0) lo.addWidget(self.wvalue, 1) lo.addWidget(self.wbool, 1) self.wvalue.hide() # make input validators self._validators = { int: QIntValidator(self), float: QDoubleValidator(self) } # select bool type initially self._selectTypeNum(0)
def __init__(self, parent=None): QWidget.__init__(self, parent) self.l = l = QGridLayout(self) self.setLayout(l) l.setContentsMargins(0, 0, 0, 0) self.is_visible = False self.view = QTreeWidget(self) self.delegate = Delegate(self.view) self.view.setItemDelegate(self.delegate) self.view.setHeaderHidden(True) self.view.setAnimated(True) self.view.setContextMenuPolicy(Qt.CustomContextMenu) self.view.customContextMenuRequested.connect(self.show_context_menu, type=Qt.QueuedConnection) self.view.itemActivated.connect(self.emit_navigate) self.view.itemPressed.connect(self.item_pressed) pi = plugins['progress_indicator'][0] if hasattr(pi, 'set_no_activate_on_click'): pi.set_no_activate_on_click(self.view) self.view.itemDoubleClicked.connect(self.emit_navigate) l.addWidget(self.view) self.refresh_action = QAction(QIcon(I('view-refresh.png')), _('&Refresh'), self) self.refresh_action.triggered.connect(self.build)
def __init__(self, assy, basefilename): QWidget.__init__(self) self.setupUi(self) self.connect(self.done_btn, SIGNAL("clicked()"), self.close) self.connect(self.plot_btn, SIGNAL("clicked()"), self.genPlot) self.connect(self.open_gnuplot_btn, SIGNAL("clicked()"), self.openGNUplotFile) self.connect(self.open_trace_file_btn, SIGNAL("clicked()"), self.openTraceFile) try: tracefilename = assy.current_movie.get_trace_filename() plotfilename = tracefilename[:-13] + "-plot.txt" #tracefilename = basefilename[:-4] + "-xyztrace.txt" inf = open(tracefilename) inf.close() except IOError: tracefilename = assy.current_movie.get_trace_filename() plotfilename = tracefilename[:-10] + "-plot.txt" #tracefilename = basefilename[:-4] + "-trace.txt" self.traceFile = tracefilename self.plotFile = plotfilename self.setup() self.show() # Fixed bug 440-1. Mark 050802.
def __init__(self, parent=None, show_open_in_editor=False): QWidget.__init__(self, parent) self.changes = [[], [], []] self.delta = 0 self.l = l = QHBoxLayout(self) self.setLayout(l) self.syncpos = 0 l.setMargin(0), l.setSpacing(0) self.view = DiffSplit(self, show_open_in_editor=show_open_in_editor) l.addWidget(self.view) self.add_diff = self.view.add_diff self.scrollbar = QScrollBar(self) l.addWidget(self.scrollbar) self.syncing = False self.bars = [] self.resize_timer = QTimer(self) self.resize_timer.setSingleShot(True) self.resize_timer.timeout.connect(self.resize_debounced) for i, bar in enumerate( (self.scrollbar, self.view.left.verticalScrollBar(), self.view.right.verticalScrollBar())): self.bars.append(bar) bar.valueChanged[int].connect(partial(self.scrolled, i)) self.view.left.resized.connect(self.resized) for i, v in enumerate( (self.view.left, self.view.right, self.view.handle(1))): v.wheel_event.connect(self.scrollbar.wheelEvent) if i < 2: v.next_change.connect(self.next_change) v.line_activated.connect(self.line_activated) v.scrolled.connect(partial(self.scrolled, i + 1))
def __init__(self, parent=None, show_open_in_editor=False): QWidget.__init__(self, parent) self.changes = [[], [], []] self.delta = 0 self.l = l = QHBoxLayout(self) self.setLayout(l) self.syncpos = 0 l.setMargin(0), l.setSpacing(0) self.view = DiffSplit(self, show_open_in_editor=show_open_in_editor) l.addWidget(self.view) self.add_diff = self.view.add_diff self.scrollbar = QScrollBar(self) l.addWidget(self.scrollbar) self.syncing = False self.bars = [] self.resize_timer = QTimer(self) self.resize_timer.setSingleShot(True) self.resize_timer.timeout.connect(self.resize_debounced) for i, bar in enumerate((self.scrollbar, self.view.left.verticalScrollBar(), self.view.right.verticalScrollBar())): self.bars.append(bar) bar.valueChanged[int].connect(partial(self.scrolled, i)) self.view.left.resized.connect(self.resized) for i, v in enumerate((self.view.left, self.view.right, self.view.handle(1))): v.wheel_event.connect(self.scrollbar.wheelEvent) if i < 2: v.next_change.connect(self.next_change) v.line_activated.connect(self.line_activated) v.scrolled.connect(partial(self.scrolled, i + 1))
def __init__(self, plugin, parent): QWidget.__init__(self, parent) self.plugin = plugin self.l = l = QVBoxLayout() self.setLayout(l) self.c = c = QLabel( _('<b>Configure %(name)s</b><br>%(desc)s') % dict(name=plugin.name, desc=plugin.description)) c.setAlignment(Qt.AlignHCenter) l.addWidget(c) self.config_widget = plugin.config_widget() self.l.addWidget(self.config_widget) self.bb = QDialogButtonBox(QDialogButtonBox.Save | QDialogButtonBox.Cancel, parent=self) self.bb.accepted.connect(self.finished) self.bb.rejected.connect(self.finished) self.bb.accepted.connect(self.commit) l.addWidget(self.bb) self.f = QFrame(self) self.f.setFrameShape(QFrame.HLine) l.addWidget(self.f)
def __init__(self, name, plugins, gui_name, parent=None): QWidget.__init__(self, parent) self._layout = QVBoxLayout() self.setLayout(self._layout) self.label = QLabel(gui_name) self.sep = QFrame(self) self.bf = QFont() self.bf.setBold(True) self.label.setFont(self.bf) self.sep.setFrameShape(QFrame.HLine) self._layout.addWidget(self.label) self._layout.addWidget(self.sep) self.plugins = plugins self.bar = QToolBar(self) self.bar.setStyleSheet( 'QToolBar { border: none; background: none }') self.bar.setIconSize(QSize(32, 32)) self.bar.setMovable(False) self.bar.setFloatable(False) self.bar.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) self._layout.addWidget(self.bar) self.actions = [] for p in plugins: target = partial(self.triggered, p) ac = self.bar.addAction(QIcon(p.icon), p.gui_name, target) ac.setToolTip(textwrap.fill(p.description)) ac.setWhatsThis(textwrap.fill(p.description)) ac.setStatusTip(p.description) self.actions.append(ac) w = self.bar.widgetForAction(ac) w.setCursor(Qt.PointingHandCursor) w.setAutoRaise(True) w.setMinimumWidth(100)
def __init__(self, parent=None): QWidget.__init__(self, parent) self._layout = l = QGridLayout() self.setLayout(self._layout) self.header = QLabel(_('Double click on any entry to change the' ' keyboard shortcuts associated with it')) l.addWidget(self.header, 0, 0, 1, 3) self.view = QTreeView(self) self.view.setAlternatingRowColors(True) self.view.setHeaderHidden(True) self.view.setAnimated(True) l.addWidget(self.view, 1, 0, 1, 3) self.delegate = Delegate() self.view.setItemDelegate(self.delegate) self.delegate.sizeHintChanged.connect(self.editor_opened, type=Qt.QueuedConnection) self.delegate.changed_signal.connect(self.changed_signal) self.search = SearchBox2(self) self.search.initialize('shortcuts_search_history', help_text=_('Search for a shortcut by name')) self.search.search.connect(self.find) l.addWidget(self.search, 2, 0, 1, 1) self.nb = QPushButton(QIcon(I('arrow-down.png')), _('&Next'), self) self.pb = QPushButton(QIcon(I('arrow-up.png')), _('&Previous'), self) self.nb.clicked.connect(self.find_next) self.pb.clicked.connect(self.find_previous) l.addWidget(self.nb, 2, 1, 1, 1) l.addWidget(self.pb, 2, 2, 1, 1) l.setColumnStretch(0, 100)
def __init__(self, parent=None): QWidget.__init__(self, parent) self._pixmap = QPixmap(self) self.setMinimumSize(QSize(150, 200)) ImageDropMixin.__init__(self) self.draw_border = True self.show_size = False
def __init__(self, config=None): QWidget.__init__(self) self.setupUi(self) self.config = JSONConfig('store/search') if not config else config # These default values should be the same as in # calibre.gui2.store.search.search:SearchDialog.load_settings # Seconds self.opt_timeout.setValue(self.config.get('timeout', 75)) self.opt_hang_time.setValue(self.config.get('hang_time', 75)) self.opt_max_results.setValue(self.config.get('max_results', 10)) self.opt_open_external.setChecked( self.config.get('open_external', True)) # Number of threads to run for each type of operation self.opt_search_thread_count.setValue( self.config.get('search_thread_count', 4)) self.opt_cache_thread_count.setValue( self.config.get('cache_thread_count', 2)) self.opt_cover_thread_count.setValue( self.config.get('cover_thread_count', 2)) self.opt_details_thread_count.setValue( self.config.get('details_thread_count', 4))
def __init__(self, parent): QWidget.__init__(self, parent) self.setupUi(self) self.connect(self.test_button, SIGNAL("clicked()"), self.do_test) self.connect(self.re.lineEdit(), SIGNAL("returnPressed()"), self.do_test) self.re.lineEdit().textChanged.connect(lambda x: self.changed_signal.emit())
def __init__(self): QWidget.__init__(self) self.l = QVBoxLayout() self.setLayout(self.l) self.ll = QHBoxLayout() self.server_label = QLabel("Server:") self.ll.addWidget(self.server_label) self.lsb_server = QLineEdit(self) self.lsb_server.setText(prefs["lsb_server"]) self.ll.addWidget(self.lsb_server) self.server_label.setBuddy(self.lsb_server) self.l.addLayout(self.ll) self.lll = QHBoxLayout() self.librarian_label = QLabel("Librarian:") self.lll.addWidget(self.librarian_label) self.librarian = QLineEdit(self) self.librarian.setText(prefs["librarian"]) self.lll.addWidget(self.librarian) self.librarian_label.setBuddy(self.librarian) self.l.addLayout(self.lll) self.llll = QHBoxLayout() self.library_uuid_label = QLabel("Library ID:") self.llll.addWidget(self.library_uuid_label) self.library_uuid = QLabel(self) self.library_uuid.setText(prefs["library_uuid"]) self.llll.addWidget(self.library_uuid) self.library_uuid_label.setBuddy(self.library_uuid) self.l.addLayout(self.llll)
def __init__(self): QWidget.__init__(self) self.l = QVBoxLayout() self.setLayout(self.l) self.serialLabel = QLabel('eInk Kindle Serial numbers (First character B, 16 characters, use commas if more than one)') self.l.addWidget(self.serialLabel) self.serials = QLineEdit(self) self.serials.setText(prefs['serials']) self.l.addWidget(self.serials) self.serialLabel.setBuddy(self.serials) self.pidLabel = QLabel('Mobipocket PIDs (8 or 10 characters, use commas if more than one)') self.l.addWidget(self.pidLabel) self.pids = QLineEdit(self) self.pids.setText(prefs['pids']) self.l.addWidget(self.pids) self.pidLabel.setBuddy(self.serials) self.wpLabel = QLabel('For Linux only: WINEPREFIX (enter absolute path)') self.l.addWidget(self.wpLabel) self.wineprefix = QLineEdit(self) wineprefix = prefs['WINEPREFIX'] if wineprefix is not None: self.wineprefix.setText(wineprefix) else: self.wineprefix.setText('') self.l.addWidget(self.wineprefix) self.wpLabel.setBuddy(self.wineprefix)
def __init__(self): QWidget.__init__(self) self.l = QGridLayout() self.setLayout(self.l) self.newFormatCheckboxLabel = QLabel("Generate new format data (SQLite3)") self.l.addWidget(self.newFormatCheckboxLabel, 0, 0, 1, 1) self.newFormatCheckbox = QCheckBox(self) self.l.addWidget(self.newFormatCheckbox, 0, 1, 1, 1) self.newFormatCheckbox.setChecked(prefs["newFormat"]) # ARTTBD Maybe should be a native directory picker? Works for now.. self.cacheDirLabel = QLabel("Caching directory (optional, useful if re-running for a given book)") self.l.addWidget(self.cacheDirLabel, 1, 0, 1, 1) self.cacheDirEdit = QLineEdit(self) self.l.addWidget(self.cacheDirEdit, 1, 1, 1, 1) self.cacheDirEdit.setText(prefs["cacheDir"]) self.autoExpandAliasesLabel = QLabel("Auto-generate aliases from character names") self.l.addWidget(self.autoExpandAliasesLabel, 2, 0, 1, 1) self.autoExpandAliasesCheckbox = QCheckBox(self) self.l.addWidget(self.autoExpandAliasesCheckbox, 2, 1, 1, 1) self.autoExpandAliasesCheckbox.setChecked(prefs["autoExpandAliases"]) self.logfileLabel = QLabel("Log file (optional)") self.l.addWidget(self.logfileLabel, 3, 0, 1, 1) self.logfileEdit = QLineEdit(self) self.l.addWidget(self.logfileEdit, 3, 1, 1, 1) self.logfileEdit.setText(prefs["logfile"])
def __init__(self, plugin, parent): QWidget.__init__(self, parent) self.plugin = plugin self.l = l = QVBoxLayout() self.setLayout(l) self.c = c = QLabel(_('<b>Configure %(name)s</b><br>%(desc)s') % dict( name=plugin.name, desc=plugin.description)) c.setAlignment(Qt.AlignHCenter) l.addWidget(c) self.config_widget = plugin.config_widget() self.l.addWidget(self.config_widget) self.bb = QDialogButtonBox( QDialogButtonBox.Save|QDialogButtonBox.Cancel, parent=self) self.bb.accepted.connect(self.finished) self.bb.rejected.connect(self.finished) self.bb.accepted.connect(self.commit) l.addWidget(self.bb) self.f = QFrame(self) self.f.setFrameShape(QFrame.HLine) l.addWidget(self.f)
def __init__(self, preview, parent=None): QWidget.__init__(self, parent) self.preview = preview self.preview_is_refreshing = False self.refresh_needed = False preview.refresh_starting.connect(self.preview_refresh_starting) preview.refreshed.connect(self.preview_refreshed) self.apply_theme() self.setAutoFillBackground(True) self.update_timer = QTimer(self) self.update_timer.timeout.connect(self.update_data) self.update_timer.setSingleShot(True) self.update_timer.setInterval(500) self.now_showing = (None, None, None) self.stack = s = QStackedLayout(self) self.setLayout(s) self.clear_label = la = QLabel('<h3>' + _( 'No style information found') + '</h3><p>' + _( 'Move the cursor inside a HTML tag to see what styles' ' apply to that tag.')) la.setWordWrap(True) la.setAlignment(Qt.AlignTop | Qt.AlignLeft) s.addWidget(la) self.box = box = Box(self) box.hyperlink_activated.connect(self.goto_declaration, type=Qt.QueuedConnection) self.scroll = sc = QScrollArea(self) sc.setWidget(box) sc.setWidgetResizable(True) s.addWidget(sc)
def __init__(self, esp_image, glpane): QWidget.__init__(self) self.setupUi(self) self.connect(self.ok_btn,SIGNAL("clicked()"),self.accept) self.connect(self.cancel_btn,SIGNAL("clicked()"),self.reject) self.connect(self.choose_border_color_btn,SIGNAL("clicked()"),self.change_border_color) self.connect(self.choose_fill_color_btn,SIGNAL("clicked()"),self.change_fill_color) self.connect(self.show_esp_bbox_checkbox,SIGNAL("toggled(bool)"),self.show_esp_bbox) self.connect(self.select_atoms_btn,SIGNAL("clicked()"),self.select_atoms_inside_esp_bbox) self.connect(self.highlight_atoms_in_bbox_checkbox,SIGNAL("toggled(bool)"),self.highlight_atoms_in_bbox) self.connect(self.calculate_esp_btn,SIGNAL("clicked()"),self.calculate_esp) self.connect(self.rotate_ccw_btn,SIGNAL("clicked()"),self.rotate_90) self.connect(self.rotate_cw_btn,SIGNAL("clicked()"),self.rotate_neg_90) self.connect(self.flip_btn,SIGNAL("clicked()"),self.flip_esp_image) self.connect(self.mirror_btn,SIGNAL("clicked()"),self.mirror_esp_image) self.connect(self.opacity_slider,SIGNAL("valueChanged(int)"),self.change_opacity) self.connect(self.choose_file_btn,SIGNAL("clicked()"),self.change_esp_image) self.connect(self.load_btn,SIGNAL("clicked()"),self.load_esp_image) self.connect(self.clear_btn,SIGNAL("clicked()"),self.clear_esp_image) self.connect(self.xaxis_spinbox,SIGNAL("valueChanged(int)"),self.change_xaxisOrient) self.connect(self.yaxis_spinbox,SIGNAL("valueChanged(int)"),self.change_yaxisOrient) self.connect(self.width_linedit,SIGNAL("returnPressed()"),self.change_jig_size) self.connect(self.edge_offset_linedit,SIGNAL("returnPressed()"),self.change_jig_size) self.connect(self.image_offset_linedit,SIGNAL("returnPressed()"),self.change_jig_size) self.jig = esp_image self.glpane = glpane
def __init__(self): QWidget.__init__(self) self.l = QGridLayout() self.setLayout(self.l) self.newFormatCheckboxLabel = QLabel('Generate new format data (SQLite3)') self.l.addWidget(self.newFormatCheckboxLabel, 0, 0, 1, 1) self.newFormatCheckbox = QCheckBox(self) self.l.addWidget(self.newFormatCheckbox, 0, 1, 1, 1) self.newFormatCheckbox.setChecked(prefs['newFormat']) # ARTTBD Maybe should be a native directory picker? Works for now.. self.cacheDirLabel = QLabel("Caching directory (optional, useful if re-running for a given book)") self.l.addWidget(self.cacheDirLabel, 1, 0, 1, 1) self.cacheDirEdit = QLineEdit(self) self.l.addWidget(self.cacheDirEdit, 1, 1, 1, 1) self.cacheDirEdit.setText(prefs['cacheDir']) self.autoExpandAliasesLabel = QLabel('Auto-generate aliases from character names') self.l.addWidget(self.autoExpandAliasesLabel, 2, 0, 1, 1) self.autoExpandAliasesCheckbox = QCheckBox(self) self.l.addWidget(self.autoExpandAliasesCheckbox, 2, 1, 1, 1) self.autoExpandAliasesCheckbox.setChecked(prefs['autoExpandAliases']) self.logfileLabel = QLabel('Log file (optional)') self.l.addWidget(self.logfileLabel, 3, 0, 1, 1) self.logfileEdit = QLineEdit(self) self.l.addWidget(self.logfileEdit, 3, 1, 1, 1) self.logfileEdit.setText(prefs['logfile'])
def __init__(self, all_formats, format_map): QWidget.__init__(self) self.l = l = QGridLayout() self.setLayout(l) self.f = f = QListWidget(self) l.addWidget(f, 0, 0, 3, 1) unchecked_formats = sorted(all_formats - set(format_map)) for fmt in format_map + unchecked_formats: item = QListWidgetItem(fmt, f) item.setData(Qt.UserRole, fmt) item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable | Qt.ItemIsSelectable) item.setCheckState(Qt.Checked if fmt in format_map else Qt.Unchecked) self.button_up = b = QToolButton(self) b.setIcon(QIcon(I('arrow-up.png'))) l.addWidget(b, 0, 1) b.clicked.connect(self.up) self.button_down = b = QToolButton(self) b.setIcon(QIcon(I('arrow-down.png'))) l.addWidget(b, 2, 1) b.clicked.connect(self.down)
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 __init__(self): QWidget.__init__(self) self.setupUi(self) self.collections = None self.current_item = None self.last_item = None self.collectionList.itemClicked.connect(self.openItem) self.collectionList.currentItemChanged.connect(self.itemChanged)
def __init__(self, parent): QWidget.__init__(self, parent=None) self.setupUi(self) self.gui = parent.gui self.parent = parent self.prefs = parent.prefs self.verbose = parent.verbose self._log_location()
def __init__(self, text, expanded=True, parent=None): QWidget.__init__(self, parent) self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Minimum) self.setCursor(Qt.PointingHandCursor) self.text = text self.expanded = expanded self.hovering = False self.do_layout()
def __init__(self, html_name, data, is_first=False, parent=None): QWidget.__init__(self, parent) self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Minimum) self.data = data self.is_first = is_first self.html_name = html_name self.do_layout() self.setMouseTracking(True)
def __init__(self, parent): QWidget.__init__(self, parent) self.setupUi(self) self.test_button.clicked[()].connect(self.do_test) self.re.lineEdit().returnPressed[()].connect(self.do_test) self.filename.returnPressed[()].connect(self.do_test) self.re.lineEdit().textChanged.connect(lambda x: self.changed_signal.emit())