Exemple #1
0
    def __init__(self, mainWindow, quantity):

        # appel du constructeur de la classe de base :
        QWidget.__init__(self, mainWindow)

        self.mw = mainWindow  # la fenêtre de l'application principale

        # Attributs (objets persistants)
        self.__quantity = quantity  # "position" or "velocity"
        self.__data1 = None  # data for the first plot
        self.__data2 = None  # data for tthe second
        self.__figure = None  # figure tracé
        self.__axes1 = None  # système d'axes tracé 1
        self.__axes2 = None  # système d'axes tracé 2
        self.__canvas = None  # pour le tracé matplot.lib
        self.__toolbar = None  # barre d'outils tracé
        self.__time = None  # abcissa values for plot
        self.__xlim = None  # xmin, xmay tracé
        self.__xlabel = None  # étiquette axe X (n° image ou temps [s])
        self.__ylim1 = None  # ymin, ymax tracé x(t)
        self.__ylim2 = None  # ymin, ymax tracé y(t)

        self.btn_imageSize = QRadioButton("ImageSize", self)
        self.btn_autoSize = QRadioButton("AutoSize", self)

        self.btn_smooth_Vx = QCheckBox("Lissage Vx", self)
        self.btn_smooth_Vy = QCheckBox("Lissage Vy", self)
        self.x_mav_nb_pts = QSpinBox(parent=self)  # X velocity moving average
        self.y_mav_nb_pts = QSpinBox(parent=self)  # Y velocity moving average

        self.__initUI()  # Initialisation de l'interface utilisateur
Exemple #2
0
    def __init__(self, width, height, parent=None):
        QDialog.__init__(self, parent)
        self.l = l = QFormLayout(self)
        self.setLayout(l)
        self.aspect_ratio = width / float(height)
        l.addRow(QLabel(_('Choose the new width and height')))

        self._width = w = QSpinBox(self)
        w.setMinimum(1)
        w.setMaximum(10 * width)
        w.setValue(width)
        w.setSuffix(' px')
        l.addRow(_('&Width:'), w)

        self._height = h = QSpinBox(self)
        h.setMinimum(1)
        h.setMaximum(10 * height)
        h.setValue(height)
        h.setSuffix(' px')
        l.addRow(_('&Height:'), h)
        connect_lambda(w.valueChanged, self,
                       lambda self: self.keep_ar('width'))
        connect_lambda(h.valueChanged, self,
                       lambda self: self.keep_ar('height'))

        self.ar = ar = QCheckBox(_('Keep &aspect ratio'))
        ar.setChecked(True)
        l.addRow(ar)
        self.resize(self.sizeHint())

        self.bb = bb = QDialogButtonBox(QDialogButtonBox.Ok
                                        | QDialogButtonBox.Cancel)
        bb.accepted.connect(self.accept)
        bb.rejected.connect(self.reject)
        l.addRow(bb)
Exemple #3
0
        def __init__(self, p=None):
            QDialog.__init__(self, p)
            self.setWindowTitle("Generate page layout...")
            self.layout = QFormLayout()

            self.numberOfLabelsSpinBox = QSpinBox()
            self.numberOfLabelsSpinBox.setRange(1, 200)
            self.numberOfLabelsSpinBox.setValue(
                generate_settings['defaultNumberOfLabels'])
            self.layout.addRow("Number of labels", self.numberOfLabelsSpinBox)

            self.firstLabelArticleNumberSB = QSpinBox()
            self.firstLabelArticleNumberSB.setRange(0, 9999)
            self.firstLabelArticleNumberSB.setValue(
                generate_settings['firstLabelArticleNumber'])
            self.layout.addRow("First label article number",
                               self.firstLabelArticleNumberSB)

            self.weekNrYearLE = QLineEdit()
            self.weekNrYearLE.setText(generate_settings['weekNrYear'])
            self.layout.addRow("Week nr/ year", self.weekNrYearLE)

            self.lotNameLE = QLineEdit()
            self.lotNameLE.setText(generate_settings['lotName'])
            self.layout.addRow("Lot", self.lotNameLE)

            self.generatePB = QPushButton("Generate")
            self.generatePB.clicked.connect(self.onGenerate)
            self.layout.addRow("", self.generatePB)
            self.cancelPB = QPushButton("Cancel")
            self.cancelPB.clicked.connect(self.close)
            self.layout.addRow("", self.cancelPB)
            self.setLayout(self.layout)
