Example #1
0
    def __init__(self,
                 sim_env,
                 phys_lay=None,
                 data_lay=None,
                 transport_lay=None):
        ''' Constructor
            
            Input:    sim_env          simpy.Environment                environment of this component
                      phys_lay         AbstractPhysicalLayer            physical Layer of this module
                      data_lay         AbstractDataLinkLayer            data link Layer of this module
                      transport_lay    AbstractTransportLayer           transport Layer of this module
            Output:   -
        '''
        QObject.__init__(self)

        # component information
        self.sim_env = sim_env
        self.comp_id = uuid.uuid4()
        self._jitter = 1

        # layers
        self.transp_lay = transport_lay
        self.physical_lay = phys_lay
        self.datalink_lay = data_lay

        # project parameter
        self.MessageClass = proj.BUS_MSG_CLASS
Example #2
0
    def __init__(self, parent, db):
        QObject.__init__(self, parent)
        self.internet_connection_failed = False
        self._parent = parent
        self.no_internet_msg = _('Cannot download news as no internet connection '
                'is active')
        self.no_internet_dialog = d = error_dialog(self._parent,
                self.no_internet_msg, _('No internet connection'),
                show_copy_button=False)
        d.setModal(False)

        self.recipe_model = RecipeModel()
        self.db = db
        self.lock = QMutex(QMutex.Recursive)
        self.download_queue = set([])

        self.news_menu = QMenu()
        self.news_icon = QIcon(I('news.png'))
        self.scheduler_action = QAction(QIcon(I('scheduler.png')), _('Schedule news download'), self)
        self.news_menu.addAction(self.scheduler_action)
        self.scheduler_action.triggered[bool].connect(self.show_dialog)
        self.cac = QAction(QIcon(I('user_profile.png')), _('Add a custom news source'), self)
        self.cac.triggered[bool].connect(self.customize_feeds)
        self.news_menu.addAction(self.cac)
        self.news_menu.addSeparator()
        self.all_action = self.news_menu.addAction(
                _('Download all scheduled news sources'),
                self.download_all_scheduled)

        self.timer = QTimer(self)
        self.timer.start(int(self.INTERVAL * 60 * 1000))
        self.timer.timeout.connect(self.check)
        self.oldest = gconf['oldest_news']
        QTimer.singleShot(5 * 1000, self.oldest_check)
Example #3
0
 def __init__(self):
     QObject.__init__(self)
     self._database = None
     self._layerSet = None
     self._currentLayer = None
     self._currentLayerColor = None
     self._mapCanvas = None
Example #4
0
 def __init__(self, meqnl=None, parent=None):
     QObject.__init__(self, parent)
     self.serial = 0
     if meqnl:
         self.load_meqlist(meqnl)
     else:
         self.clear()
Example #5
0
    def __init__(self):
        QObject.__init__(self)

        path = os.path.abspath("UIForms//ScanBrelok.ui")
        self.window = uic.loadUi(path)
        self.window.setWindowFlags(QtCore.Qt.FramelessWindowHint)

        desktop = QtGui.QApplication.desktop()
        self.window.move(desktop.availableGeometry().center() -
                         self.window.rect().center())

        self.translate = Settings.Translate()
        self.settings = self._getSettings()
        self.defaultLanguage = u'Русский'

        self.window.lbl_scan.hide()
        self.connect(self.window.btn_scan, QtCore.SIGNAL("clicked()"),
                     self.scanHandler)
        self.connect(self.window.btn_ScanOK, QtCore.SIGNAL("clicked()"),
                     self.scanOKHandler)  #Test
        self.window.btn_exit.clicked.connect(self._closeApp)
        self.window.cmbx_lang.currentIndexChanged.connect(self._changeLocale)
        self.timer = None
        self.clickCounter = 0

        self._setLang()
Example #6
0
 def __init__(self, parent, menu, toolbar):
     QObject.__init__(self, parent)
     self._currier = PersistentCurrier()
     # get list of mouse modes from config
     modelist = []
     for mid in Config.get("mouse-modes", _DefaultModes).split(","):
         if not ConfigFile.has_section(mid):
             print("ERROR: unknown mouse-mode '%s', skipping. Check your %s." % (mid, ConfigFileName))
         else:
             modelist.append(self._readModeConfig(mid))
     self._modes = dict([(mode.id, mode) for mode in modelist])
     self._qag_mode = QActionGroup(self)
     self._qag_submode = QActionGroup(self)
     self._all_submodes = []
     # make entries for main modes
     for mode in modelist:
         mode.addAction(menu, self._qag_mode, callback=self._currier.curry(self._setMode, mode.id))
         if mode.submodes:
             self._all_submodes += list(mode.submodes)
     # make entries for submodes
     self._qa_submode_sep = menu.addSeparator()
     self._modes.update([(mode.id, mode) for mode in self._all_submodes])
     for mode in self._all_submodes:
         mode.addAction(menu, self._qag_submode, toolbar=toolbar,
                        callback=self._currier.curry(self._setSubmode, mode.id))
     # other init
     self._current_context = None
     self._available_submodes = []
     # set initial mode
     initmode = Config.get("current-mouse-mode", _DefaultInitialMode)
     if initmode not in self._modes:
         initmode = modelist[0].id
     self._modes[initmode].qa.setChecked(True)
     self._setMode(initmode, write_config=False)
