Пример #1
0
 def accept(self):
     if self.key_ledit.text().isEmpty() or unicode(
             self.key_ledit.text()).isspace():
         errmsg = u"Key name field cannot be empty!"
         return error_dialog(None,
                             "{0} {1}".format(PLUGIN_NAME, PLUGIN_VERSION),
                             _(errmsg),
                             show=True,
                             show_copy_button=False)
     if len(self.key_ledit.text()) < 4:
         errmsg = u"Key name must be at <i>least</i> 4 characters long!"
         return error_dialog(None,
                             "{0} {1}".format(PLUGIN_NAME, PLUGIN_VERSION),
                             _(errmsg),
                             show=True,
                             show_copy_button=False)
     if uStrCmp(self.key_ledit.text(),
                self.parent.listy.currentItem().text()):
         # Same exact name ... do nothing.
         return QDialog.reject(self)
     for k in self.parent.plugin_keys.keys():
         if (uStrCmp(self.key_ledit.text(), k, True) and
                 not uStrCmp(k,
                             self.parent.listy.currentItem().text(), True)):
             errmsg = u"The key name <strong>{0}</strong> is already being used.".format(
                 self.key_ledit.text())
             return error_dialog(None,
                                 "{0} {1}".format(PLUGIN_NAME,
                                                  PLUGIN_VERSION),
                                 _(errmsg),
                                 show=True,
                                 show_copy_button=False)
     QDialog.accept(self)
Пример #2
0
 def accept(self):
     isbn = unicode(self.line_edit.text())
     if not check_isbn(isbn):
         return error_dialog(self, _('Invalid ISBN'),
                 _('The ISBN you entered is not valid. Try again.'),
                 show=True)
     QDialog.accept(self)
Пример #3
0
 def accept(self):
     if len(self.key_name) == 0 or len(self.user_name) == 0 or len(
             self.cc_number) == 0 or self.key_name.isspace(
             ) or self.user_name.isspace() or self.cc_number.isspace():
         errmsg = u"All fields are required!"
         return error_dialog(None,
                             "{0} {1}".format(PLUGIN_NAME, PLUGIN_VERSION),
                             errmsg,
                             show=True,
                             show_copy_button=False)
     if not self.cc_number.isdigit():
         errmsg = u"Numbers only in the credit card number field!"
         return error_dialog(None,
                             "{0} {1}".format(PLUGIN_NAME, PLUGIN_VERSION),
                             errmsg,
                             show=True,
                             show_copy_button=False)
     if len(self.key_name) < 4:
         errmsg = u"Key name must be at <i>least</i> 4 characters long!"
         return error_dialog(None,
                             "{0} {1}".format(PLUGIN_NAME, PLUGIN_VERSION),
                             errmsg,
                             show=True,
                             show_copy_button=False)
     QDialog.accept(self)
Пример #4
0
 def accept(self):
     if not self.ans:
         return error_dialog(self,
                             _('No recipients'),
                             _('You must select at least one recipient'),
                             show=True)
     QDialog.accept(self)
Пример #5
0
    def accept(self):
        url = ('http://calibre-ebook.com/download_' +
            ('portable' if isportable else 'windows' if iswindows
                else 'osx' if isosx else 'linux'))
        open_url(QUrl(url))

        QDialog.accept(self)
Пример #6
0
    def accept(self):
        url = ('http://calibre-ebook.com/download_' +
               ('portable' if isportable else
                'windows' if iswindows else 'osx' if isosx else 'linux'))
        open_url(QUrl(url))

        QDialog.accept(self)
Пример #7
0
 def accept(self):
     """
     The slot method for the 'OK' button.
     """
     if self.run_nanohive():
         return
     QDialog.accept(self)