Exemple #4
0
    def __init__(self, parent=None):
        QDialog.__init__(self, parent=parent)
        self.l = l = QFormLayout(self)
        self.setLayout(l)
        self.setWindowTitle(_('Import OPML file'))
        self.setWindowIcon(QIcon(I('opml.png')))

        self.h = h = QHBoxLayout()
        self.path = p = QLineEdit(self)
        p.setMinimumWidth(300)
        p.setPlaceholderText(_('Path to OPML file'))
        h.addWidget(p)
        self.cfb = b = QToolButton(self)
        b.setIcon(QIcon(I('document_open.png')))
        b.setToolTip(_('Browse for OPML file'))
        b.clicked.connect(self.choose_file)
        h.addWidget(b)
        l.addRow(_('&OPML file:'), h)
        l.labelForField(h).setBuddy(p)
        b.setFocus(Qt.OtherFocusReason)

        self._articles_per_feed = a = QSpinBox(self)
        a.setMinimum(1), a.setMaximum(1000), a.setValue(100)
        a.setToolTip(_('Maximum number of articles to download per RSS feed'))
        l.addRow(_('&Maximum articles per feed:'), a)

        self._oldest_article = o = QSpinBox(self)
        o.setMinimum(1), o.setMaximum(3650), o.setValue(7)
        o.setSuffix(_(' days'))
        o.setToolTip(
            _('Articles in the RSS feeds older than this will be ignored'))
        l.addRow(_('&Oldest article:'), o)

        self.preserve_groups = g = QCheckBox(
            _('Preserve groups in the OPML file'))
        g.setToolTip('<p>' + _(
            'If enabled, every group of feeds in the OPML file will be converted into a single recipe. Otherwise every feed becomes its own recipe'
        ))
        g.setChecked(True)
        l.addRow(g)

        self._replace_existing = r = QCheckBox(_('Replace existing recipes'))
        r.setToolTip('<p>' + _(
            'If enabled, any existing recipes with the same titles as entries in the OPML file will be replaced.'
            ' Otherwise, new entries with modified titles will be created'))
        r.setChecked(True)
        l.addRow(r)

        self.bb = bb = QDialogButtonBox(QDialogButtonBox.Ok
                                        | QDialogButtonBox.Cancel)
        bb.accepted.connect(self.accept), bb.rejected.connect(self.reject)
        l.addRow(bb)

        self.recipes = ()
Exemple #5
0
    def __init__(self):
        QWidget.__init__(self)
        self.layout = QGridLayout()
        self.layout.setSpacing(10)
        self.setLayout(self.layout)

        self.index = 0

        self.api_key = QLineEdit(self)
        self.api_key.setText(PREFS['api_key'])
        self.add_labeled_widget('&API key:', self.api_key)

        # Worker threads is the maximum number of worker threads to spawn.
        # Restricted to 1+
        self.worker_threads = QSpinBox(self)
        self.worker_threads.setMinimum(1)
        self.worker_threads.setValue(PREFS['worker_threads'])
        self.add_labeled_widget('&Worker threads:', self.worker_threads)

        # Request interval represents wait time between batches of requests.
        self.request_interval = QSpinBox(self)
        self.request_interval.setMinimum(0)
        self.request_interval.setValue(PREFS['request_interval'])
        self.add_labeled_widget('&Request interval (seconds):',
                                self.request_interval)

        # Request batch is the maximum number of requests to run at a time.
        # Restricted to 1+
        self.request_batch_size = QSpinBox(self)
        self.request_batch_size.setMinimum(1)
        self.request_batch_size.setValue(PREFS['request_batch_size'])
        self.add_labeled_widget('&Request batch size:',
                                self.request_batch_size)

        # Retries is the number of times to retry if we get any error
        # from comicvine besides a rate limit error.
        self.retries = QSpinBox(self)
        self.retries.setMinimum(0)
        self.retries.setValue(PREFS['retries'])
        self.add_labeled_widget('&Retries:', self.retries)

        # Search volume limit is the max number of volumes to return from
        # a volume search.
        self.search_volume_limit = QSpinBox(self)
        self.search_volume_limit.setMinimum(10)
        self.search_volume_limit.setMaximum(10000)
        self.search_volume_limit.setSingleStep(10)
        self.search_volume_limit.setValue(PREFS['search_volume_limit'])
        self.add_labeled_widget('&search_volume_limit:',
                                self.search_volume_limit)