Example #7
0
 def __init__(self,
              name,
              color0=QColor("black"),
              color1=QColor("white"),
              alpha=(1, 1)):
     QObject.__init__(self)
     self.name = name
     # color is either specified as one argument (which should then be a [3,n] or [4,n] array),
     # or as two QColors orstring names.
     if isinstance(color0, (list, tuple)):
         self._rgb = numpy.array(color0)
         if self._rgb.shape[1] != 3 or self._rgb.shape[0] < 2:
             raise TypeError(
                 "expected [N,3] (N>=2) array as first argument")
     else:
         if isinstance(color0, str):
             color0 = QColor(color0)
         if isinstance(color1, str):
             color1 = QColor(color1)
         self._rgb = numpy.array([[
             color0.red(), color0.green(),
             color0.blue()
         ], [color1.red(), color1.green(),
             color1.blue()]]) / 255.
     self._rgb_arg = numpy.arange(
         self._rgb.shape[0]) / (self._rgb.shape[0] - 1.0)
     # alpha array
     self._alpha = numpy.array(alpha).astype(float)
     self._alpha_arg = numpy.arange(len(alpha)) / (len(alpha) - 1.0)
     # background brush
     self._brush = None
Example #8
0
 def __init__(self, func, queued=True, parent=None):
     QObject.__init__(self, parent)
     self.func = func
     typ = Qt.QueuedConnection
     if not queued:
         typ = Qt.AutoConnection if queued is None else Qt.DirectConnection
     self.dispatch_signal.connect(self.dispatch, type=typ)
Example #9
0
    def __init__(self, opts, log, cover_data=None, toc=None):
        from calibre.gui2 import is_ok_to_use_qt
        if not is_ok_to_use_qt():
            raise Exception('Not OK to use Qt')
        QObject.__init__(self)

        self.logger = self.log = log
        self.opts = opts
        self.cover_data = cover_data
        self.paged_js = None
        self.toc = toc

        self.loop = QEventLoop()
        self.view = QWebView()
        self.page = Page(opts, self.log)
        self.view.setPage(self.page)
        self.view.setRenderHints(QPainter.Antialiasing|
                    QPainter.TextAntialiasing|QPainter.SmoothPixmapTransform)
        self.view.loadFinished.connect(self.render_html,
                type=Qt.QueuedConnection)
        for x in (Qt.Horizontal, Qt.Vertical):
            self.view.page().mainFrame().setScrollBarPolicy(x,
                    Qt.ScrollBarAlwaysOff)
        self.report_progress = lambda x, y: x
        self.current_section = ''
Example #10
0
    def __init__(self, parent=None, config_name='shortcuts/main'):
        QObject.__init__(self, parent)

        self.config = JSONConfig(config_name)
        self.shortcuts = OrderedDict()
        self.keys_map = {}
        self.groups = {}
Example #11
0
 def __init__(self, name, parms):
     """
     """
     QObject.__init__(self)
     
     # The parameters (parms) for the SimJob object are provided in a dictionary in key:value pairs
     # For the Gamess Jig, the parms are defined in the jig_Gamess.py.
     #
     # The parms.keys are:
     # engine: Engine (MD Simulator or GAMESS)
     # calculation: Calculation 
     # description: General job description
     # status: The status of the job (Queued, Running, Completed, Suspended or Failed)
     # job_id: Job Id, provided by JobManager.get_job_manager_job_id_and_dir()
     # start_time: Job start time
     # end_time: Job end time
     
     self.name = name
     self.parms = parms.keys()
     #self.parms.sort() # Sort parms.
     self.edit_cntl = None
     
     # WARNING: Bugs will be caused if any of SimJob's own methods or 
     # instance variables had the same name as any of the parameter ('k') values.
     for k in parms:
         self.__dict__[k] = parms[k]
     return
Example #12
0
    def __init__(self, view):
        QObject.__init__(self, view)
        self.state = State()
        self.state.swiped.connect(self.handle_swipe)
        self.evmap = {QEvent.TouchBegin: 'start', QEvent.TouchUpdate: 'update', QEvent.TouchEnd: 'end'}

        # Ignore fake mouse events generated by the window system from touch
        # events. At least on windows, we know how to identify these fake
        # events. See http://msdn.microsoft.com/en-us/library/windows/desktop/ms703320(v=vs.85).aspx
        self.is_fake_mouse_event = lambda : False
        if touch_supported and iswindows:
            MI_WP_SIGNATURE = 0xFF515700
            SIGNATURE_MASK = 0xFFFFFF00
            try:
                f = ctypes.windll.user32.GetMessageExtraInfo
                f.restype = wintypes.LPARAM
                def is_fake_mouse_event():
                    val = f()
                    ans = (val & SIGNATURE_MASK) == MI_WP_SIGNATURE
                    return ans
                self.is_fake_mouse_event = is_fake_mouse_event
                QApplication.instance().focusChanged.connect(self.register_for_wm_touch)
            except Exception:
                import traceback
                traceback.print_exc()