Пример #8
0
    def accept(self):
        txt = unicode(self.textbox.toPlainText()).rstrip()
        if self.coloring:
            if self.colored_field.currentIndex() == -1:
                error_dialog(self,
                             _('No column chosen'),
                             _('You must specify a column to be colored'),
                             show=True)
                return
            if not txt:
                error_dialog(self,
                             _('No template provided'),
                             _('The template box cannot be empty'),
                             show=True)
                return

            self.rule = (unicode(
                self.colored_field.itemData(
                    self.colored_field.currentIndex()).toString()), txt)
        elif self.iconing:
            rt = unicode(
                self.icon_kind.itemData(
                    self.icon_kind.currentIndex()).toString())
            self.rule = (rt,
                         unicode(
                             self.icon_field.itemData(
                                 self.icon_field.currentIndex()).toString()),
                         txt)
        else:
            self.rule = ('', txt)
        QDialog.accept(self)
Пример #9
0
 def accept(self):
     un = unicode(self.username.text())
     if self.service.get('at_in_username', False) and '@' not in un:
         return error_dialog(self, _('Incorrect username'),
                 _('%s needs the full email address as your username') %
                 self.service['name'], show=True)
     QDialog.accept(self)
Пример #10
0
 def accept(self):
     un = unicode(self.username.text())
     if self.service.get('at_in_username', False) and '@' not in un:
         return error_dialog(self, _('Incorrect username'),
                 _('%s needs the full email address as your username') %
                 self.service['name'], show=True)
     QDialog.accept(self)
Пример #11
0
 def accept(self):
     """
     Slot for the 'OK' button 
     """
     self.jig.try_rename(self.nameLineEdit.text())
     self.jig.assy.w.win_update() # Update model tree
     self.jig.assy.changed()
     QDialog.accept(self)
Пример #12
0
 def accept(self):
     if len(self.key_name) == 0 or self.key_name.isspace():
         errmsg = u"Please enter an eInk Kindle Serial Number or click Cancel in the dialog."
         return error_dialog(None, "{0} {1}".format(PLUGIN_NAME, PLUGIN_VERSION), errmsg, show=True, show_copy_button=False)
     if len(self.key_name) != 16:
         errmsg = u"EInk Kindle Serial Numbers must be 16 characters long. This is {0:d} characters long.".format(len(self.key_name))
         return error_dialog(None, "{0} {1}".format(PLUGIN_NAME, PLUGIN_VERSION), errmsg, show=True, show_copy_button=False)
     QDialog.accept(self)
Пример #13
0
 def accept(self):
     if len(self.key_name) == 0 or self.key_name.isspace():
         errmsg = u"Please enter a Mobipocket PID or click Cancel in the dialog."
         return error_dialog(None, "{0} {1}".format(PLUGIN_NAME, PLUGIN_VERSION), errmsg, show=True, show_copy_button=False)
     if len(self.key_name) != 8 and len(self.key_name) != 10:
         errmsg = u"Mobipocket PIDs must be 8 or 10 characters long. This is {0:d} characters long.".format(len(self.key_name))
         return error_dialog(None, "{0} {1}".format(PLUGIN_NAME, PLUGIN_VERSION), errmsg, show=True, show_copy_button=False)
     QDialog.accept(self)
Пример #14
0
 def accept(self):
     if len(self.key_name) == 0 or self.key_name.isspace():
         errmsg = u"All fields are required!"
         return error_dialog(None, "{0} {1}".format(PLUGIN_NAME, PLUGIN_VERSION), errmsg, show=True, show_copy_button=False)
     if len(self.key_name) < 4:
         errmsg = u"Key name must be at <i>least</i> 4 characters long!"
         return error_dialog(None, "{0} {1}".format(PLUGIN_NAME, PLUGIN_VERSION), errmsg, show=True, show_copy_button=False)
     QDialog.accept(self)
Пример #15
0
 def accept(self):
     """
     Slot for the 'OK' button 
     """
     self.chunk.try_rename(self.nameLineEdit.text())
     self.chunk.assy.w.win_update() # Update model tree
     self.chunk.assy.changed()        
     QDialog.accept(self)
Пример #16
0
 def cancel_btn_clicked(self):
     'Slot for Cancel button.'
     self.win.assy.current_command_info(cmdname = self.cmdname + " (Cancel)")
     if self.node_is_new:
         self.remove_node()
     else:
         self.set_params(self.node, self.previousParams)
     QDialog.accept(self)   