Exemple #6
0
    def initUI(self):
        self.setFixedSize(800, 600)

        layout = QVBoxLayout()

        layout1 = QHBoxLayout()

        layout1.addWidget(QLabel('地图类型'))
        tmp = QComboBox(self)
        tmp.addItems(self.types)
        tmp.currentTextChanged.connect(self.swap_menu)
        self.typeCom = tmp
        layout1.addWidget(tmp)
        layout1.addStretch(1)

        layout1.addWidget(QLabel('编辑器宽高:'))
        tmp = QSpinBox(self)
        tmp.setMaximum(1960)
        tmp.setMinimum(400)
        tmp.setValue(600)
        tmp.setSingleStep(100)
        layout1.addWidget(tmp)
        tmp = QSpinBox(self)
        tmp.setMaximum(1080)
        tmp.setSingleStep(100)
        tmp.setMinimum(400)
        layout1.addWidget(tmp)

        layout.addLayout(layout1)

        layout1 = QHBoxLayout()
        self.layer1 = []
        tmp = QLabel(self)
        self.layer1.append(tmp)
        self.image = tmp
        self.image.filepath = None
        layout1.addWidget(tmp)
        tmp = QPushButton('选择文件', self)
        tmp.clicked.connect(self.open_file)
        self.layer1.append(tmp)
        layout1.addWidget(tmp)

        layout.addLayout(layout1)

        tmp = QPushButton('开始编辑', self)
        tmp.clicked.connect(self.edit)
        layout.addWidget(tmp)

        self.setLayout(layout)
    def __init__(self):
        super().__init__()

        self._label_info = QLabel()

        self._button_append = QPushButton('Add')
        self._button_append.clicked.connect(self._on_append_clicked)

        self._spin_box_numbers = QSpinBox()
        self._spin_box_numbers.setRange(1, 1_000_000)
        self._spin_box_numbers.setValue(1_000_000)

        h_layout = QHBoxLayout()
        h_layout.addWidget(self._button_append)
        h_layout.addWidget(self._spin_box_numbers)
        h_layout.addWidget(QLabel('objects'))

        main_layout = QVBoxLayout()
        main_layout.addWidget(self._label_info)
        main_layout.addLayout(h_layout)
        self.setLayout(main_layout)

        self._items = []

        pid = current_process().pid
        self._process = psutil.Process(pid)

        self._timer = QTimer()
        self._timer.timeout.connect(self.update_memory_info)
        self._timer.start(500)

        self.update_memory_info()
Exemple #8
0
 def createEditor(self, parent, option, index):
     sb = QSpinBox(parent)
     sb.setMinimum(0)
     sb.setMaximum(5)
     sb.setSuffix(' ' + _('stars'))
     sb.setSpecialValueText(_('Not rated'))
     return sb
Exemple #9
0
 def setup_ui(self, parent):
     self.make_widgets(parent, EditWithComplete)
     values = self.all_values = list(self.db.all_custom(num=self.col_id))
     values.sort(key=sort_key)
     self.main_widget.setSizeAdjustPolicy(
         self.main_widget.AdjustToMinimumContentsLengthWithIcon)
     self.main_widget.setMinimumContentsLength(25)
     self.widgets.append(QLabel('', parent))
     w = QWidget(parent)
     layout = QHBoxLayout(w)
     layout.setContentsMargins(0, 0, 0, 0)
     self.remove_series = QCheckBox(parent)
     self.remove_series.setText(_('Remove series'))
     layout.addWidget(self.remove_series)
     self.idx_widget = QCheckBox(parent)
     self.idx_widget.setText(_('Automatically number books'))
     layout.addWidget(self.idx_widget)
     self.force_number = QCheckBox(parent)
     self.force_number.setText(_('Force numbers to start with '))
     layout.addWidget(self.force_number)
     self.series_start_number = QSpinBox(parent)
     self.series_start_number.setMinimum(1)
     self.series_start_number.setMaximum(9999999)
     self.series_start_number.setProperty("value", 1)
     layout.addWidget(self.series_start_number)
     layout.addItem(
         QSpacerItem(20, 10, QSizePolicy.Expanding, QSizePolicy.Minimum))
     self.widgets.append(w)
     self.idx_widget.stateChanged.connect(self.check_changed_checkbox)
     self.force_number.stateChanged.connect(self.check_changed_checkbox)
     self.series_start_number.valueChanged.connect(
         self.check_changed_checkbox)
     self.remove_series.stateChanged.connect(self.check_changed_checkbox)
     self.ignore_change_signals = False