Example #13
0
 def __init__(self, func, queued=True, parent=None):
     QObject.__init__(self, parent)
     self.func = func
     typ = Qt.QueuedConnection
     if not queued:
         typ = Qt.AutoConnection if queued is None else Qt.DirectConnection
     self.dispatch_signal.connect(self.dispatch, type=typ)
Example #14
0
 def __init__(self, gui, ids, callback):
     from calibre.gui2.dialogs.progress import ProgressDialog
     QObject.__init__(self, gui)
     self.model = gui.library_view.model()
     self.ids = ids
     self.permanent = False
     if can_recycle and len(ids) > 100:
         if question_dialog(
                 gui, _('Are you sure?'), '<p>' +
                 _('You are trying to delete %d books. '
                   'Sending so many files to the Recycle'
                   ' Bin <b>can be slow</b>. Should calibre skip the'
                   ' Recycle Bin? If you click Yes the files'
                   ' will be <b>permanently deleted</b>.') % len(ids)):
             self.permanent = True
     self.gui = gui
     self.failures = []
     self.deleted_ids = []
     self.callback = callback
     single_shot(self.delete_one)
     self.pd = ProgressDialog(_('Deleting...'),
                              parent=gui,
                              cancelable=False,
                              min=0,
                              max=len(self.ids))
     self.pd.setModal(True)
     self.pd.show()
Example #15
0
    def __init__(self, opts, log, cover_data=None, toc=None):
        from calibre.gui2 import is_ok_to_use_qt
        from calibre.utils.podofo import get_podofo

        if not is_ok_to_use_qt():
            raise Exception("Not OK to use Qt")
        QObject.__init__(self)

        self.logger = self.log = log
        self.podofo = get_podofo()
        self.doc = self.podofo.PDFDoc()

        self.loop = QEventLoop()
        self.view = QWebView()
        self.page = Page(opts, self.log)
        self.view.setPage(self.page)
        self.view.setRenderHints(QPainter.Antialiasing | QPainter.TextAntialiasing | QPainter.SmoothPixmapTransform)
        self.view.loadFinished.connect(self._render_html, type=Qt.QueuedConnection)
        for x in (Qt.Horizontal, Qt.Vertical):
            self.view.page().mainFrame().setScrollBarPolicy(x, Qt.ScrollBarAlwaysOff)
        self.render_queue = []
        self.combine_queue = []
        self.tmp_path = PersistentTemporaryDirectory(u"_pdf_output_parts")

        self.opts = opts
        self.cover_data = cover_data
        self.paged_js = None
        self.toc = toc
Example #16
0
    def __init__(self, parent=None, config_name='shortcuts/main'):
        QObject.__init__(self, parent)

        self.config = JSONConfig(config_name)
        self.shortcuts = OrderedDict()
        self.keys_map = {}
        self.groups = {}
Example #17
0
    def __init__(self, parent, db, callback, rows, path, opts, spare_server=None):
        QObject.__init__(self, parent)
        self.pd = ProgressDialog(_("Saving..."), parent=parent)
        self.spare_server = spare_server
        self.db = db
        self.opts = opts
        self.pd.setModal(True)
        self.pd.show()
        self.pd.set_min(0)
        self.pd.set_msg(_("Collecting data, please wait..."))
        self._parent = parent
        self.callback = callback
        self.callback_called = False
        self.rq = Queue()
        self.ids = [x for x in map(db.id, [r.row() for r in rows]) if x is not None]
        self.pd_max = len(self.ids)
        self.pd.set_max(0)
        self.pd.value = 0
        self.failures = set([])

        from calibre.ebooks.metadata.worker import SaveWorker

        self.worker = SaveWorker(self.rq, db, self.ids, path, self.opts, spare_server=self.spare_server)
        self.pd.canceled_signal.connect(self.canceled)
        self.continue_updating = True
        single_shot(self.update)
Example #18
0
    def __init__(self, tcfile):
        QObject.__init__(self)
        
        self.sblind = None
        self.bblind = None
        self.bbet = None
        self.ante = None
        self.gtype = None
        self.network = None
        self.tournament = None
        self.balances = []
        self.hero = None
        
        self.heroHand = None
        self.flopCards = []
        self.turnCard = None
        self.riverCard = None

        self.players = []
        self.pfActions = []
        self.flopActions = []
        self.turnActions = []
        self.riverActions = []
        
        self.tcfile = tcfile;