Пример #17
0
 def cancel_btn_clicked(self):
     'Slot for Cancel button.'
     self.win.assy.current_command_info(cmdname=self.cmdname + " (Cancel)")
     if self.node_is_new:
         self.remove_node()
     else:
         self.set_params(self.node, self.previousParams)
     QDialog.accept(self)
Пример #18
0
 def accept(self):
     newloc = unicode(self.loc.text())
     if not db_class.exists_at(newloc):
         error_dialog(self, _("No library found"), _("No existing calibre library found at %s") % newloc, show=True)
         return
     self.stats.rename(self.location, newloc)
     self.newloc = newloc
     QDialog.accept(self)
Пример #19
0
    def accept(self):
        n = unicode(self.vl_name.currentText()).strip()
        if not n:
            error_dialog(
                self.gui,
                _('No name'),
                _('You must provide a name for the new virtual library'),
                show=True)
            return

        if n.startswith('*'):
            error_dialog(self.gui,
                         _('Invalid name'),
                         _('A virtual library name cannot begin with "*"'),
                         show=True)
            return

        if n in self.existing_names and n != self.editing:
            if not question_dialog(
                    self.gui,
                    _('Name already in use'),
                    _('That name is already in use. Do you want to replace it '
                      'with the new search?'),
                    default_yes=False):
                return

        v = unicode(self.vl_text.text()).strip()
        if not v:
            error_dialog(
                self.gui,
                _('No search string'),
                _('You must provide a search to define the new virtual library'
                  ),
                show=True)
            return

        try:
            db = self.gui.library_view.model().db
            recs = db.data.search_getting_ids('', v, use_virtual_library=False)
        except ParseException as e:
            error_dialog(self.gui,
                         _('Invalid search'),
                         _('The search in the search box is not valid'),
                         det_msg=e.msg,
                         show=True)
            return

        if not recs and not question_dialog(
                self.gui,
                _('Search found no books'),
                _('The search found no books, so the virtual library '
                  'will be empty. Do you really want to use that search?'),
                default_yes=False):
            return

        self.library_name = n
        self.library_search = v
        QDialog.accept(self)
Пример #20
0
 def accept(self):
     if self.rule_kind != 'color':
         fname = lower(unicode(self.filename_box.currentText()))
         if not fname:
             error_dialog(self, _('No icon selected'),
                     _('You must choose an icon for this rule'), show=True)
             return
     if self.validate():
         QDialog.accept(self)
Пример #21
0
 def accept(self):
     isbn = unicode(self.line_edit.text())
     if not check_isbn(isbn):
         return error_dialog(
             self,
             _('Invalid ISBN'),
             _('The ISBN you entered is not valid. Try again.'),
             show=True)
     QDialog.accept(self)
Пример #22
0
 def accept(self):
     # Prevent the usual dialog accept mechanisms from working
     gprefs['metadata_single_gui_geom'] = bytearray(self.saveGeometry())
     if DEBUG_DIALOG:
         if self.stack.currentIndex() == 2:
             return QDialog.accept(self)
     else:
         if self.stack.currentIndex() == 1:
             return QDialog.accept(self)
Пример #23
0
 def accept(self):
     """The slot method for the 'Save' button."""
     QDialog.accept(self)
     self.gamessJig.try_rename(self.name_linedit.text())
     self._save_ui_settings()
     self.gamessJig.update_gamess_parms() # Update all the GAMESS parameters.
     self._save_job_parms()
     if self.edit_input_file_cbox.isChecked():
         self.open_tmp_inputfile()
Пример #24
0
 def accept(self):
     if self.rule_kind != 'color':
         fname = self.get_filenames_from_box()
         if not fname:
             error_dialog(self, _('No icon selected'),
                     _('You must choose an icon for this rule'), show=True)
             return
     if self.validate():
         QDialog.accept(self)
Пример #25
0
 def accept(self):
     # Prevent the usual dialog accept mechanisms from working
     gprefs['metadata_single_gui_geom'] = bytearray(self.saveGeometry())
     if DEBUG_DIALOG:
         if self.stack.currentIndex() == 2:
             return QDialog.accept(self)
     else:
         if self.stack.currentIndex() == 1:
             return QDialog.accept(self)