Exemple #10
0
def get_bulk_rename_settings(parent, number, msg=None, sanitize=sanitize_file_name_unicode, leading_zeros=True, prefix=None, category='text'):  # {{{
    d = QDialog(parent)
    d.setWindowTitle(_('Bulk rename items'))
    d.l = l = QFormLayout(d)
    d.setLayout(l)
    d.prefix = p = QLineEdit(d)
    prefix = prefix or {k:v for k, __, v in CATEGORIES}.get(category, _('Chapter-'))
    p.setText(prefix)
    p.selectAll()
    d.la = la = QLabel(msg or _(
        'All selected files will be renamed to the form prefix-number'))
    l.addRow(la)
    l.addRow(_('&Prefix:'), p)
    d.num = num = QSpinBox(d)
    num.setMinimum(0), num.setValue(1), num.setMaximum(1000)
    l.addRow(_('Starting &number:'), num)
    d.bb = bb = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
    bb.accepted.connect(d.accept), bb.rejected.connect(d.reject)
    l.addRow(bb)

    if d.exec_() == d.Accepted:
        prefix = sanitize(unicode(d.prefix.text()))
        num = d.num.value()
        fmt = '%d'
        if leading_zeros:
            largest = num + number - 1
            fmt = '%0{0}d'.format(len(str(largest)))
        return prefix + fmt, num
    return None, None
Exemple #11
0
 def ulkoinen_voima_valikko(self):
     '''Luo voiman suuruus -tekstin'''
     self.ulkoinen_voima = QGraphicsSimpleTextItem("Voiman suuruus")
     self.ulkoinen_voima.setPos(600, 5)
     self.ulkoinen_voima.font = QtGui.QFont()
     self.ulkoinen_voima.font.setPointSize(12)
     self.ulkoinen_voima.setFont(self.ulkoinen_voima.font)
     self.lisaa_ulkoinen_voima.setEnabled(False)
     self.scene.addItem(self.ulkoinen_voima)
     self.ulkoinen_voima.hide()
     '''Luo voiman arvon QSpinBoxin'''
     self.sp_voima = QSpinBox()
     self.sp_voima.move(750, 5)
     self.sp_voima.setRange(0, 10000)
     self.sp_voima.setSingleStep(1)
     self.sp_voima.setMinimumHeight(30)
     self.sp_voima.setValue(int(Ominaisuudet.palauta_voima(self)))
     self.sp_voima.valueChanged.connect(self.paivita_voima)
     self.scene.addWidget(self.sp_voima)
     self.sp_voima.hide()
     '''Luo yksikönvalinta QComboBOxin'''
     self.yksikko_voima = QComboBox()
     self.yksikko_voima.addItem("kN", 0)
     self.yksikko_voima.addItem("N", 1)
     self.yksikko_voima.move(820, 5)
     self.yksikko_voima.setMinimumHeight(30)
     self.yksikko_voima.setCurrentIndex(
         int(Ominaisuudet.palauta_voiman_yksikko(self)))
     self.yksikko_voima.setEditable(True)
     self.yksikko_voima.lineEdit().setAlignment(QtCore.Qt.AlignCenter)
     self.scene.addWidget(self.yksikko_voima)
     self.yksikko_voima.currentIndexChanged.connect(
         self.paivita_yksikko_voima)
     self.yksikko_voima.hide()
Exemple #12
0
    def init_ui(self):

        layout = QGridLayout()
        for i, lbl in enumerate((
                self.tr("Rows"), self.tr("Columns"),
                self.tr("The distance between the outer borders"),
                self.tr("Distance between border and content"))):
            # noinspection PyArgumentList
            layout.addWidget(QLabel(lbl, self), i, 0)
            self.controls.append(QSpinBox(self))
            # noinspection PyArgumentList
            layout.addWidget(self.controls[-1], i, 1)
        self.controls[2].setValue(
            self._cfg.get('TextEditor/PaddingInTable', 3))
        self.controls[3].setValue(self._cfg.get('TextEditor/SpaceInTable', 0))

        insert_button = QPushButton(self.tr("Insert"), self)
        insert_button.clicked.connect(self.insert)
        # noinspection PyArgumentList
        layout.addWidget(insert_button, 4, 0, 1, 2)
        self.controls.append(insert_button)

        self.setWindowTitle(self.tr("Insert table"))
        # self.setGeometry(300, 300, 200, 100)
        self.setLayout(layout)
Exemple #13
0
    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 __mkSpinBox(self, value, min, max, options={}):
     spBox = QSpinBox()
     spBox.setValue(value)
     spBox.setMinimum(min)
     spBox.setMaximum(max)
     valueChangedSlot = options.get("valueChangedSlot", None)
     if valueChangedSlot is not None:
         spBox.valueChanged.connect(valueChangedSlot)
     return spBox
Exemple #15
0
 def setup_ui(self, parent):
     self.widgets = [
         QLabel('&' + self.col_metadata['name'] + ':', parent),
         QSpinBox(parent)
     ]
     w = self.widgets[1]
     w.setRange(-1000000, 100000000)
     w.setSpecialValueText(_('Undefined'))
     w.setSingleStep(1)
