Example #1
0
 def __init__(self):
     QObject.__init__(self)
     self._database = None
     self._layerSet = None
     self._currentLayer = None
     self._currentLayerColor = None
     self._mapCanvas = None
    def __init__(self, parent=None):
        super(DiagnosticExplain, self).__init__(parent)
        self.setupUi(self)

        QObject.connect(self.dont_show_again_chk_box,  SIGNAL("stateChanged(int)"),
                        lambda: self.parent().parent().update_user_prefs("explain_diag", \
                                    not self.dont_show_again_chk_box.isChecked()))
Example #3
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 #4
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 #5
0
 def __init__(self,
              parent,
              label,
              filename=None,
              dialog_label=None,
              file_types=None,
              default_suffix=None,
              file_mode=QFileDialog.AnyFile):
     QWidget.__init__(self, parent)
     lo = QHBoxLayout(self)
     lo.setContentsMargins(0, 0, 0, 0)
     lo.setSpacing(5)
     # label
     lab = QLabel(label, self)
     lo.addWidget(lab, 0)
     # text field
     self.wfname = QLineEdit(self)
     self.wfname.setReadOnly(True)
     self.setFilename(filename)
     lo.addWidget(self.wfname, 1)
     # selector
     wsel = QToolButton(self)
     wsel.setText("Choose...")
     QObject.connect(wsel, SIGNAL("clicked()"), self._chooseFile)
     lo.addWidget(wsel, 0)
     # other init
     self._file_dialog = None
     self._dialog_label = dialog_label or label
     self._file_types = file_types or "All files (*)"
     self._file_mode = file_mode
     self._default_suffix = default_suffix
     self._dir = None
Example #6
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 #7
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 #8
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 #9
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 #10
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 #11
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
	def init(self):
		self.layout = QHBoxLayout()

		self.serversList = KListWidget(self.parent)
		QObject.connect(self.serversList, SIGNAL("itemSelectionChanged()"), self.serverSelected)
		QObject.connect(self.serversList, SIGNAL("doubleClicked(QListWidgetItem*, const QPoint&)"), self.showEditDialog)
		
		self.refreshServersList()
		self.buttonsLayout = QVBoxLayout()
		self.buttonsLayout.setAlignment(Qt.AlignTop)

		self.addButton = KPushButton("Add")
		QObject.connect(self.addButton, SIGNAL("clicked()"), self.showAddDialog)

		self.editButton = KPushButton("Edit")
		self.editButton.setEnabled (False)
		QObject.connect(self.editButton, SIGNAL("clicked()"), self.showEditDialog)

		self.removeButton = KPushButton("Remove")
		self.removeButton.setEnabled (False)
		QObject.connect(self.removeButton, SIGNAL("clicked()"), self.removeServer)

		self.buttonsLayout.addWidget(self.addButton)
		self.buttonsLayout.addWidget(self.editButton)
		self.buttonsLayout.addWidget(self.removeButton)

		self.layout.addWidget(self.serversList)
		self.layout.addLayout(self.buttonsLayout)

		self.setLayout(self.layout)