Пример #26
0
    def accept(self):
        """
        Slot for the 'OK' button
        """
        self.jig.try_rename(self.nameLineEdit.text())
        self.jig.temp = self.tempSpinBox.value()

        self.jig.assy.w.win_update() # Update model tree
        self.jig.assy.changed()
        QDialog.accept(self)
Пример #27
0
 def ok_clicked(self, *args):
     self.cover_pixmap = self.covers_widget.cover_pixmap()
     if DEBUG_DIALOG:
         if self.cover_pixmap is not None:
             self.w = QLabel()
             self.w.setPixmap(self.cover_pixmap)
             self.stack.addWidget(self.w)
             self.stack.setCurrentIndex(2)
     else:
         QDialog.accept(self)
Пример #28
0
 def accept(self):
     newloc = unicode(self.loc.text())
     if not LibraryDatabase2.exists_at(newloc):
         error_dialog(self, _('No library found'),
                 _('No existing calibre library found at %s')%newloc,
                 show=True)
         return
     self.stats.rename(self.location, newloc)
     self.newloc = newloc
     QDialog.accept(self)
Пример #29
0
 def ok_clicked(self, *args):
     self.cover_pixmap = self.covers_widget.cover_pixmap()
     if DEBUG_DIALOG:
         if self.cover_pixmap is not None:
             self.w = QLabel()
             self.w.setPixmap(self.cover_pixmap)
             self.stack.addWidget(self.w)
             self.stack.setCurrentIndex(2)
     else:
         QDialog.accept(self)
Пример #30
0
    def processDone(self):
        #self.fwThread.stop()
        self.jobTimer.stop()

        if self.process.normalExit():
            print "The process is done!"
            QDialog.accept(self.progressDialog)
        else:
            print "The process is cancelled!"
            QDialog.reject(self.progressDialog)
        return
Пример #31
0
 def on_all_done(self):
     if not self.error:
         # The cc widgets can only be accessed in the GUI thread
         try:
             for w in self.cc_widgets:
                 w.commit(self.ids)
         except Exception as err:
             import traceback
             self.error = (err, traceback.format_exc())
     self.pi.stopAnimation()
     QDialog.accept(self)
Пример #32
0
 def accept(self):
     if self.rule_kind != 'color':
         fname = lower(unicode(self.filename_box.currentText()))
         if not fname:
             error_dialog(self,
                          _('No icon selected'),
                          _('You must choose an icon for this rule'),
                          show=True)
             return
     if self.validate():
         QDialog.accept(self)
Пример #33
0
 def processDone(self):
     #self.fwThread.stop()
     self.jobTimer.stop()
     
     if self.process.normalExit():
         print "The process is done!"
         QDialog.accept(self.progressDialog)
     else:
         print "The process is cancelled!"
         QDialog.reject(self.progressDialog)
     return
Пример #34
0
 def accept(self):
     newloc = unicode(self.loc.text())
     if not db_class.exists_at(newloc):
         error_dialog(self,
                      _('No library found'),
                      _('No existing calibre library found at %s') % newloc,
                      show=True)
         return
     self.stats.rename(self.location, newloc)
     self.newloc = newloc
     QDialog.accept(self)
Пример #35
0
 def accept(self):
     if self.rule_kind != 'color':
         fname = self.get_filenames_from_box()
         if not fname:
             error_dialog(self,
                          _('No icon selected'),
                          _('You must choose an icon for this rule'),
                          show=True)
             return
     if self.validate():
         QDialog.accept(self)
Пример #36
0
 def accept(self):
     if len(self.key_name) == 0 or len(self.user_name) == 0 or len(self.cc_number) == 0 or self.key_name.isspace() or self.user_name.isspace() or self.cc_number.isspace():
         errmsg = u"All fields are required!"
         return error_dialog(None, "{0} {1}".format(PLUGIN_NAME, PLUGIN_VERSION), errmsg, show=True, show_copy_button=False)
     if not self.cc_number.isdigit():
         errmsg = u"Numbers only in the credit card number field!"
         return error_dialog(None, "{0} {1}".format(PLUGIN_NAME, PLUGIN_VERSION), errmsg, show=True, show_copy_button=False)
     if len(self.key_name) < 4:
         errmsg = u"Key name must be at <i>least</i> 4 characters long!"
         return error_dialog(None, "{0} {1}".format(PLUGIN_NAME, PLUGIN_VERSION), errmsg, show=True, show_copy_button=False)
     QDialog.accept(self)