Example #19
0
    def __init__(self, payment, dbProvider):
        QObject.__init__(self)

        self.dbProvider=dbProvider
        
        global _
        _= Settings._

        #Получаем сгруппированную таблицу продаваемых предметов (сумма по магазинам по каждому типу предмета) 
        self.itemsForSale=self.dbProvider.getItemsForSale() 
        
        self.window = uic.loadUi("UIForms//ChoosingItem.ui")
        self.window.setWindowFlags(QtCore.Qt.FramelessWindowHint)
        
        desktop=QtGui.QApplication.desktop()
        self.window.move(desktop.availableGeometry().center()-self.window.rect().center())
        
        self.window.btn_Cancel.clicked.connect(self._backToTitlePage)
        
        self.ItemButtonDict=self.getItemButtonDict()                            # Кнопки и надписи формы и назначенные им предметы
        self.payment=payment                                                    # Сумма, введенная пользователем
        self.timer=QTimer()                                                     #Таймер возврата на титульную страницу
        self.timer.timeout.connect(self._backToTitlePage)
        self.timer.start(30000)
        self.fillMainForm() 
Example #20
0
    def __init__(self, name, parms):
        """
        """
        QObject.__init__(self)

        # The parameters (parms) for the SimJob object are provided in a dictionary in key:value pairs
        # For the Gamess Jig, the parms are defined in the jig_Gamess.py.
        #
        # The parms.keys are:
        # engine: Engine (MD Simulator or GAMESS)
        # calculation: Calculation
        # description: General job description
        # status: The status of the job (Queued, Running, Completed, Suspended or Failed)
        # job_id: Job Id, provided by JobManager.get_job_manager_job_id_and_dir()
        # start_time: Job start time
        # end_time: Job end time

        self.name = name
        self.parms = parms.keys()
        #self.parms.sort() # Sort parms.
        self.edit_cntl = None

        # WARNING: Bugs will be caused if any of SimJob's own methods or
        # instance variables had the same name as any of the parameter ('k') values.
        for k in parms:
            self.__dict__[k] = parms[k]
        return
Example #21
0
 def __init__ (self,meqnl=None,parent=None):
   QObject.__init__(self,parent);
   self.serial = 0;
   if meqnl:
     self.load_meqlist(meqnl);
   else:
     self.clear();
Example #22
0
    def __init__(self, opts, log, cover_data=None, toc=None):
        from calibre.gui2 import is_ok_to_use_qt
        if not is_ok_to_use_qt():
            raise Exception('Not OK to use Qt')
        QObject.__init__(self)

        self.logger = self.log = log
        self.opts = opts
        self.cover_data = cover_data
        self.paged_js = None
        self.toc = toc

        self.loop = QEventLoop()
        self.view = QWebView()
        self.page = Page(opts, self.log)
        self.view.setPage(self.page)
        self.view.setRenderHints(QPainter.Antialiasing
                                 | QPainter.TextAntialiasing
                                 | QPainter.SmoothPixmapTransform)
        self.view.loadFinished.connect(self.render_html,
                                       type=Qt.QueuedConnection)
        for x in (Qt.Horizontal, Qt.Vertical):
            self.view.page().mainFrame().setScrollBarPolicy(
                x, Qt.ScrollBarAlwaysOff)
        self.report_progress = lambda x, y: x
        self.current_section = ''
Example #23
0
 def __init__(self, param, typeOperation):
     QObject.__init__(self)
     
     self.DbConnector=DbConnector()
     self.typeOperation=typeOperation
     self.itemId=param["itemId"]
     self.itemName=param["itemName"]
     if param["itemPrice"]=="0":
         self.itemPrice=0
     else:
         self.itemPrice=param["itemPrice"]
     self.itemIcon=param["itemIcon"]
     path=os.path.abspath("UI/UIForms/EditItem.ui")
     self.window=uic.loadUi(path)
     self.window.setWindowFlags(QtCore.Qt.WindowCloseButtonHint)
     self.window.setWindowModality(2)
     self.window.le_ItemName.setText("{}".format(self.itemName))
     if self.typeOperation=='Edit':
         self.window.le_ItemName.setEnabled(False) 
     self.window.le_ItemPrice.setText("{}".format(self.itemPrice))
     self.checkPrice()
     self.window.lbl_Icon.setPixmap(self.itemIcon)
     
     self.window.btn_addPath.clicked.connect(self.loadIcon)
     self.window.btn_Save.clicked.connect(self._save)
     self.connect(self.window.le_ItemPrice, QtCore.SIGNAL("editingFinished()"),self.checkPrice)
     self.connect(self.window.btn_Close, QtCore.SIGNAL("clicked()"), self.window.close) 