Example #13
0
 def __init__(self, parent, config_name=None, buttons=[], *args):
     """Creates dialog.
     'config_name' is used to get/set default window size from Config object
     'buttons' can be a list of names or (QPixmapWrapper,name[,tooltip]) tuples to provide
     custom buttons at the bottom of the dialog. When a button is clicked, the dialog
     emits SIGNAL("name").
     A "Close" button is always provided, this simply hides the dialog.
     """
     QDialog.__init__(self, parent, *args)
     self.setModal(False)
     lo = QVBoxLayout(self)
     # create viewer
     self.label = QLabel(self)
     self.label.setMargin(5)
     self.label.setWordWrap(True)
     lo.addWidget(self.label)
     self.label.hide()
     self.viewer = QTextBrowser(self)
     lo.addWidget(self.viewer)
     # self.viewer.setReadOnly(True)
     self.viewer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
     QObject.connect(self.viewer, SIGNAL("anchorClicked(const QUrl &)"), self._urlClicked)
     self._source = None
     lo.addSpacing(5)
     # create button bar
     btnfr = QFrame(self)
     btnfr.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
     # btnfr.setMargin(5)
     lo.addWidget(btnfr)
     lo.addSpacing(5)
     btnfr_lo = QHBoxLayout(btnfr)
     btnfr_lo.setMargin(5)
     # add user buttons
     self._user_buttons = {}
     for name in buttons:
         if isinstance(name, str):
             btn = QPushButton(name, btnfr)
         elif isinstance(name, (list, tuple)):
             if len(name) < 3:
                 pixmap, name = name
                 tip = None
             else:
                 pixmap, name, tip = name
             btn = QPushButton(pixmap.icon(), name, btnfr)
             if tip:
                 btn.setToolTip(tip)
         self._user_buttons[name] = btn
         btn._clicked = Kittens.utils.curry(self.emit, SIGNAL(name))
         self.connect(btn, SIGNAL("clicked()"), btn._clicked)
         btnfr_lo.addWidget(btn, 1)
     # add a Close button
     btnfr_lo.addStretch(100)
     closebtn = QPushButton(pixmaps.grey_round_cross.icon(), "Close", btnfr)
     self.connect(closebtn, SIGNAL("clicked()"), self.hide)
     btnfr_lo.addWidget(closebtn, 1)
     # resize selves
     self.config_name = config_name or "html-viewer"
     width = Config.getint('%s-width' % self.config_name, 512)
     height = Config.getint('%s-height' % self.config_name, 512)
     self.resize(QSize(width, height))
Example #14
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 #15
0
    def __init__(self, parent_gb, object_name, rules, eligible_custom_fields, db):
        self.rules = rules
        self.eligible_custom_fields = eligible_custom_fields
        self.db = db
        QTableWidget.__init__(self)
        self.setObjectName(object_name)
        self.layout = parent_gb.layout()

        # Add ourselves to the layout
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        #sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
        self.setSizePolicy(sizePolicy)
        self.setMaximumSize(QSize(16777215, self.MAXIMUM_TABLE_HEIGHT))

        self.setColumnCount(0)
        self.setRowCount(0)
        self.layout.addWidget(self)

        self.last_row_selected = self.currentRow()
        self.last_rows_selected = self.selectionModel().selectedRows()

        self._init_controls()

        # Hook check_box changes
        QObject.connect(self, SIGNAL('cellChanged(int,int)'), self.enabled_state_changed)
Example #16
0
 def __init__(self, parent, label, filename=None, dialog_label=None, file_types=None, default_suffix=None,
              file_mode=QFileDialog.AnyFile):
     QWidget.__init__(self, parent)
     lo = QHBoxLayout(self)
     lo.setContentsMargins(0, 0, 0, 0)
     lo.setSpacing(5)
     # label
     lab = QLabel(label, self)
     lo.addWidget(lab, 0)
     # text field
     self.wfname = QLineEdit(self)
     self.wfname.setReadOnly(True)
     self.setFilename(filename)
     lo.addWidget(self.wfname, 1)
     # selector
     wsel = QToolButton(self)
     wsel.setText("Choose...")
     QObject.connect(wsel, SIGNAL("clicked()"), self._chooseFile)
     lo.addWidget(wsel, 0)
     # other init
     self._file_dialog = None
     self._dialog_label = dialog_label or label
     self._file_types = file_types or "All files (*)"
     self._file_mode = file_mode
     self._default_suffix = default_suffix
     self._dir = None