Пример #37
0
 def accept(self):
     if not self.current_library_book_id:
         d = error_dialog(self.gui, _('Match books'),
                  _('You must select a matching book'))
         d.exec_()
         return
     mi = self.library_db.get_metadata(self.current_library_book_id,
                           index_is_id=True, get_user_categories=False)
     self.device_db[self.current_device_book_id].smart_update(mi, replace_metadata=True)
     self.device_db[self.current_device_book_id].in_library_waiting = True
     self.save_state()
     QDialog.accept(self)
Пример #38
0
    def accept(self):
        n = unicode(self.vl_name.currentText()).strip()
        if not n:
            error_dialog(self.gui, _("No name"), _("You must provide a name for the new virtual library"), show=True)
            return

        if n.startswith("*"):
            error_dialog(self.gui, _("Invalid name"), _('A virtual library name cannot begin with "*"'), show=True)
            return

        if n in self.existing_names and n != self.editing:
            if not question_dialog(
                self.gui,
                _("Name already in use"),
                _("That name is already in use. Do you want to replace it " "with the new search?"),
                default_yes=False,
            ):
                return

        v = unicode(self.vl_text.text()).strip()
        if not v:
            error_dialog(
                self.gui,
                _("No search string"),
                _("You must provide a search to define the new virtual library"),
                show=True,
            )
            return

        try:
            db = self.gui.library_view.model().db
            recs = db.data.search_getting_ids("", v, use_virtual_library=False)
        except ParseException as e:
            error_dialog(
                self.gui, _("Invalid search"), _("The search in the search box is not valid"), det_msg=e.msg, show=True
            )
            return

        if not recs and not question_dialog(
            self.gui,
            _("Search found no books"),
            _(
                "The search found no books, so the virtual library "
                "will be empty. Do you really want to use that search?"
            ),
            default_yes=False,
        ):
            return

        self.library_name = n
        self.library_search = v
        QDialog.accept(self)
Пример #39
0
    def accept(self):
        '''Slot for the 'OK' button '''
        self.grid_plane.cancelled = False
        self.grid_plane.try_rename(self.name_linedit.text())
        self.grid_plane.width = float(self.width_spinbox.value())
        self.grid_plane.height = float(self.height_spinbox.value())
        self.grid_plane.x_spacing = float(self.x_spacing_spinbox.value())
        self.grid_plane.y_spacing = float(self.y_spacing_spinbox.value())

        self.grid_plane.assy.w.win_update()  # Update model tree
        self.grid_plane.assy.changed()

        QDialog.accept(self)
Пример #40
0
 def accept(self):
     '''Slot for the 'OK' button '''
     self.grid_plane.cancelled = False
     self.grid_plane.try_rename(self.name_linedit.text())
     self.grid_plane.width = float(self.width_spinbox.value())
     self.grid_plane.height = float(self.height_spinbox.value())
     self.grid_plane.x_spacing = float(self.x_spacing_spinbox.value())
     self.grid_plane.y_spacing = float(self.y_spacing_spinbox.value())
     
     self.grid_plane.assy.w.win_update() # Update model tree
     self.grid_plane.assy.changed()
     
     QDialog.accept(self)
Пример #41
0
    def accept(self):
        path = unicode(self.path.text())
        if not path:
            return error_dialog(self, _('Path not specified'), _(
                'You must specify the path to the OPML file to import'), show=True)
        with open(path, 'rb') as f:
            raw = f.read()
        self.recipes = tuple(import_opml(raw, self.preserve_groups.isChecked()))
        if len(self.recipes) == 0:
            return error_dialog(self, _('No feeds found'), _(
                'No importable RSS feeds found in the OPML file'), show=True)

        QDialog.accept(self)