Exemple #16
0
 def __init__(self, parent=None):
     QWidget.__init__(self, parent)
     layout = QHBoxLayout()
     self.sbx = QSpinBox()
     self.sby = QSpinBox()
     self.sbx.setRange(0, 1000)
     self.sby.setRange(0, 1000)
     lb = QLabel('x')
     lb.setSizePolicy(Qt.QSizePolicy.Minimum, Qt.QSizePolicy.Minimum)
     layout.addWidget(lb)
     self.sbx.setSizePolicy(Qt.QSizePolicy.Maximum, Qt.QSizePolicy.Maximum)
     layout.addWidget(self.sbx)
     lby = QLabel('y')
     lby.setSizePolicy(Qt.QSizePolicy.Minimum, Qt.QSizePolicy.Minimum)
     layout.addWidget(lby)
     layout.setAlignment(Qt.Qt.AlignLeft)
     layout.addWidget(self.sby)
     self.setLayout(layout)
Exemple #17
0
def get_bulk_rename_settings(parent,
                             number,
                             msg=None,
                             sanitize=sanitize_file_name_unicode,
                             leading_zeros=True,
                             prefix=None,
                             category='text',
                             allow_spine_order=False):  # {{{
    d = QDialog(parent)
    d.setWindowTitle(_('Bulk rename items'))
    d.l = l = QFormLayout(d)
    d.setLayout(l)
    d.prefix = p = QLineEdit(d)
    default_prefix = {k: v
                      for k, __, v in CATEGORIES}.get(category, _('Chapter-'))
    previous = tprefs.get('file-list-bulk-rename-prefix', {})
    prefix = prefix or previous.get(category, default_prefix)
    p.setText(prefix)
    p.selectAll()
    d.la = la = QLabel(
        msg
        or _('All selected files will be renamed to the form prefix-number'))
    l.addRow(la)
    l.addRow(_('&Prefix:'), p)
    d.num = num = QSpinBox(d)
    num.setMinimum(0), num.setValue(1), num.setMaximum(1000)
    l.addRow(_('Starting &number:'), num)
    if allow_spine_order:
        d.spine_order = QCheckBox(
            _('Rename files according to their book order'))
        d.spine_order.setToolTip(
            textwrap.fill(
                _('Rename the selected files according to the order they appear in the book, instead of the order they were selected in.'
                  )))
        l.addRow(d.spine_order)
    d.bb = bb = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
    bb.accepted.connect(d.accept), bb.rejected.connect(d.reject)
    l.addRow(bb)
    ans = {'prefix': None, 'start': None}

    if d.exec_() == d.Accepted:
        prefix = sanitize(unicode(d.prefix.text()))
        previous[category] = prefix
        tprefs.set('file-list-bulk-rename-prefix', previous)
        num = d.num.value()
        fmt = '%d'
        if leading_zeros:
            largest = num + number - 1
            fmt = '%0{0}d'.format(len(str(largest)))
        ans['prefix'] = prefix + fmt
        ans['start'] = num
        if allow_spine_order:
            ans['spine_order'] = d.spine_order.isChecked()
    return ans
Exemple #18
0
    def __init__(self, *args, **kwargs):
        super(Window, self).__init__(*args, **kwargs)
        self.resize(800, 600)

        self.bar = ProgressBar(self)
        self.bar.setMinimumSize(400, 400)
        self.bar.setMaximumSize(400, 400)

        layout = QFormLayout(self)

        layout.addWidget(
            QRadioButton('矩形',
                         self,
                         checked=True,
                         clicked=lambda: self.bar.setStyleType(1)))
        layout.addWidget(
            QRadioButton('圆形', clicked=lambda: self.bar.setStyleType(0)))
        layout.addWidget(
            QPushButton('设置背景颜色', self, clicked=self.chooseBackgroundColor))
        layout.addWidget(
            QPushButton('设置文字颜色', self, clicked=self.chooseTextColor))
        layout.addWidget(
            QPushButton('设置波浪1颜色', self, clicked=self.chooseWaterColor1))
        layout.addWidget(
            QPushButton('设置波浪2颜色', self, clicked=self.chooseWaterColor2))
        layout.addWidget(
            QPushButton('设置随机0-100固定值', self, clicked=self.setRandomValue))

        layout.addRow(
            '振幅(浪高)',
            QSpinBox(self, value=1, valueChanged=self.bar.setWaterHeight))

        layout.addRow(
            '周期(密度)',
            QSpinBox(self, value=1, valueChanged=self.bar.setWaterDensity))

        layout.addWidget(self.bar)

        # 动态设置进度条的值
        self._valueTimer = QTimer(self, timeout=self.updateValue)
        self._valueTimer.start(100)