Example #17
0
 def __init__(self, *args):
     QWidget.__init__(self, *args)
     lo = QHBoxLayout(self)
     lo.setContentsMargins(0, 0, 0, 0)
     lo.setSpacing(5)
     # type selector
     self.wtypesel = QComboBox(self)
     for i, tp in enumerate(self.ValueTypes):
         self.wtypesel.addItem(tp.__name__)
     QObject.connect(self.wtypesel, SIGNAL("activated(int)"), self._selectTypeNum)
     typesel_lab = QLabel("&Type:", self)
     typesel_lab.setBuddy(self.wtypesel)
     lo.addWidget(typesel_lab, 0)
     lo.addWidget(self.wtypesel, 0)
     self.wvalue = QLineEdit(self)
     self.wvalue_lab = QLabel("&Value:", self)
     self.wvalue_lab.setBuddy(self.wvalue)
     self.wbool = QComboBox(self)
     self.wbool.addItems(["false", "true"])
     self.wbool.setCurrentIndex(1)
     lo.addWidget(self.wvalue_lab, 0)
     lo.addWidget(self.wvalue, 1)
     lo.addWidget(self.wbool, 1)
     self.wvalue.hide()
     # make input validators
     self._validators = {int: QIntValidator(self), float: QDoubleValidator(self)}
     # select bool type initially
     self._selectTypeNum(0)
Example #18
0
 def __init__(self, parent=None):
     QGLViewer.__init__(self, parent)
     self.bottomwidget = parent.bottomwidget
     self.__views = []
     self.__currentview = None
     self.__initialview = None
     self.__aboutview = None
     self.setMouseTracking(True)
     self.backButton = GLButton(self,
                                20,
                                20,
                                48,
                                48,
                                img=get_shared_image('previous.png'),
                                action=self.setCurrentViewId,
                                togglable=False,
                                params=[self.__initialview])
     self.activeWidgets = [self.backButton]
     self.focusWidget = None
     self.selectedWidget = None
     self.__initiated__ = False
     self.mouseinteraction = True
     self.viewInterpolator = KeyFrameInterpolator()
     self.viewInterpolator.setFrame(self.camera().frame())
     QObject.connect(self.viewInterpolator, SIGNAL('interpolated()'),
                     self.updateGL)
     QObject.connect(self.viewInterpolator, SIGNAL('endReached()'),
                     self.endInterpolateView)
     self.__viewIter__ = iter(self.__views)
     self.__valueViewIter__ = None
     self.__first_initialization__ = True
Example #19
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 #20
0
 def _exportImageToPNG(self, filename=None):
     if not filename:
         if not self._export_png_dialog:
             dialog = self._export_png_dialog = QFileDialog(self, "Export image to PNG", ".", "*.png")
             dialog.setDefaultSuffix("png")
             dialog.setFileMode(QFileDialog.AnyFile)
             dialog.setAcceptMode(QFileDialog.AcceptSave)
             dialog.setModal(True)
             QObject.connect(dialog, SIGNAL("filesSelected(const QStringList &)"), self._exportImageToPNG)
         return self._export_png_dialog.exec_() == QDialog.Accepted
     busy = BusyIndicator()
     if isinstance(filename, QStringList):
         filename = filename[0]
     filename = str(filename)
     # make QPixmap
     nx, ny = self.image.imageDims()
     (l0, l1), (m0, m1) = self.image.getExtents()
     pixmap = QPixmap(nx, ny)
     painter = QPainter(pixmap)
     # use QwtPlot implementation of draw canvas, since we want to avoid caching
     xmap = QwtScaleMap()
     xmap.setPaintInterval(0, nx)
     xmap.setScaleInterval(l1, l0)
     ymap = QwtScaleMap()
     ymap.setPaintInterval(ny, 0)
     ymap.setScaleInterval(m0, m1)
     self.image.draw(painter, xmap, ymap, pixmap.rect())
     painter.end()
     # save to file
     try:
         pixmap.save(filename, "PNG")
     except Exception as exc:
         self.emit(SIGNAL("showErrorMessage"), "Error writing %s: %s" % (filename, str(exc)))
         return
     self.emit(SIGNAL("showMessage"), "Exported image to file %s" % filename)