Example #24
0
    def __init__(self, opts, log, cover_data=None, toc=None):
        from calibre.gui2 import is_ok_to_use_qt
        from calibre.utils.podofo import get_podofo
        if not is_ok_to_use_qt():
            raise Exception('Not OK to use Qt')
        QObject.__init__(self)

        self.logger = self.log = log
        self.podofo = get_podofo()
        self.doc = self.podofo.PDFDoc()

        self.loop = QEventLoop()
        self.view = QWebView()
        self.page = Page(opts, self.log)
        self.view.setPage(self.page)
        self.view.setRenderHints(QPainter.Antialiasing
                                 | QPainter.TextAntialiasing
                                 | QPainter.SmoothPixmapTransform)
        self.view.loadFinished.connect(self._render_html,
                                       type=Qt.QueuedConnection)
        for x in (Qt.Horizontal, Qt.Vertical):
            self.view.page().mainFrame().setScrollBarPolicy(
                x, Qt.ScrollBarAlwaysOff)
        self.render_queue = []
        self.combine_queue = []
        self.tmp_path = PersistentTemporaryDirectory(u'_pdf_output_parts')

        self.opts = opts
        self.cover_data = cover_data
        self.paged_js = None
        self.toc = toc
Example #25
0
    def __init__(self, parent, db):
        QObject.__init__(self, parent)
        self.internet_connection_failed = False
        self._parent = parent
        self.no_internet_msg = _('Cannot download news as no internet connection '
                'is active')
        self.no_internet_dialog = d = error_dialog(self._parent,
                self.no_internet_msg, _('No internet connection'),
                show_copy_button=False)
        d.setModal(False)

        self.recipe_model = RecipeModel()
        self.db = db
        self.lock = QMutex(QMutex.Recursive)
        self.download_queue = set([])

        self.news_menu = QMenu()
        self.news_icon = QIcon(I('news.png'))
        self.scheduler_action = QAction(QIcon(I('scheduler.png')), _('Schedule news download'), self)
        self.news_menu.addAction(self.scheduler_action)
        self.scheduler_action.triggered[bool].connect(self.show_dialog)
        self.cac = QAction(QIcon(I('user_profile.png')), _('Add a custom news source'), self)
        self.cac.triggered[bool].connect(self.customize_feeds)
        self.news_menu.addAction(self.cac)
        self.news_menu.addSeparator()
        self.all_action = self.news_menu.addAction(
                _('Download all scheduled news sources'),
                self.download_all_scheduled)

        self.timer = QTimer(self)
        self.timer.start(int(self.INTERVAL * 60 * 1000))
        self.timer.timeout.connect(self.check)
        self.oldest = gconf['oldest_news']
        QTimer.singleShot(5 * 1000, self.oldest_check)
Example #26
0
 def __init__(self, parent):
     QObject.__init__(self, parent)
     self.global_undo = GlobalUndoHistory()
     self.container_count = 0
     self.tdir = None
     self.save_manager = SaveManager(parent)
     self.save_manager.report_error.connect(self.report_save_error)
     self.doing_terminal_save = False
Example #27
0
 def __init__(self):
     QObject.__init__(self)
     self.plugin_url = "https://github.com/marcellmars/letssharebooks/raw/master/calibreletssharebooks/letssharebooks_calibre.zip"
     self.running_version = ".".join(map(str, lsb.version))
     try:
         self.latest_version = urllib2.urlopen('https://raw.github.com/marcellmars/letssharebooks/master/calibreletssharebooks/_version').read()[:-1].encode("utf-8")
     except:
         self.latest_version = "0.0.0"
Example #28
0
    def __init__(self, config, seralize_books_function, timeout):
        Thread.__init__(self)
        QObject.__init__(self)

        self.daemon = True
        self.config = config
        self.seralize_books = seralize_books_function
        self.timeout = timeout
        self._run = True
Example #29
0
    def __init__(self, config, seralize_books_function, timeout):
        Thread.__init__(self)
        QObject.__init__(self)

        self.daemon = True
        self.config = config
        self.seralize_books = seralize_books_function
        self.timeout = timeout
        self._run = True
Example #30
0
    def __init__(self):
        QObject.__init__(self)
        path = os.path.abspath("UIForms//pass.ui")
        self.window = uic.loadUi(path)
        self.window.setWindowFlags(QtCore.Qt.FramelessWindowHint)
        self.config = self._getDBConfig(filename='config.ini',
                                        section='security')

        self.window.btn_ok.clicked.connect(self._checkPass)
Example #31
0
 def __init__(self, messageText):
     QObject.__init__(self)
     QObject.__init__(self)
     path = os.path.abspath("UI/UIForms/errorWindow.ui")
     self.window = uic.loadUi(path)
     self.window.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
     self.window.setWindowModality(QtCore.Qt.ApplicationModal)
     self.window.btn_close.clicked.connect(self.window.close)
     self.window.label.setText(messageText)
Example #32
0
 def __init__(self, executionDelay, sync, pauseCond, xmlRPCUrl):
     QObject.__init__(self)
     self.xmlRPCUrl = xmlRPCUrl
     self._connect()
     self.executionDelay = executionDelay
     self.waitingForAction = False
     self.sync = sync
     self.pauseCond = pauseCond
     self.executionPaused = False      
Example #33
0
 def __init__(self, parent=None, name=''):
     from config import display_help
     QObject.__init__(self, parent)
     self.widget = parent
     self.name = name
     self.activeView = False
     self.buttons = []
     self.widgets = []
     self.display_help = display_help()