Exemple #19
0
 def __init__(self, parent=None):
     QWidget.__init__(self, parent)
     self.l = l = QVBoxLayout(self)
     self.la = la = QLabel(
         _('calibre contains an internet server that allows you to'
           ' access your book collection using a browser from anywhere'
           ' in the world. Any changes to the settings will only take'
           ' effect after a server restart.'))
     la.setWordWrap(True)
     l.addWidget(la)
     l.addSpacing(10)
     self.fl = fl = QFormLayout()
     l.addLayout(fl)
     self.opt_port = sb = QSpinBox(self)
     if options['port'].longdoc:
         sb.setToolTip(options['port'].longdoc)
     sb.setRange(1, 65535)
     sb.valueChanged.connect(self.changed_signal.emit)
     fl.addRow(options['port'].shortdoc + ':', sb)
     l.addSpacing(25)
     self.opt_auth = cb = QCheckBox(
         _('Require &username and password to access the content server'))
     l.addWidget(cb)
     self.auth_desc = la = QLabel(self)
     la.setStyleSheet('QLabel { font-size: small; font-style: italic }')
     la.setWordWrap(True)
     l.addWidget(la)
     l.addSpacing(25)
     self.opt_autolaunch_server = al = QCheckBox(
         _('Run server &automatically when calibre starts'))
     l.addWidget(al)
     l.addSpacing(25)
     self.h = h = QHBoxLayout()
     l.addLayout(h)
     for text, name in [(_('&Start server'), 'start_server'),
                        (_('St&op server'), 'stop_server'),
                        (_('&Test server'), 'test_server'),
                        (_('Show server &logs'), 'show_logs')]:
         b = QPushButton(text)
         b.clicked.connect(getattr(self, name).emit)
         setattr(self, name + '_button', b)
         if name == 'show_logs':
             h.addStretch(10)
         h.addWidget(b)
     self.ip_info = QLabel(self)
     self.update_ip_info()
     from calibre.gui2.ui import get_gui
     get_gui().iactions[
         'Connect Share'].share_conn_menu.server_state_changed_signal.connect(
             self.update_ip_info)
     l.addSpacing(10)
     l.addWidget(self.ip_info)
     l.addStretch(10)
Exemple #20
0
    def __init__(self, parent):
        QWidget.__init__(self, parent)
        self.default_template = default_custom_list_template()
        self.l = l = QFormLayout(self)
        l.setFieldGrowthPolicy(l.AllNonFixedFieldsGrow)
        self.la = la = QLabel('<p>' + _(
            'Here you can create a template to control what data is shown when'
            ' using the <i>Custom list</i> mode for the book list'))
        la.setWordWrap(True)
        l.addRow(la)
        self.thumbnail = t = QCheckBox(_('Show a cover &thumbnail'))
        self.thumbnail_height = th = QSpinBox(self)
        th.setSuffix(' px'), th.setRange(60, 600)
        self.entry_height = eh = QLineEdit(self)
        l.addRow(t), l.addRow(_('Thumbnail &height:'), th)
        l.addRow(_('Entry &height:'), eh)
        t.stateChanged.connect(self.changed_signal)
        th.valueChanged.connect(self.changed_signal)
        eh.textChanged.connect(self.changed_signal)
        eh.setToolTip(
            textwrap.fill(
                _('The height for each entry. The special value "auto" causes a height to be calculated'
                  ' based on the number of lines in the template. Otherwise, use a CSS length, such as'
                  ' 100px or 15ex')))
        t.stateChanged.connect(self.thumbnail_state_changed)
        th.setVisible(False)

        self.comments_fields = cf = QLineEdit(self)
        l.addRow(_('&Long text fields:'), cf)
        cf.setToolTip(
            textwrap.fill(
                _('A comma separated list of fields that will be added at the bottom of every entry.'
                  ' These fields are interpreted as containing HTML, not plain text.'
                  )))
        cf.textChanged.connect(self.changed_signal)

        self.la1 = la = QLabel('<p>' + _(
            'The template below will be interpreted as HTML and all {{fields}} will be replaced'
            ' by the actual metadata, if available. For custom columns use the column lookup'
            ' name, for example: #mytags. You can use {0} as a separator'
            ' to split a line into multiple columns.').format('|||'))
        la.setWordWrap(True)
        l.addRow(la)
        self.template = t = QPlainTextEdit(self)
        l.addRow(t)
        t.textChanged.connect(self.changed_signal)
        self.imex = bb = QDialogButtonBox(self)
        b = bb.addButton(_('&Import template'), bb.ActionRole)
        b.clicked.connect(self.import_template)
        b = bb.addButton(_('E&xport template'), bb.ActionRole)
        b.clicked.connect(self.export_template)
        l.addRow(bb)