Пример #42
0
    def accept(self):
        '''Slot for the 'OK' button '''
        self.jig.cancelled = False
        self.jig.try_rename(self.nameLineEdit.text())
        self.jig.force = float(str(self.forceLineEdit.text()))
        self.jig.stiffness = float(str(self.stiffnessLineEdit.text()))

        self.change_motor_size(gl_update=False)

        self.jig.enable_minimize = self.enable_minimize_checkbox.isChecked()

        self.jig.assy.w.win_update()  # Update model tree
        self.jig.assy.changed()
        QDialog.accept(self)
Пример #43
0
    def accept(self):
        '''Slot for the 'OK' button '''
        self.jig.cancelled = False
        self.jig.try_rename(self.nameLineEdit.text())
        self.jig.force = float(str(self.forceLineEdit.text()))
        self.jig.stiffness = float(str(self.stiffnessLineEdit.text()))

        self.change_motor_size(gl_update=False)
        
        self.jig.enable_minimize = self.enable_minimize_checkbox.isChecked()

        self.jig.assy.w.win_update() # Update model tree
        self.jig.assy.changed()
        QDialog.accept(self)
Пример #44
0
 def accept(self):
     if not self.current_library_book_id:
         d = error_dialog(self.gui, _('Match books'),
                          _('You must select a matching book'))
         d.exec_()
         return
     mi = self.library_db.get_metadata(self.current_library_book_id,
                                       index_is_id=True,
                                       get_user_categories=False)
     self.device_db[self.current_device_book_id].smart_update(
         mi, replace_metadata=True)
     self.device_db[self.current_device_book_id].in_library_waiting = True
     self.save_state()
     QDialog.accept(self)
Пример #45
0
    def accept(self):
        port = unicode(self.fixed_port.text())
        if not port:
            error_dialog(self,
                         _('Invalid port number'),
                         _('You must provide a port number.'),
                         show=True)
            return
        try:
            port = int(port)
        except:
            error_dialog(
                self,
                _('Invalid port number'),
                _('The port must be a number between 8000 and 32000.'),
                show=True)
            return

        if port < 8000 or port > 32000:
            error_dialog(
                self,
                _('Invalid port number'),
                _('The port must be a number between 8000 and 32000.'),
                show=True)
            return

        self.device_manager.set_option('smartdevice', 'password',
                                       unicode(self.password_box.text()))
        self.device_manager.set_option('smartdevice', 'autostart',
                                       self.autostart_box.isChecked())
        self.device_manager.set_option('smartdevice', 'use_fixed_port',
                                       self.use_fixed_port.isChecked())
        self.device_manager.set_option('smartdevice', 'port_number',
                                       unicode(self.fixed_port.text()))

        message = self.device_manager.start_plugin('smartdevice')

        if not self.device_manager.is_running('smartdevice'):
            error_dialog(
                self,
                _('Problem starting the wireless device'),
                _('The wireless device driver had problems starting. It said "%s"'
                  ) % message,
                show=True)
            self.device_manager.set_option('smartdevice', 'use_fixed_port',
                                           self.orig_fixed_port)
            self.device_manager.set_option('smartdevice', 'port_number',
                                           self.orig_port_number)
        else:
            QDialog.accept(self)
Пример #46
0
    def accept(self):
        txt = unicode(self.textbox.toPlainText()).rstrip()
        if self.coloring:
            if self.colored_field.currentIndex() == -1:
                error_dialog(self, _('No column chosen'),
                    _('You must specify a column to be colored'), show=True)
                return
            if not txt:
                error_dialog(self, _('No template provided'),
                    _('The template box cannot be empty'), show=True)
                return

        self.rule = (unicode(self.colored_field.currentText()), txt)
        QDialog.accept(self)
Пример #47
0
 def accept(self):
     '''Slot for the 'OK' button '''
     self.jig.cancelled = False   
     self.jig.try_rename(self.name_linedit.text())
     self.change_jig_size(gl_update=False)
     self.jig.resolution = float(self.resolution_spinbox.value())
     
     # Before exit the dialog, turn off the highlighting and selection
     #self.jig.highlightChecked = False # Let's try leaving highlighted atoms on.  It's useful.  Mark 051004.
     self.jig.pickSelected(False)
             
     self.jig.assy.w.win_update() # Update model tree
     self.jig.assy.changed()
     
     QDialog.accept(self)