Example #34
0
 def __init__(self, numEngPin, numSensorPin):
     QObject.__init__(self)
     print 'Инициализация мотора'
     self.engPin = Pin(numEngPin, 'OUT')
     self.sensorPin = Pin(numSensorPin, 'IN')
     self.startMotorDelay = 500
     self.sensorDelay = 2000
     self.timeOut = 6000
     print 'Инициализация мотора выполнена'
Example #35
0
 def __init__(self):
     QObject.__init__(self)
     self.connect(
         self,
         SIGNAL('edispatch(PyQt_PyObject, PyQt_PyObject, PyQt_PyObject)'),
         self._get_metadata, Qt.QueuedConnection)
     self.connect(
         self,
         SIGNAL('idispatch(PyQt_PyObject, PyQt_PyObject, PyQt_PyObject)'),
         self._from_formats, Qt.QueuedConnection)
Example #36
0
 def __init__(self, parent, notify=None):
     QObject.__init__(self, parent)
     self.global_undo = GlobalUndoHistory()
     self.container_count = 0
     self.tdir = None
     self.save_manager = SaveManager(parent, notify)
     self.save_manager.report_error.connect(self.report_save_error)
     self.doing_terminal_save = False
     self.ignore_preview_to_editor_sync = False
     setup_cssutils_serialization()
Example #37
0
 def __init__(self, input_handler_chain=False):   
     QObject.__init__(self)                
     
     self.sim_env = None
     self.monitored = []
     self.t_period = 1
     self.sample_time = 0.5  # Sample time in which the information is read from the objects
     self._show_time = True
     self._last_run_elements = RefList()
     self._init_input_handlers(input_handler_chain)
Example #38
0
 def __init__(self, input_handler_chain=False):   
     QObject.__init__(self)                
     
     self.sim_env = None
     self.monitored = []
     self.t_period = 1
     self.sample_time = 0.5  # Sample time in which the information is read from the objects
     self._show_time = True
     self._last_run_elements = RefList()
     self._init_input_handlers(input_handler_chain)
Example #39
0
    def __init__(self, parent, debug=False):
        QObject.__init__(self, parent)
        self.debug = debug

        self.timer = QTimer(self)
        self.timer.timeout.connect(self.check)

        self.threshold = gc.get_threshold()
        gc.disable()
        self.timer.start(self.INTERVAL)
Example #40
0
 def __init__(self, parent, notify=None):
     QObject.__init__(self, parent)
     self.global_undo = GlobalUndoHistory()
     self.container_count = 0
     self.tdir = None
     self.save_manager = SaveManager(parent, notify)
     self.save_manager.report_error.connect(self.report_save_error)
     self.doing_terminal_save = False
     self.ignore_preview_to_editor_sync = False
     setup_cssutils_serialization()
Example #41
0
    def __init__(self, parent, debug=False):
        QObject.__init__(self, parent)
        self.debug = debug

        self.timer = QTimer(self)
        self.timer.timeout.connect(self.check)

        self.threshold = gc.get_threshold()
        gc.disable()
        self.timer.start(self.INTERVAL)
Example #42
0
    def __init__(self, parent=None):
        QObject.__init__(self, parent)
        self.free = [-1, -1, -1]
        self.count = 0
        self.location_actions = QActionGroup(self)
        self.location_actions.setExclusive(True)
        self.current_location = 'library'
        self._mem = []
        self.tooltips = {}

        self.all_actions = []

        def ac(name, text, icon, tooltip):
            icon = QIcon(I(icon))
            ac = self.location_actions.addAction(icon, text)
            setattr(self, 'location_' + name, ac)
            ac.setAutoRepeat(False)
            ac.setCheckable(True)
            receiver = partial(self._location_selected, name)
            ac.triggered.connect(receiver)
            self.tooltips[name] = tooltip

            m = QMenu(parent)
            self._mem.append(m)
            a = m.addAction(icon, tooltip)
            a.triggered.connect(receiver)
            if name != 'library':
                self._mem.append(a)
                a = m.addAction(QIcon(I('eject.png')), _('Eject this device'))
                a.triggered.connect(self._eject_requested)
                self._mem.append(a)
                a = m.addAction(QIcon(I('config.png')),
                                _('Configure this device'))
                a.triggered.connect(self._configure_requested)
                self._mem.append(a)
                a = m.addAction(QIcon(I('sync.png')),
                                _('Update cached metadata on device'))
                a.triggered.connect(
                    lambda x: self.update_device_metadata.emit())
                self._mem.append(a)

            else:
                ac.setToolTip(tooltip)
            ac.setMenu(m)
            ac.calibre_name = name

            self.all_actions.append(ac)
            return ac

        self.library_action = ac('library', _('Library'), 'lt.png',
                                 _('Show books in calibre library'))
        ac('main', _('Device'), 'reader.png',
           _('Show books in the main memory of the device'))
        ac('carda', _('Card A'), 'sd.png', _('Show books in storage card A'))
        ac('cardb', _('Card B'), 'sd.png', _('Show books in storage card B'))
 def __init__ (self,addr,state=0,statestr=''):
   QObject.__init__(self,None);
   self.addr = addr;
   self.state = state;
   self.statestr = statestr;
   self.process_state = None;
   self.host = None;
   self.remote = None;  # or hostname...
   self.session_id = None;
   self.session_name = None;
   self.cwd = None;