Exemple #21
0
    def __init__(self):
        QWidget.__init__(self)
        self.l = QHBoxLayout()
        self.setLayout(self.l)

        self.label = QLabel("Max number of last issues to download:")
        self.l.addWidget(self.label)

        self.max_number = QSpinBox(self)
        self.max_number.setValue(prefs["max_numbers"])
        self.max_number.setMinimum(0)
        self.l.addWidget(self.max_number)
        self.label.setBuddy(self.max_number)
Exemple #22
0
    def __init__(self, logger, opts, parent=None):
        MainWindow.__init__(self, opts, parent)
        Ui_MainWindow.__init__(self)
        self.setupUi(self)
        self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose)
        self.setWindowTitle(__appname__ + _(' - LRF viewer'))

        self.logger = logger
        self.opts = opts
        self.create_document()
        self.spin_box_action = self.spin_box = QSpinBox()
        self.tool_bar.addWidget(self.spin_box)
        self.tool_bar.addSeparator()
        self.slider_action = self.slider = QSlider(Qt.Orientation.Horizontal)
        self.tool_bar.addWidget(self.slider)
        self.tool_bar.addSeparator()
        self.search = SearchBox2(self)
        self.search.initialize('lrf_viewer_search_history')
        self.search_action = self.tool_bar.addWidget(self.search)
        self.search.search.connect(self.find)

        self.action_next_page.setShortcuts([
            QKeySequence.StandardKey.MoveToNextPage,
            QKeySequence(Qt.Key.Key_Space)
        ])
        self.action_previous_page.setShortcuts([
            QKeySequence.StandardKey.MoveToPreviousPage,
            QKeySequence(Qt.Key.Key_Backspace)
        ])
        self.action_next_match.setShortcuts(QKeySequence.StandardKey.FindNext)
        self.addAction(self.action_next_match)
        self.action_next_page.triggered[(bool)].connect(self.next)
        self.action_previous_page.triggered[(bool)].connect(self.previous)
        self.action_back.triggered[(bool)].connect(self.back)
        self.action_forward.triggered[(bool)].connect(self.forward)
        self.action_next_match.triggered[(bool)].connect(self.next_match)
        self.action_open_ebook.triggered[(bool)].connect(self.open_ebook)
        self.action_configure.triggered[(bool)].connect(self.configure)
        self.spin_box.valueChanged[(int)].connect(self.go_to_page)
        self.slider.valueChanged[(int)].connect(self.go_to_page)

        self.graphics_view.setRenderHint(QPainter.RenderHint.Antialiasing,
                                         True)
        self.graphics_view.setRenderHint(QPainter.RenderHint.TextAntialiasing,
                                         True)
        self.graphics_view.setRenderHint(
            QPainter.RenderHint.SmoothPixmapTransform, True)

        self.closed = False
Exemple #23
0
    def setup_ui(self):
        from calibre.ebooks.oeb.polish.images import get_compressible_images
        self.setWindowIcon(QIcon(I('compress-image.png')))
        self.h = h = QHBoxLayout(self)
        self.images = i = QListWidget(self)
        h.addWidget(i)
        self.l = l = QVBoxLayout()
        h.addLayout(l)
        c = current_container()
        for name in sorted(get_compressible_images(c), key=numeric_sort_key):
            x = QListWidgetItem(name, i)
            x.setData(Qt.ItemDataRole.UserRole, c.filesize(name))
        i.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
        i.setMinimumHeight(350), i.setMinimumWidth(350)
        i.selectAll(), i.setSpacing(5)
        self.delegate = ImageItemDelegate(self)
        i.setItemDelegate(self.delegate)
        self.la = la = QLabel(
            _('You can compress the images in this book losslessly, reducing the file size of the book,'
              ' without affecting image quality. Typically image size is reduced by 5 - 15%.'
              ))
        la.setWordWrap(True)
        la.setMinimumWidth(250)
        l.addWidget(la), l.addSpacing(30)

        self.enable_lossy = el = QCheckBox(
            _('Enable &lossy compression of JPEG images'))
        el.setToolTip(
            _('This allows you to change the quality factor used for JPEG images.\nBy lowering'
              ' the quality you can greatly reduce file size, at the expense of the image looking blurred.'
              ))
        l.addWidget(el)
        self.h2 = h = QHBoxLayout()
        l.addLayout(h)
        self.jq = jq = QSpinBox(self)
        jq.setMinimum(0), jq.setMaximum(100), jq.setValue(
            tprefs.get('jpeg_compression_quality_for_lossless_compression',
                       80)), jq.setEnabled(False)
        jq.setToolTip(
            _('The compression quality, 1 is high compression, 100 is low compression.\nImage'
              ' quality is inversely correlated with compression quality.'))
        jq.valueChanged.connect(self.save_compression_quality)
        el.toggled.connect(jq.setEnabled)
        self.jql = la = QLabel(_('Compression &quality:'))
        la.setBuddy(jq)
        h.addWidget(la), h.addWidget(jq)
        l.addStretch(10)
        l.addWidget(self.bb)