Пример #48
0
    def accept(self):
        '''Slot for the 'OK' button '''
        self.jig.cancelled = False
        self.jig.try_rename(self.name_linedit.text())
        self.change_jig_size(gl_update=False)
        self.jig.resolution = float(self.resolution_spinbox.value())

        # Before exit the dialog, turn off the highlighting and selection
        #self.jig.highlightChecked = False # Let's try leaving highlighted atoms on.  It's useful.  Mark 051004.
        self.jig.pickSelected(False)

        self.jig.assy.w.win_update()  # Update model tree
        self.jig.assy.changed()

        QDialog.accept(self)
Пример #49
0
 def accept(self, *args):
     if self.shortcut_config.is_editing:
         from calibre.gui2 import info_dialog
         info_dialog(self, _('Still editing'),
                 _('You are in the middle of editing a keyboard shortcut'
                     ' first complete that, by clicking outside the '
                     ' shortcut editing box.'), show=True)
         return
     c = config()
     c.set('serif_family', unicode(self.serif_family.currentFont().family()))
     c.set('sans_family', unicode(self.sans_family.currentFont().family()))
     c.set('mono_family', unicode(self.mono_family.currentFont().family()))
     c.set('default_font_size', self.default_font_size.value())
     c.set('mono_font_size', self.mono_font_size.value())
     c.set('standard_font', {0:'serif', 1:'sans', 2:'mono'}[self.standard_font.currentIndex()])
     c.set('user_css', unicode(self.css.toPlainText()))
     c.set('remember_window_size', self.opt_remember_window_size.isChecked())
     c.set('fit_images', self.opt_fit_images.isChecked())
     c.set('max_fs_width', int(self.max_fs_width.value()))
     c.set('hyphenate', self.hyphenate.isChecked())
     c.set('remember_current_page', self.opt_remember_current_page.isChecked())
     c.set('wheel_flips_pages', self.opt_wheel_flips_pages.isChecked())
     c.set('page_flip_duration', self.opt_page_flip_duration.value())
     c.set('font_magnification_step',
             float(self.opt_font_mag_step.value())/100.)
     idx = self.hyphenate_default_lang.currentIndex()
     c.set('hyphenate_default_lang',
             str(self.hyphenate_default_lang.itemData(idx).toString()))
     c.set('line_scrolling_stops_on_pagebreaks',
             self.opt_line_scrolling_stops_on_pagebreaks.isChecked())
     c.set('fullscreen_clock', self.opt_fullscreen_clock.isChecked())
     return QDialog.accept(self, *args)
Пример #50
0
 def accept(self):
     if len(self.key_name) == 0 or self.key_name.isspace():
         errmsg = u"All fields are required!"
         return error_dialog(None,
                             "{0} {1}".format(PLUGIN_NAME, PLUGIN_VERSION),
                             errmsg,
                             show=True,
                             show_copy_button=False)
     if len(self.key_name) < 4:
         errmsg = u"Key name must be at <i>least</i> 4 characters long!"
         return error_dialog(None,
                             "{0} {1}".format(PLUGIN_NAME, PLUGIN_VERSION),
                             errmsg,
                             show=True,
                             show_copy_button=False)
     QDialog.accept(self)
Пример #51
0
    def accept(self):
        """Slot for the 'OK' button """
        self.jig.cancelled = False
        self.jig.try_rename(self.nameLineEdit.text())
        self.jig.torque = float(str(self.torqueLineEdit.text()))
        self.jig.initial_speed = float(str(self.initialSpeedLineEdit.text()))
        self.jig.speed = float(str(self.speedLineEdit.text()))

        self.change_motor_size(gl_update=False)

        self.jig.enable_minimize = self.enable_minimize_checkbox.isChecked()
        self.jig.dampers_enabled = self.dampers_checkbox.isChecked()  # bruce 060421

        self.jig.assy.w.win_update()  # Update model tree
        self.jig.assy.changed()
        QDialog.accept(self)