Example #44
0
 def __init__(self, opts, args, actions, listener, app, gui_debug=None):
     self.startup_time = time.time()
     self.opts, self.args, self.listener, self.app = opts, args, listener, app
     self.gui_debug = gui_debug
     self.actions = actions
     self.main = None
     QObject.__init__(self)
     self.splash_screen = None
     self.timer = QTimer.singleShot(1, self.initialize)
     if DEBUG:
         prints('Starting up...')
Example #45
0
    def __init__(self, parent=None):
        QObject.__init__(self, parent)
        self.free = [-1, -1, -1]
        self.count = 0
        self.location_actions = QActionGroup(self)
        self.location_actions.setExclusive(True)
        self.current_location = 'library'
        self._mem = []
        self.tooltips = {}

        self.all_actions = []

        def ac(name, text, icon, tooltip):
            icon = QIcon(I(icon))
            ac = self.location_actions.addAction(icon, text)
            setattr(self, 'location_'+name, ac)
            ac.setAutoRepeat(False)
            ac.setCheckable(True)
            receiver = partial(self._location_selected, name)
            ac.triggered.connect(receiver)
            self.tooltips[name] = tooltip

            m = QMenu(parent)
            self._mem.append(m)
            a = m.addAction(icon, tooltip)
            a.triggered.connect(receiver)
            if name != 'library':
                self._mem.append(a)
                a = m.addAction(QIcon(I('eject.png')), _('Eject this device'))
                a.triggered.connect(self._eject_requested)
                self._mem.append(a)
                a = m.addAction(QIcon(I('config.png')), _('Configure this device'))
                a.triggered.connect(self._configure_requested)
                self._mem.append(a)
                a = m.addAction(QIcon(I('sync.png')), _('Update cached metadata on device'))
                a.triggered.connect(lambda x : self.update_device_metadata.emit())
                self._mem.append(a)

            else:
                ac.setToolTip(tooltip)
            ac.setMenu(m)
            ac.calibre_name = name

            self.all_actions.append(ac)
            return ac

        self.library_action = ac('library', _('Library'), 'lt.png',
                _('Show books in calibre library'))
        ac('main', _('Device'), 'reader.png',
                _('Show books in the main memory of the device'))
        ac('carda', _('Card A'), 'sd.png',
                _('Show books in storage card A'))
        ac('cardb', _('Card B'), 'sd.png',
                _('Show books in storage card B'))
Example #46
0
 def __init__(self, parent):
     QObject.__init__(self, parent)
     self.count = 0
     self.last_saved = -1
     self.requests = LifoQueue()
     t = Thread(name='save-thread', target=self.run)
     t.daemon = True
     t.start()
     self.status_widget = w = SaveWidget(parent)
     self.start_save.connect(w.start, type=Qt.QueuedConnection)
     self.save_done.connect(w.stop, type=Qt.QueuedConnection)
Example #47
0
 def __init__(self, path, parent):
     QObject.__init__(self, parent)
     if path and os.path.isdir(path) and os.access(path, os.R_OK | os.W_OK):
         self.watcher = QFileSystemWatcher(self)
         self.worker = Worker(path, self.metadata_read.emit)
         self.watcher.directoryChanged.connect(self.dir_changed, type=Qt.QueuedConnection)
         self.metadata_read.connect(self.add_to_db, type=Qt.QueuedConnection)
         QTimer.singleShot(2000, self.initialize)
         self.auto_convert.connect(self.do_auto_convert, type=Qt.QueuedConnection)
     elif path:
         prints(path, "is not a valid directory to watch for new ebooks, ignoring")
Example #48
0
    def __init__(self, parent, db, ids, nmap):
        QObject.__init__(self, parent)

        self.db, self.ids, self.nmap = db, dict(**ids), dict(**nmap)
        self.critical = {}
        self.number_of_books_added = 0
        self.duplicates = []
        self.names, self.paths, self.infos = [], [], []
        self.input_queue = Queue()
        self.output_queue = Queue()
        self.merged_books = set([])
Example #49
0
    def __init__(self, queue, *args, **kwargs):
        """
        A QObject (to be run in a QThread) which sits waiting for data to come through a Queue.Queue().
        It blocks until data is available, and once it has got something from the queue, it sends
        it to the main GUI thread by emitting the pyqtSignal 'queuePutSignal'

        :type queue: Queue.queue
        """
        QObject.__init__(self, *args, **kwargs)
        self.queue = queue
        self.continueOperation = True