Exemple #24
0
    def palkin_pituus_valikko(self):
        '''Luo palkin pituus tekstin sekä spinbox-valitsimen pituuden asettamista varten
        Päivittää palkin pituuden Ominaisuudet luokan avulla'''
        self.palkin_pituus = QGraphicsSimpleTextItem("Palkin pituus")
        self.palkin_pituus.setPos(300, 5)
        self.palkin_pituus.font = QtGui.QFont()
        self.palkin_pituus.font.setPointSize(12)
        self.palkin_pituus.setFont(self.palkin_pituus.font)
        self.scene.addItem(self.palkin_pituus)
        self.palkin_pituus.hide()

        self.sp = QSpinBox()
        self.scene.addWidget(self.sp)
        self.sp.hide()
        self.sp.move(450, 5)
        self.sp.setRange(0, 100)
        self.sp.setSingleStep(1)
        self.sp.setMinimumHeight(30)
        self.sp.setValue(int(Ominaisuudet.palauta_palkin_pituus(self)))
        self.paivita_pituus()
        self.sp.valueChanged.connect(self.paivita_pituus)
Exemple #25
0
    def __init__(self, console):
        super().__init__()
        self.console = console
        self.cpustress = CPUStress()

        self.stress = False

        self.layout = QVBoxLayout(self)

        self.title = QLabel(
            "<h1>CPU Stress</h1>\nAnzahl der Kerne (0 Cores = Anzahl der Systemkerne"
        )
        self.layout.addWidget(self.title)
        self.cpuCoresSpin = QSpinBox()
        self.layout.addWidget(self.cpuCoresSpin)

        self.startButton = QPushButton("Start")
        self.startButton.clicked.connect(self.start)
        self.layout.addWidget(self.startButton)

        self.layout.addStretch(1)
    def setLines(self):
        _, intClass, compMini, _, _ = self.getAmostSexo()
        if intClass is not None and compMini is not None:
            mini = float(compMini)
            intClass = float(intClass)

            self.TWComprimentos.setRowCount(self.rowCount)
            for row in range(self.rowCount):
                spinBox = QSpinBox()  #Criando objecto Spin e double box
                doubleSpin = QDoubleSpinBox()
                if row == 0:
                    idx = mini
                else:
                    idx = mini + (row * intClass
                                  )  #formula para determinar o valor inicial
                doubleSpin.setMinimum(idx)
                doubleSpin.setReadOnly(True)
                self.TWComprimentos.setCellWidget(
                    row, 0, doubleSpin)  #Configurando os valores nas possicoes
                self.TWComprimentos.setCellWidget(row, 1, spinBox)
            self.toEdit()
Exemple #27
0
    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)
        l.setFieldGrowthPolicy(
            QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow)
        self.missing_icons_group = mg = QGroupBox(self)
        self.mising_icons = mi = QListWidget(mg)
        mi.setSelectionMode(QAbstractItemView.SelectionMode.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.license = lc = QLineEdit(self)
        l.addRow(_('&License:'), lc)
        self.url = QLineEdit(self)
        l.addRow(_('&URL:'), self.url)
        lc.setText(
            _('The license for the icons in this theme. Common choices are'
              ' Creative Commons or Public Domain.'))
        self.description = QTextEdit(self)
        l.addRow(self.description)
        self.refresh_button = rb = self.bb.addButton(
            _('&Refresh'), QDialogButtonBox.ButtonRole.ActionRole)
        rb.setIcon(QIcon(I('view-refresh.png')))
        rb.clicked.connect(self.refresh)

        self.apply_report()
Exemple #28
0
    def _create_widget(self, value):
        if isinstance(value, str):
            widget = QLineEdit()
            widget.setText(value)
            widget.setPlaceholderText('String Val')
        elif isinstance(value, list):
            return [self._create_widget(v) for v in value]
        else:
            if isinstance(value, int):
                widget = QSpinBox()
            else:
                widget = QDoubleSpinBox()
                decimal = str(value)[::-1].find('.')
                widget.setDecimals(decimal)
                widget.setSingleStep(pow(10, -decimal))

            widget.setMinimum(-9999999)
            widget.setMaximum(9999999)
            widget.setValue(value)

        widget.setFixedWidth(100)
        widget.setAlignment(Qt.AlignRight)
        return widget
Exemple #29
0
    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__(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)