Example #21
0
 def __init__(self, *args):
     QWidget.__init__(self, *args)
     lo = QHBoxLayout(self)
     lo.setContentsMargins(0, 0, 0, 0)
     lo.setSpacing(5)
     # type selector
     self.wtypesel = QComboBox(self)
     for i, tp in enumerate(self.ValueTypes):
         self.wtypesel.addItem(tp.__name__)
     QObject.connect(self.wtypesel, SIGNAL("activated(int)"),
                     self._selectTypeNum)
     typesel_lab = QLabel("&Type:", self)
     typesel_lab.setBuddy(self.wtypesel)
     lo.addWidget(typesel_lab, 0)
     lo.addWidget(self.wtypesel, 0)
     self.wvalue = QLineEdit(self)
     self.wvalue_lab = QLabel("&Value:", self)
     self.wvalue_lab.setBuddy(self.wvalue)
     self.wbool = QComboBox(self)
     self.wbool.addItems(["false", "true"])
     self.wbool.setCurrentIndex(1)
     lo.addWidget(self.wvalue_lab, 0)
     lo.addWidget(self.wvalue, 1)
     lo.addWidget(self.wbool, 1)
     self.wvalue.hide()
     # make input validators
     self._validators = {
         int: QIntValidator(self),
         float: QDoubleValidator(self)
     }
     # select bool type initially
     self._selectTypeNum(0)
Example #22
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 #23
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 #24
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 #25
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 #26
0
    def __init__(self):
        QWidget.__init__(self)
        self.ui = Ui_InstallWidget()
        self.ui.setupUi(self)

        self.installProgress = InstallProgressWidget(self)

        self.timer = QTimer(self)
        QObject.connect(self.timer, SIGNAL("timeout()"), self.changeSlideshows)

        self.poll_timer = QTimer(self)
        QObject.connect(self.poll_timer, SIGNAL("timeout()"),
                        self.checkQueueEvent)

        if ctx.consts.lang == "tr":
            self.installProgress.ui.progress.setFormat("%%p")

        self.iter_slideshows = iter_slideshows()

        # show first pic
        self.changeSlideshows()

        self.total = 0
        self.cur = 0
        self.has_errors = False

        # mutual exclusion
        self.mutex = None
        self.wait_condition = None
        self.queue = None

        self.retry_answer = False
        self.sys_copier = None
Example #27
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 #28
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 #29
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 #30
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 #31
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)
	def __init__(self, parent, isEdit):
		KDialog.__init__(self, parent)
		self.parent = parent
		self.isEdit = isEdit
		
		layout = QVBoxLayout(self.mainWidget())
		
		informationBox = KButtonGroup(self)
		informationBox.setTitle("Server information")
		if self.isEdit:
			self.oldName = ""
		self.name = KLineEdit()
		QObject.connect(self.name, SIGNAL("editingFinished()"), self.nameFinished)
		self.hostIP = KLineEdit()
		self.port = KIntNumInput(22)
		self.login = KLineEdit()
		self.switches = KLineEdit()
		self.passCheckbox = QCheckBox("Password")
		QObject.connect(self.passCheckbox, SIGNAL("stateChanged(int)"), self.passwordChecked)
		self.keyCheckbox = QCheckBox("Private Key")
		QObject.connect(self.keyCheckbox, SIGNAL("stateChanged(int)"), self.keyChecked)
		self.password = KLineEdit()
		self.password.setPasswordMode(True)
		self.password.setEnabled(False)
		self.keyFilePath = KLineEdit()
		self.keyFilePath.setEnabled(False)
		self.browseButton = KPushButton("Browse")
		self.browseButton.setEnabled(False)
		QObject.connect(self.browseButton, SIGNAL("clicked()"), self.openFileDialog)
		
		informationBoxLayout = QGridLayout(informationBox)
		informationBoxLayout.addWidget(QLabel("Name:"), 0, 0)
		informationBoxLayout.addWidget(self.name, 0, 1)
		
		informationBoxLayout.addWidget(QLabel("Host/IP:"), 1, 0)
		informationBoxLayout.addWidget(self.hostIP, 1, 1)
		
		informationBoxLayout.addWidget(QLabel("Port:"), 2, 0)
		informationBoxLayout.addWidget(self.port, 2, 1)
		
		informationBoxLayout.addWidget(QLabel("Login:"******"SSH command line:"), 4, 0)
		informationBoxLayout.addWidget(self.switches, 4, 1)
		
		authenticationBox = KButtonGroup(self)
		authenticationBox.setTitle("Authentication")
		authenticationBoxLayout = QGridLayout(authenticationBox)
		authenticationBoxLayout.addWidget(self.passCheckbox, 0, 0)
		authenticationBoxLayout.addWidget(self.password, 0, 1)
		authenticationBoxLayout.addWidget(self.keyCheckbox, 1, 0)
		authenticationBoxLayout.addWidget(self.keyFilePath, 1, 1)
		authenticationBoxLayout.addWidget(self.browseButton, 1, 2)
		
		layout.addWidget(informationBox)
		layout.addWidget(authenticationBox)
		
		self.enableButtonOk(False)
		QObject.connect(self, SIGNAL("okClicked()"), self.saveSettings)