Example #50
0
    def __init__(self, queue, *args, **kwargs):
        """
        A QObject (to be run in a QThread) which sits waiting for data to come through a Queue.Queue().
        It blocks until data is available, and once it has got something from the queue, it sends
        it to the main GUI thread by emitting the pyqtSignal 'queuePutSignal'

        :type queue: Queue.queue
        """
        QObject.__init__(self, *args, **kwargs)
        self.queue = queue
        self.continueOperation = True
Example #51
0
    def __init__(self, parent, db, ids, nmap):
        QObject.__init__(self, parent)

        self.db, self.ids, self.nmap = db, dict(**ids), dict(**nmap)
        self.critical = {}
        self.number_of_books_added = 0
        self.duplicates = []
        self.names, self.paths, self.infos = [], [], []
        self.input_queue = Queue()
        self.output_queue = Queue()
        self.merged_books = set([])
Example #52
0
 def __init__(self, opts, args, actions, listener, app, gui_debug=None):
     self.startup_time = time.time()
     self.opts, self.args, self.listener, self.app = opts, args, listener, app
     self.gui_debug = gui_debug
     self.actions = actions
     self.main = None
     QObject.__init__(self)
     self.splash_screen = None
     self.timer = QTimer.singleShot(1, self.initialize)
     if DEBUG:
         prints('Starting up...')
Example #53
0
 def __init__(self, iterator, parent):
     QObject.__init__(self, parent)
     self.current_index = 0
     self.iterator = iterator
     self.view = QWebView(self.parent())
     self.mf = mf = self.view.page().mainFrame()
     for x in (Qt.Horizontal, Qt.Vertical):
         mf.setScrollBarPolicy(x, Qt.ScrollBarAlwaysOff)
     self.view.loadFinished.connect(self.load_finished)
     self.paged_js = compiled_coffeescript('ebooks.oeb.display.utils')
     self.paged_js += compiled_coffeescript('ebooks.oeb.display.paged')
Example #54
0
 def __init__(self, iterator, parent):
     QObject.__init__(self, parent)
     self.current_index = 0
     self.iterator = iterator
     self.view = QWebView(self.parent())
     self.mf = mf = self.view.page().mainFrame()
     for x in (Qt.Horizontal, Qt.Vertical):
         mf.setScrollBarPolicy(x, Qt.ScrollBarAlwaysOff)
     self.view.loadFinished.connect(self.load_finished)
     self.paged_js = compiled_coffeescript('ebooks.oeb.display.utils')
     self.paged_js += compiled_coffeescript('ebooks.oeb.display.paged')
Example #55
0
    def __init__(self, coords, fps=1):
        QObject.__init__(self)
        self.fps = fps
        self.coords = coords

        self.captureClock = QTimer()
        self.captureClock.timeout.connect(self.captureScreen)
        self.captureClock.start(1000 / self.fps)

        self.screenBuffer = Queue.deque(maxlen=self.fps * 2)
        self.transformedScreenBuffer = Queue.deque(maxlen=self.fps * 2)
Example #56
0
    def __init__(self, donate_button, location_manager, parent):
        QObject.__init__(self, parent)
        self.donate_button, self.location_manager = (donate_button, location_manager)

        bars = [ToolBar(donate_button, location_manager, parent) for i in range(3)]
        self.main_bars = tuple(bars[:2])
        self.child_bars = tuple(bars[2:])

        self.menu_bar = MenuBar(self.location_manager, self.parent())
        self.parent().setMenuBar(self.menu_bar)

        self.apply_settings()
        self.init_bars()
Example #57
0
 def __init__(self, parent, db, callback, spare_server=None):
     QObject.__init__(self, parent)
     self.pd = ProgressDialog(_("Adding..."), parent=parent)
     self.pd.setMaximumWidth(min(600, int(available_width() * 0.75)))
     self.spare_server = spare_server
     self.db = db
     self.pd.setModal(True)
     self.pd.show()
     self._parent = parent
     self.rfind = self.worker = None
     self.callback = callback
     self.callback_called = False
     self.pd.canceled_signal.connect(self.canceled)
Example #58
0
 def __init__ (self,ni,parent=None):
   QObject.__init__(self,parent);
   self.nodeindex = ni;
   self.name = None;
   self.classname = None;
   self.proc = 0;
   self.children = [];
   self.step_children = [];
   self.parents  = [];
   self.request_id = None;
   self.breakpoint = 0;
   self.control_status = 0;
   self.control_status_string = '';
   self.profiling_stats = self.cache_stats = 0;
Example #59
0
 def __init__(self):
     QObject.__init__(self)
     self.connect(
         self,
         SIGNAL("edispatch(PyQt_PyObject, PyQt_PyObject, PyQt_PyObject)"),
         self._get_metadata,
         Qt.QueuedConnection,
     )
     self.connect(
         self,
         SIGNAL("idispatch(PyQt_PyObject, PyQt_PyObject, PyQt_PyObject)"),
         self._from_formats,
         Qt.QueuedConnection,
     )