Пример #52
0
 def accept(self):
     if not self.name_is_ok:
         return error_dialog(self, _('No name specified'), _(
             'You must specify a name for the new file, with an extension, for example, chapter1.html'), show=True)
     name = unicode(self.name.text())
     name, ext = name.rpartition('.')[0::2]
     name = (name + '.' + ext.lower()).replace('\\', '/')
     mt = guess_type(name)
     if mt in OEB_DOCS:
         self.file_data = template_for('html').encode('utf-8')
         self.using_template = True
     elif mt in OEB_STYLES:
         self.file_data = template_for('css').encode('utf-8')
         self.using_template = True
     self.file_name = name
     QDialog.accept(self)
Пример #53
0
 def accept(self):
     if len(self.key_name) == 0 or self.key_name.isspace():
         errmsg = u"Please enter a Mobipocket PID or click Cancel in the dialog."
         return error_dialog(None,
                             "{0} {1}".format(PLUGIN_NAME, PLUGIN_VERSION),
                             errmsg,
                             show=True,
                             show_copy_button=False)
     if len(self.key_name) != 8 and len(self.key_name) != 10:
         errmsg = u"Mobipocket PIDs must be 8 or 10 characters long. This is {0:d} characters long.".format(
             len(self.key_name))
         return error_dialog(None,
                             "{0} {1}".format(PLUGIN_NAME, PLUGIN_VERSION),
                             errmsg,
                             show=True,
                             show_copy_button=False)
     QDialog.accept(self)
Пример #54
0
 def accept(self):
     if len(self.key_name) == 0 or self.key_name.isspace():
         errmsg = u"Please enter an eInk Kindle Serial Number or click Cancel in the dialog."
         return error_dialog(None,
                             "{0} {1}".format(PLUGIN_NAME, PLUGIN_VERSION),
                             errmsg,
                             show=True,
                             show_copy_button=False)
     if len(self.key_name) != 16:
         errmsg = u"EInk Kindle Serial Numbers must be 16 characters long. This is {0:d} characters long.".format(
             len(self.key_name))
         return error_dialog(None,
                             "{0} {1}".format(PLUGIN_NAME, PLUGIN_VERSION),
                             errmsg,
                             show=True,
                             show_copy_button=False)
     QDialog.accept(self)
Пример #55
0
    def accept(self):
        '''Slot for the 'OK' button '''
        self.jig.cancelled = False
        self.jig.try_rename(self.nameLineEdit.text())
        self.jig.torque = float(str(self.torqueLineEdit.text()))
        self.jig.initial_speed = float(str(self.initialSpeedLineEdit.text()))
        self.jig.speed = float(str(self.speedLineEdit.text()))

        self.change_motor_size(gl_update=False)

        self.jig.enable_minimize = self.enable_minimize_checkbox.isChecked()
        self.jig.dampers_enabled = self.dampers_checkbox.isChecked(
        )  # bruce 060421

        self.jig.assy.w.win_update()  # Update model tree
        self.jig.assy.changed()
        QDialog.accept(self)
Пример #56
0
 def accept(self):
     if not self.current_library_book_id:
         d = error_dialog(self.gui, _('Match books'),
                  _('You must select a matching book'))
         d.exec_()
         return
     mi = self.library_db.get_metadata(self.current_library_book_id,
                           index_is_id=True, get_user_categories=False,
                           get_cover=True)
     book = self.device_db[self.current_device_book_id]
     book.smart_update(mi, replace_metadata=True)
     self.gui.update_thumbnail(book)
     book.in_library_waiting = True
     self.view.model().current_changed(self.current_device_book_index,
                                       self.current_device_book_index)
     self.save_state()
     QDialog.accept(self)
Пример #57
0
 def accept(self, *args, **kwargs):
     if self._step is None:
         name = str(self.cb_step_type.currentText())
         step_class = Step.REGISTERED_STEPS[name]
         self._step = step_class()
         self.widgets.currentWidget().save(self._step.attributes())
     else:
         self._selected_widget.save()
     return QDialog.accept(self, *args, **kwargs)