Example #33
0
 def _createImageController(self, image, name, basename, model=False, save=False):
     dprint(2, "creating ImageController for", name)
     ic = ImageController(image, self, self, name, save=save)
     ic.setNumber(len(self._imagecons))
     self._imagecons.insert(0, ic)
     self._imagecon_loadorder.append(ic)
     if model:
         self._model_imagecons.add(id(ic))
     self._lo.addWidget(ic)
     if self._border_pen:
         ic.addPlotBorder(self._border_pen, basename, self._label_color, self._label_bg_brush)
     # attach appropriate signals
     image.connect(SIGNAL("slice"), self.fastReplot)
     image.connect(SIGNAL("repaint"), self.replot)
     image.connect(SIGNAL("raise"), self._currier.curry(self.raiseImage, ic))
     image.connect(SIGNAL("unload"), self._currier.curry(self.unloadImage, ic))
     image.connect(SIGNAL("center"), self._currier.curry(self.centerImage, ic))
     QObject.connect(ic.renderControl(), SIGNAL("displayRangeChanged"),
                     self._currier.curry(self._updateDisplayRange, ic.renderControl()))
     QObject.connect(ic.renderControl(), SIGNAL("displayRangeLocked"),
                     self._currier.curry(self._lockDisplayRange, ic.renderControl()))
     self._plot = None
     # add to menus
     dprint(2, "repopulating menus")
     self._repopulateMenu()
     # center and raise to top of stack
     self.raiseImage(ic)
     if not self._center_image:
         self.centerImage(ic, emit=False)
     else:
         ic.setPlotProjection(self._center_image.projection)
     # signal
     self.emit(SIGNAL("imagesChanged"))
     return ic
Example #34
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 #35
0
    def __init__(self):
        QWidget.__init__(self)
        self.ui = Ui_InstallWidget()
        self.ui.setupUi(self)

        self.installProgress = InstallProgressWidget(self)

        self.timer = QTimer(self)
        QObject.connect(self.timer, SIGNAL("timeout()"), self.changeSlideshows)

        self.poll_timer = QTimer(self)
        QObject.connect(self.poll_timer, SIGNAL("timeout()"), self.checkQueueEvent)

        if ctx.consts.lang == "tr":
            self.installProgress.ui.progress.setFormat("%%p")

        self.iter_slideshows = iter_slideshows()

        # show first pic
        self.changeSlideshows()

        self.total = 0
        self.cur = 0
        self.has_errors = False

        # mutual exclusion
        self.mutex = None
        self.wait_condition = None
        self.queue = None

        self.retry_answer = False
        self.sys_copier = None
Example #36
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 #37
0
File: kai.py Project: matiasb/kai
    def initialize(self):
        """Ninja-ide plugin initializer."""
        self.editor_s = self.locator.get_service('editor')
        tab_manager = self.editor_s._main.actualTab

        self.completer = DocumentCompleter()
        # to-do: make these configurable settings
        self.completer.setCompletionMode(QtGui.QCompleter.PopupCompletion)
        self.completer.setCaseSensitivity(QtCore.Qt.CaseSensitive)

        # init current tabs, if any
        for i in xrange(tab_manager.count()):
            editor = tab_manager.widget(i)
            self._add_completer(editor)

        # set completer for current tab
        editor = self.editor_s.get_editor()
        if editor is not None:
            self.completer.setWidget(editor)

        # on file open, init completer
        self.editor_s.fileOpened.connect(self._set_completer_on_open)

        # on key press, check to show completer
        self.editor_s.editorKeyPressEvent.connect(self.key_press)

        # on tab change, update completer
        self.editor_s.currentTabChanged.connect(self._set_completer)

        QObject.connect(self.completer,
            QtCore.SIGNAL("activated(const QString&)"), self.insert_completion)
Example #38
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 #39
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 #40
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 #41
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 #42
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 #43
0
 def addColumnCategory(self, name, columns, visible=True):
     qa = QAction(name, self)
     qa.setCheckable(True)
     qa.setChecked(visible)
     if not visible:
         self._showColumnCategory(columns, False)
     QObject.connect(qa, SIGNAL("toggled(bool)"), self._currier.curry(self._showColumnCategory, columns))
     self._column_views.append((name, qa, columns))
Example #44
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 #45
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 #46
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 #47
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 #48
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 #49
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 #50
0
 def addColumnCategory(self, name, columns, visible=True):
     qa = QAction(name, self)
     qa.setCheckable(True)
     qa.setChecked(visible)
     if not visible:
         self._showColumnCategory(columns, False)
     QObject.connect(qa, SIGNAL("toggled(bool)"),
                     self._currier.curry(self._showColumnCategory, columns))
     self._column_views.append((name, qa, columns))
Example #51
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 #52
0
 def __init__(self, parent, flags=Qt.WindowFlags()):
     QDialog.__init__(self, parent, flags)
     self.setModal(False)
     self.setWindowTitle("Select sources by...")
     lo = QVBoxLayout(self)
     lo.setMargin(10)
     lo.setSpacing(5)
     # select by
     lo1 = QHBoxLayout()
     lo.addLayout(lo1)
     lo1.setContentsMargins(0, 0, 0, 0)
     #    lab = QLabel("Select:")
     #   lo1.addWidget(lab)
     self.wselby = QComboBox(self)
     lo1.addWidget(self.wselby, 0)
     QObject.connect(self.wselby, SIGNAL("activated(const QString &)"), self._setup_selection_by)
     # under/over
     self.wgele = QComboBox(self)
     lo1.addWidget(self.wgele, 0)
     self.wgele.addItems([">", ">=", "<=", "<", "sum<=", "sum>"])
     QObject.connect(self.wgele, SIGNAL("activated(const QString &)"), self._select_threshold)
     # threshold value
     self.wthreshold = QLineEdit(self)
     QObject.connect(self.wthreshold, SIGNAL("editingFinished()"), self._select_threshold)
     lo1.addWidget(self.wthreshold, 1)
     # min and max label
     self.wminmax = QLabel(self)
     lo.addWidget(self.wminmax)
     # selection slider
     lo1 = QHBoxLayout()
     lo.addLayout(lo1)
     self.wpercent = QSlider(self)
     self.wpercent.setTracking(False)
     QObject.connect(self.wpercent, SIGNAL("valueChanged(int)"), self._select_percentile)
     QObject.connect(self.wpercent, SIGNAL("sliderMoved(int)"), self._select_percentile_threshold)
     self.wpercent.setRange(0, 100)
     self.wpercent.setOrientation(Qt.Horizontal)
     lo1.addWidget(self.wpercent)
     self.wpercent_lbl = QLabel("0%", self)
     self.wpercent_lbl.setMinimumWidth(64)
     lo1.addWidget(self.wpercent_lbl)
     #    # hide button
     #    lo.addSpacing(10)
     #    lo2 = QHBoxLayout()
     #    lo.addLayout(lo2)
     #    lo2.setContentsMargins(0,0,0,0)
     #    hidebtn = QPushButton("Close",self)
     #    hidebtn.setMinimumWidth(128)
     #    QObject.connect(hidebtn,SIGNAL("clicked()"),self.hide)
     #    lo2.addStretch(1)
     #    lo2.addWidget(hidebtn)
     #    lo2.addStretch(1)
     #    self.setMinimumWidth(384)
     self._in_select_threshold = False
     self._sort_index = None
     self.qerrmsg = QErrorMessage(self)
Example #53
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 #54
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 #55
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 #56
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 #57
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)