def test():
    from qt import QWidget
    class W(QWidget):
        def __init__(self):

            QWidget.__init__(self)
    
    def create():
        global _list
        s = SampleControl()
        s.load('/home/ajole/wav/trance.wav')
        s.slotStart()
        s.slotSetZone(0, True)
        _list.append(s)
    
    import pkaudio
    from qt import QApplication, QPushButton, QObject, SIGNAL
    pkaudio.connect_to_host(startserver=0)
    a = QApplication([])

    w1 = SampleControl()
    w1.load('/home/ajole/wav/track.wav')
    w1.slotStart()
    w1.slotSetZone(0, True)

    b = QPushButton('create', None)
    QObject.connect(b,
                    SIGNAL('clicked()'),
                    create)
    b.show()
    a.setMainWidget(b)
    a.exec_loop()
Beispiel #2
0
 def __init__(self, *args):
     self.super = super(self.__class__, self)
     self.super.__init__(*args)
     self.emitter = QObject()
     self.selection = None
     self.undoStack = UndoStack()
     self.undoStackReadOnly = False
Beispiel #3
0
 def __init__(self, *args):
     QVBox.__init__(self, *args)
     self.slider = QSlider(QSlider.Horizontal, self, "slider")
     self.slider.setRange(0, 999)
     self.slider.setValue(0)
     QObject.connect(self.slider, SIGNAL("valueChanged(int)"), self.valueChanged)
     self.setFocusProxy(self.slider)
Beispiel #4
0
	def _initWidgets(self):
		"""Initialises all of the main widgets in the window."""
		global appRoot
		
		appIconPath = os.path.join(appRoot, "images/miniicon.png")
		self.setIcon(QPixmap(appIconPath))
		
		self.mainBox = QHBox(self)
		self.mainSplitter = QSplitter(self.mainBox)
		
		self.bmarksListBox = QVBox(self.mainSplitter)
		self.bmarksListBox.setMaximumWidth(250)
		
		self.bmarksList = KTVBookmarksListView.KTVBookmarksListView(self.bmarksListBox, self)
		QObject.connect(self.bmarksList, SIGNAL(str(u'doubleClicked(QListViewItem *)')), self._bookmarkChosen)
		
		self.browserBox = QVBox(self.mainSplitter)
		self.browser = KTVHTMLPart.KTVHTMLPart(self.browserBox, self)
		
		self.setCentralWidget(self.mainBox)
		
		self._buttonBox = QHBox(self.bmarksListBox)
		self._addButton = QPushButton(u"&Add", self._buttonBox, str(u""))
		QObject.connect(self._addButton, SIGNAL(str(u'clicked()')), self._addItem)
		
		self._deleteButton = QPushButton(u"&Delete", self._buttonBox, str(u""))
		QObject.connect(self._deleteButton, SIGNAL(str(u'clicked()')), self._deleteItem)
		
		self._backButton = QPushButton(u"&Back", self.bmarksListBox, str(u""))
		QObject.connect(self._backButton, SIGNAL(str(u'clicked()')), self._back)
		
		self._helpButton = QPushButton(u"&Help", self.bmarksListBox, str(u""))
		QObject.connect(self._helpButton, SIGNAL(str(u'clicked()')), self._help)
		
		self.statusBar().message(u"KatchTV is now ready for use.")
Beispiel #5
0
    def __init__(self, _model, parent):
        """
        Connect to all of the models signals, Whenever anything happens recheck everything.
        """
        QObject.__init__(self, parent)
        self._model = _model
        self.model = sip.cast(_model, QAbstractItemModel)
        self.insert = []
        self.remove = []
        self.changing = []
        self.fetchingMore = False
        assert(self.model)

        self.model.columnsAboutToBeInserted.connect(self.runAllTests)
        self.model.columnsAboutToBeRemoved.connect(self.runAllTests)
        self.model.columnsInserted.connect(self.runAllTests)
        self.model.columnsRemoved.connect(self.runAllTests)
        self.model.dataChanged.connect(self.runAllTests)
        self.model.headerDataChanged.connect(self.runAllTests)
        self.model.layoutAboutToBeChanged.connect(self.runAllTests)
        self.model.layoutChanged.connect(self.runAllTests)
        self.model.modelReset.connect(self.runAllTests)
        self.model.rowsAboutToBeInserted.connect(self.runAllTests)
        self.model.rowsAboutToBeRemoved.connect(self.runAllTests)
        self.model.rowsInserted.connect(self.runAllTests)
        self.model.rowsRemoved.connect(self.runAllTests)

        # Special checks for inserting/removing
        self.model.layoutAboutToBeChanged.connect(self.layoutAboutToBeChanged)
        self.model.layoutChanged.connect(self.layoutChanged)
        self.model.rowsAboutToBeInserted.connect(self.rowsAboutToBeInserted)
        self.model.rowsAboutToBeRemoved.connect(self.rowsAboutToBeRemoved)
        self.model.rowsInserted.connect(self.rowsInserted)
        self.model.rowsRemoved.connect(self.rowsRemoved)
        self.runAllTests()
Beispiel #6
0
 def __init__(self, parent):
     QObject.__init__(self)
     self.parent = parent
     try:
         self.comar = ComarIface.ComarIface(self.handler, self.errHandler)
     except:
         self.parent.showErrorMessage(i18n("Cannot connect to Comar daemon"))
         self.parent.updateGui()
Beispiel #7
0
 def plot2d(self):
     self.box = QHBox()
     toolbar = QVBox(self.box)
     self.plot2d = Plot2D(self.box, self.plotdata)
     self.slider = QSlider(QSlider.Vertical, toolbar, "slider")
     self.slider.setRange(0, self.plotdata.xmax - 1)
     self.slider.setValue(0)
     QObject.connect(self.slider, SIGNAL("valueChanged(int)"), self.plot2d.slice)
     self.plot2d.slice(0)
     self.box.show()
Beispiel #8
0
 def __init__(self, reactor, watcher, type):
     QSocketNotifier.__init__(self, watcher.fileno(), type)
     self.reactor = reactor
     self.watcher = watcher
     self.fn = None
     if type == QSocketNotifier.Read:
         self.fn = self.read
     elif type == QSocketNotifier.Write:
         self.fn = self.write
     QObject.connect(self, SIGNAL("activated(int)"), self.fn)
Beispiel #9
0
 def __init__(self, reactor, watcher, type):
     QSocketNotifier.__init__(self, watcher.fileno(), type)
     self.reactor = reactor
     self.watcher = watcher
     self.fn = None
     if type == QSocketNotifier.Read:
         self.fn = self.read
     elif type == QSocketNotifier.Write:
         self.fn = self.write
     QObject.connect(self, SIGNAL("activated(int)"), self.fn)
Beispiel #10
0
 def __init__(self, parent):
     QObject.__init__(self)
     self.parent = parent
     # Modal dialogs freezes pm in dbus signal path
     self.delayTimer = QTimer(self)
     self.lastError = None
     ##
     self.connect(self.delayTimer, SIGNAL("timeout()"), self.exceptionHandler)
     self.iface = PisiIface.Iface()
     self.iface.setHandler(self.handler)
     self.iface.setExceptionHandler(self.exceptionHandler)
Beispiel #11
0
    def __init__(self, f, log):
        super(LyJob, self).__init__()
        self.f = f
        self.setExecutable(config("commands").get("lilypond", "lilypond"))
        self.setWorkingDirectory(f.directory)
        self.log = log
        self.stdout = Outputter(log, f)
        self.stderr = Outputter(log, f)

        QObject.connect(self, SIGNAL("receivedStdout(KProcess*, char*, int)"), self.stdout.receive)
        QObject.connect(self, SIGNAL("receivedStderr(KProcess*, char*, int)"), self.stderr.receive)
def main():
    app =  KdeQt.KQApplication(sys.argv, None)
    stat = KdeQt.prepareCommandLine()    
    QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
    wnd = MainForm_Impl.MainForm_Impl(statusbar=stat)
    if wnd.init():
        app.setMainWidget(wnd)
        KdeQt.setupKDE(app, wnd)
        wnd.show()
        res = app.exec_loop()
        sys.exit(res)
Beispiel #13
0
def main():
    app = KdeQt.KQApplication(sys.argv, None)
    stat = KdeQt.prepareCommandLine()
    QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
    wnd = MainForm_Impl.MainForm_Impl(statusbar=stat)
    if wnd.init():
        app.setMainWidget(wnd)
        KdeQt.setupKDE(app, wnd)
        wnd.show()
        res = app.exec_loop()
        sys.exit(res)
Beispiel #14
0
	def __init__(self, parentWidget, window):
		"""Initialises a new KTVHTMLPart object.  Requires the same
		arguments as KHTMLPart, plus the parent window it will attach to."""
		KHTMLPart.__init__(self, parentWidget)
		self._window = window
		
		QObject.connect(self.browserExtension(), SIGNAL('openURLRequestDelayed(const KURL&, const KParts::URLArgs&)'), self._openURLRequest)
		
		self.__lastURL = None
		self.__currentURL = None
		self.setFormNotification(self.NoNotification)
Beispiel #15
0
    def __init__(self):
        QObject.__init__(self)
        bus = dbus.SessionBus()
        self.notifyid = 0
        try:
            object  = bus.get_object("org.freedesktop.Notifications", "/org/freedesktop/Notifications")
            self.iface = dbus.Interface(object, dbus_interface='org.freedesktop.Notifications')
            object.connect_to_signal("ActionInvoked", self.click_handler, dbus_interface="org.freedesktop.Notifications")

        except dbus.DBusException:
            traceback.print_exc()
Beispiel #16
0
 def __init__(self, parent, reactor, watcher, socketType):
     QObject.__init__(self, parent)
     self.reactor = reactor
     self.watcher = watcher
     fd = watcher.fileno()
     self.notifier = QSocketNotifier(fd, socketType, parent)
     self.notifier.setEnabled(True)
     if socketType == QSocketNotifier.Read:
         self.fn = self.read
     else:
         self.fn = self.write
     self.notifier.activated.connect(self.fn)
Beispiel #17
0
    def __init__(self, parent):
        QObject.__init__(self)

        try:
            self.comar = ComarIface.ComarIface(self)
        except:
            parent.showErrorMessage("Cannot connect to Comar daemon")

        self.parent = parent

        # Init the database
        pisi.api.init(database=True, write=False)
Beispiel #18
0
 def __init__(self, parent, reactor, watcher, socketType):
     QObject.__init__(self, parent)
     self.reactor = reactor
     self.watcher = watcher
     fd = watcher.fileno()
     self.notifier = QSocketNotifier(fd, socketType, parent)
     self.notifier.setEnabled(True)
     if socketType == QSocketNotifier.Read:
         self.fn = self.read
     else:
         self.fn = self.write
     self.notifier.activated.connect(self.fn)
    def __init__(self):
        """ sample -> splitter |-> volume -> pan -> muter -> mixers[0]
                               |-> volume -> pan -> muter -> mixers[1]
                               |                   ...
                               |-> volume -> pan -> mute from globals import *
        """
        QObject.__init__(self)
        
        self.sample = None
        self.currentCue = 0
        self.cues = []
        self.groupingEnabled = 0
        self.beatSynced = 0
        self.pitchRange = PITCH_RANGE
        self.savedPitchRange = 0
        
        self.driver = pkaudio.Driver()
        # Pitch : when real/temp pitch match, pitch is not bent
        self.pitchTimer = QTimer(self)
        QObject.connect(self.pitchTimer, SIGNAL("timeout()"),
                        self.slotDoPitchBend)
        self.pitchTemp = 0.0 # the bent pitch
        self.realPitch = 0.0 # the original pitch
        self.pitchDirection = "back"
        self.path = None
        
        self.splitter = pkaudio.Splitter()
        
        # Effect chains
        effectChain0 = {}
        effectChain1 = {}
        self.effectChains = [effectChain0, effectChain1]

        # connect eveything up
        for i, chain in enumerate(self.effectChains):

            chain['volume'] = pkaudio.Volume()
            chain['pan'] = pkaudio.Pan()
            chain['peak'] = pkaudio.PeakModule()
            chain['muter'] = pkaudio.Muter()
            chain['muter'].setOn(0)
            
            chain['volume'].outputPort().connect(chain['pan'].inputPort())
            chain['pan'].outputPort().connect(chain['peak'].inputPort())
            chain['peak'].outputPort().connect(chain['muter'].inputPort())
            if i != 1:
                self.splitter.outputPort(i).connect(chain['volume'].inputPort())
            else:
                self.splitter.outputPort(i).connect(chain['pan'].inputPort())
        
        self.effectChains[0]['volume'].setProperty('volume', 75)
        self.slotConnectMixers()
Beispiel #20
0
 def __init__(self, iter):
     QObject.__init__(self)
     limits = []
     d = _all(_ithird_column(_isave_limits(_isplit(_inon_empty_lines(iter)), limits)))
     droot = int(sqrt(len(d)))
     if len(d) != droot * droot:
         raise AttributeError("data must be square")
     self.xmin, self.xmax = 0, droot
     self.ymin, self.ymax = 0, droot
     self.zmin, self.zmax = limits[2].min, limits[2].max
     self.data = reshape(array(d), (droot, droot))
     self.x = 0
     self.y = 0
     self.s = 30
     self.r = 1
Beispiel #21
0
 def __init__(self, *args):
     self.super = super(self.__class__,self)
     self.super.__init__(*args)
     self.emitter = QObject()
     self.selection = None
     self.undoStack = UndoStack()
     self.undoStackReadOnly = False
Beispiel #22
0
 def __init__(self, *what):
     QObject.__init__(self)
     pref = Internal.Preferences
     if what[0] not in StateSaver.savers:
         StateSaver.savers[what[0]] = self
         what[0].installEventFilter(self)
     self.widgets = []
     for widget in what:
         name = self.__generateName(widget)
         self.widgets.append((name, widget))
         pref.addString('States', name + 'State')
         pref.addString('States', name + 'Geometry')
     for name, widget in self.widgets:
         stateFound = self.__restore(widget, name + 'State')
         geometryFound = self.__restore(widget, name + 'Geometry')
         if not stateFound and not geometryFound:
             pref.addString('States', name)
             self.__restore(widget, name)
Beispiel #23
0
    def simulate(self):
        global _timer
        if _timer: _timer.stop()
        if not self.running:
            self.running = 1
            self.qApp.exit_loop()
            return
        self.runUntilCurrent()

        # gah
        timeout = self.timeout()
        if timeout is None: timeout = 1.0
        timeout = min(timeout, 0.1) * 1010

        if not _timer:
            _timer = QTimer()
            QObject.connect( _timer, SIGNAL("timeout()"), self.simulate )
        _timer.start(timeout, 1)
Beispiel #24
0
 def __init__(self, *what):
     QObject.__init__(self)
     pref = Internal.Preferences
     if what[0] not in StateSaver.savers:
         StateSaver.savers[what[0]] = self
         what[0].installEventFilter(self)
     self.widgets = []
     for widget in what:
         name = self.__generateName(widget)
         self.widgets.append((name, widget))
         pref.addString('States', name + 'State')
         pref.addString('States', name + 'Geometry')
     for name, widget in self.widgets:
         stateFound = self.__restore(widget, name + 'State')
         geometryFound = self.__restore(widget, name + 'Geometry')
         if not stateFound and not geometryFound:
             pref.addString('States', name)
             self.__restore(widget, name)
    def __init__(self, title, dataModelHandler, iconHandler):
        """
        Constructor.
        @param title: Name of edited relation type if existing, "New_RelationType" otherwise (at the same time a title from this dialog).
        @type title: C{unicode}
        """

        QObject.__init__(self)
        self._dataModelHandler = dataModelHandler
        self._iconHandler = iconHandler

        self.__relationType = self._dataModelHandler.createRelation(title)
        self.__title = title
        self.__referenceTitle = title
        self.__iconName = None
        self.__parentDataTypeList = None
        self.__childDataTypeList = None
        self.__availableDataTypeList = self._dataModelHandler.datatypes
Beispiel #26
0
    def __init__(self, title, dataModelHandler, propertyDefinitionFactory, iconHandler):
        """
        Constructor.

        @param title: Name of edited data type if existing, "New_DataType" otherwise (at the same time a title from this dialog).
        @type title: C{unicode}
        """

        QObject.__init__(self)
        self._dataModelHandler = dataModelHandler
        self._propertyDefinitionFactory = propertyDefinitionFactory
        self._iconHandler = iconHandler
        
        self.__dataType = self._dataModelHandler.createDataType(title)
        self.__title = title
        self.__referenceTitle = title
        self.__iconName = None
        self.__propertyList = None
    def __init__(self, title, dataModelHandler, propertyDefinitionFactory,
                 iconHandler):
        """
        Constructor.

        @param title: Name of edited data type if existing, "New_DataType" otherwise (at the same time a title from this dialog).
        @type title: C{unicode}
        """

        QObject.__init__(self)
        self._dataModelHandler = dataModelHandler
        self._propertyDefinitionFactory = propertyDefinitionFactory
        self._iconHandler = iconHandler

        self.__dataType = self._dataModelHandler.createDataType(title)
        self.__title = title
        self.__referenceTitle = title
        self.__iconName = None
        self.__propertyList = None
Beispiel #28
0
 def simulate(self):
     if self._timer is not None:
         self._timer.stop()
         self._timer = None
     if not self.running:
         self.running = 1
         self.qApp.exit_loop()
         return
     self.runUntilCurrent()
     if self._crashCall is not None:
         self._crashCall.reset(0)
     timeout = self.timeout()
     if timeout is None:
         timeout = 1.0
     timeout = min(timeout, 0.1) * 1010
     if self._timer is None:
         self._timer = QTimer()
         QObject.connect(self._timer, SIGNAL("timeout()"), self.simulate)
     self._timer.start(timeout, 1)
Beispiel #29
0
    def __init__(self, comboBox, table, currentKey=None, nullAllowed=False):
        QObject.__init__(self)
        self.comboBox=comboBox
        
        self.key_to_index={}
        self.index_to_key={}
    
        if nullAllowed:
            self.comboBox.insertItem("<None>")
            self.key_to_index[None]=self.comboBox.count()-1
            self.index_to_key[self.comboBox.count()-1]=None

        for row in table:
            self.comboBox.insertItem(row.getDescription())
            primaryKey = row.getPrimaryKey()
            self.key_to_index[primaryKey] = self.comboBox.count()-1
            self.index_to_key[self.comboBox.count()-1] = primaryKey
         
        if currentKey!=None:
            self.setCurrentItem(currentKey)

        self.connect(self.comboBox, SIGNAL("activated (int)"),
                     self.slotItemSelected)
        self.comboBox.setAutoCompletion(True)
Beispiel #30
0
    def simulate(self):
        if self._timer is not None:
            self._timer.stop()
            self._timer = None

        if not self.running:
            self.running = 1
            self.qApp.exit_loop()
            return
        self.runUntilCurrent()

        if self._crashCall is not None:
            self._crashCall.reset(0)

        # gah
        timeout = self.timeout()
        if timeout is None:
            timeout = 1.0
        timeout = min(timeout, 0.1) * 1010

        if self._timer is None:
            self._timer = QTimer()
            QObject.connect(self._timer, SIGNAL("timeout()"), self.simulate)
        self._timer.start(timeout, 1)
Beispiel #31
0
 def __init__(self, filename, *args):
     QHBox.__init__(self, *args)
     t = QVBox(self)
     self.plotdata = PlotData(file(filename))
     self.plot = Plot3D(self, self.plotdata)
     self.xmax = self.plotdata.xmax
     self.ymax = self.plotdata.ymax
     self.size = LCDRange(t, "size")
     self.size.setRange(30, 125)
     self.size.setValue(125)
     self.xpos = LCDRange(t, "xpos")
     self.xpos.setValue(725)
     self.ypos = LCDRange(t, "ypos")
     self.ypos.setValue(400)
     self.plot2d()
     QObject.connect(self.size, PYSIGNAL("valueChanged(int)"), self.plotdata.size)
     QObject.connect(self.xpos, PYSIGNAL("valueChanged(int)"), self.plotdata.xpos)
     QObject.connect(self.ypos, PYSIGNAL("valueChanged(int)"), self.plotdata.ypos)
     QObject.connect(self.plotdata, PYSIGNAL("sizeChanged()"), self.sizeChanged)
     self.sizeChanged()
Beispiel #32
0
 def shutdown(self):
     QObject.disconnect(self, SIGNAL("activated(int)"), self.fn)
     self.setEnabled(0)
     self.fn = self.watcher = None
Beispiel #33
0
 def __init__(self):
     PureTree.__init__(self)
     QObject.__init__(self)
Beispiel #34
0
class _TableModelProxy(object):
    def __init__(self, *args):
        self.super = super(self.__class__, self)
        self.super.__init__(*args)
        self.emitter = QObject()
        self.selection = None
        self.undoStack = UndoStack()
        self.undoStackReadOnly = False

    def setHeader(self, col, header):
        self.super.setHeader(col, header)
        self.emitter.emit(PYSIGNAL("setHeader"), (col, header))

    def insertRow(self, i=None, row=None):
        if i is None: i = len(self.table)
        if self.super.insertRow(i, row):
            for k in range(i, len(self.table)):
                self.table[k].num = k
            self.emitter.emit(PYSIGNAL("insertRow"), (i, self.table[i]))
            if not self.undoStackReadOnly:
                self.undoStack.push("insertRow", i, row)
            return True
        else:
            return False

    def insertColumn(self, i=None, col=None):
        if self.super.insertColumn(i, col):
            self.emitter.emit(PYSIGNAL("insertColumn"), (i, col))
            if type(i) == int and i <= self.selection:
                self.selection += 1
            return True
        else:
            return False

    def takeRow(self, i):
        r = self.super.takeRow(i)
        for k in range(i, len(self.table)):
            self.table[k].num = k
        if i == self.selection:
            self.selection = None
        self.emitter.emit(PYSIGNAL("takeRow"), (i, r))
        if not self.undoStackReadOnly:
            self.undoStack.push("takeRow", i, r)
        return r

    def takeColumn(self, i):
        c = self.super.takeColumn(i)
        self.emitter.emit(PYSIGNAL("takeColumn"), (i, ))
        if i == self.selection:
            self.selection = None
        elif i < self.selection:
            self.selection -= 1
        return c

    def sort(self, *args):
        self.super.sort(*args)
        for i, row in enumerate(self.table):
            row.num = i
        self.emitter.emit(PYSIGNAL("sort"), ())

    def select(self, sel):
        self.selection = sel
        self.emitter.emit(PYSIGNAL("select"), (sel, ))

    def getSelection(self):
        return self.selection

    def resetUndoStack(self):
        self.undoStack.reset()

    def undo(self, n=1):
        for m in range(n):
            try:
                op, arg1, arg2 = self.undoStack.prev()
                #print "undo", op, arg1, arg2
                #print len(self.undoStack._stack)
            except TypeError:
                break
            self.undoStackReadOnly = True
            if op == 'insertRow':
                self.takeRow(arg1)
            elif op == 'takeRow':
                self.insertRow(arg1, arg2)
            elif op == 'cellChanged':
                i, j = arg1
                v, w = arg2
                self[i][j] = w
            self.undoStackReadOnly = False

    def redo(self, n=1):
        for m in range(n):
            try:
                op, arg1, arg2 = self.undoStack.next()
                #print "redo", op, arg1, arg2
                #print len(self.undoStack._stack)
            except TypeError:
                break
            self.undoStackReadOnly = True
            if op == 'insertRow':
                self.insertRow(arg1, arg2)
            elif op == 'takeRow':
                self.takeRow(arg1)
            elif op == 'cellChanged':
                i, j = arg1
                v, w = arg2
                self[i][j] = v
            self.undoStackReadOnly = False

    def undoStackStatus(self):
        return self.undoStack.status()
Beispiel #35
0
    def __init__(self):
        QObject.__init__(self)
        self.sysTray = KMySystemTray()
        self.sysTray.setPixmap(self.sysTray.loadIcon("ksmarttray"))
        self.sysTray.show()

        self.process = KProcIO()

        self.state = KSmartTray.State.Waiting
        self.lastKnownStatus = ""

        self.blinkFlag = False
        self.updateFailed = False

        self.checkTimer = QTimer()
        self.blinkTimer = QTimer()

        QObject.connect(self.checkTimer, SIGNAL("timeout()"),
                        self.checkUpgrades)
        QObject.connect(self.process, SIGNAL("processExited(KProcess *)"),
                        self.processDone)

        QObject.connect(self, PYSIGNAL("foundNewUpgrades()"),
                        self.startBlinking)
        QObject.connect(self, PYSIGNAL("foundNoUpgrades()"), self.stopBlinking)
        QObject.connect(self.sysTray, PYSIGNAL("mouseEntered()"),
                        self.stopBlinking)
        QObject.connect(self.blinkTimer, SIGNAL("timeout()"), self.toggleBlink)

        QObject.connect(self.sysTray.checkAction, SIGNAL("activated()"),
                        self.manualCheckUpgrades)
        QObject.connect(self.sysTray.startSmartAction, SIGNAL("activated()"),
                        self.startSmart)
        QObject.connect(self.sysTray.stopAction, SIGNAL("activated()"),
                        self.stopChecking)
        QObject.connect(self.sysTray, SIGNAL("quitSelected()"),
                        KApplication.kApplication(), SLOT("quit()"))

        QObject.connect(self.sysTray, PYSIGNAL("activated()"),
                        self.runUpgrades)

        self.checkTimer.start(5 * 60 * 1000)

        self.checkUpgrades()
Beispiel #36
0
 def eventFilter(self, receiver, event):
     """will be called for all events"""
     from log import EventData
     EventData(receiver, event)
     return QObject.eventFilter(self, receiver, event)
Beispiel #37
0
 def __init__(self):
     PureTree.__init__(self)
     QObject.__init__(self)
Beispiel #38
0
class _TableModelProxy(object):
    def __init__(self, *args):
        self.super = super(self.__class__,self)
        self.super.__init__(*args)
        self.emitter = QObject()
        self.selection = None
        self.undoStack = UndoStack()
        self.undoStackReadOnly = False
        
    def setHeader(self, col, header):
        self.super.setHeader(col, header)
        self.emitter.emit(PYSIGNAL("setHeader"),(col,header))
        
    def insertRow(self,i=None,row=None):
        if i is None: i=len(self.table)
        if self.super.insertRow(i,row):
            for k in range(i,len(self.table)):
                self.table[k].num = k
            self.emitter.emit(PYSIGNAL("insertRow"),(i,self.table[i]))
            if not self.undoStackReadOnly:
                self.undoStack.push("insertRow",i,row)
            return True
        else:
            return False
        
    def insertColumn(self,i=None,col=None):
        if self.super.insertColumn(i,col):
            self.emitter.emit(PYSIGNAL("insertColumn"),(i,col))
            if type(i)==int and i <= self.selection:
                self.selection += 1
            return True
        else:
            return False
    
    def takeRow(self,i):
        r = self.super.takeRow(i)
        for k in range(i,len(self.table)):
            self.table[k].num = k
        if i == self.selection:
            self.selection = None
        self.emitter.emit(PYSIGNAL("takeRow"),(i,r))
        if not self.undoStackReadOnly:
            self.undoStack.push("takeRow",i,r)
        return r
    
    def takeColumn(self,i):
        c = self.super.takeColumn(i)
        self.emitter.emit(PYSIGNAL("takeColumn"),(i,))
        if i == self.selection:
            self.selection = None
        elif i < self.selection:
            self.selection -= 1
        return c
    
    def sort(self, *args):
        self.super.sort(*args)
        for i,row in enumerate(self.table):
            row.num = i
        self.emitter.emit(PYSIGNAL("sort"),())

    def select(self, sel):
        self.selection = sel
        self.emitter.emit(PYSIGNAL("select"),(sel,))

    def getSelection(self):
        return self.selection

    def resetUndoStack(self):
        self.undoStack.reset()
        
    def undo(self, n=1):
        for m in range(n):
            try:
                op, arg1, arg2 = self.undoStack.prev()
                #print "undo", op, arg1, arg2
                #print len(self.undoStack._stack)
            except TypeError:
                break
            self.undoStackReadOnly = True
            if op == 'insertRow':
                self.takeRow(arg1)
            elif op == 'takeRow':
                self.insertRow(arg1,arg2)
            elif op == 'cellChanged':
                i, j = arg1
                v, w = arg2
                self[i][j] = w
            self.undoStackReadOnly = False
    
    def redo(self, n=1):
        for m in range(n):
            try:
                op, arg1, arg2 = self.undoStack.next()
                #print "redo", op, arg1, arg2
                #print len(self.undoStack._stack)
            except TypeError:
                break
            self.undoStackReadOnly = True
            if op == 'insertRow':
                self.insertRow(arg1,arg2)
            elif op == 'takeRow':
                self.takeRow(arg1)
            elif op == 'cellChanged':
                i, j = arg1
                v, w = arg2
                self[i][j] = v
            self.undoStackReadOnly = False

    def undoStackStatus(self):
        return self.undoStack.status()
Beispiel #39
0
 def shutdown(self):
     QObject.disconnect(self, SIGNAL("activated(int)"), self.fn)
     self.setEnabled(0)
     self.fn = self.watcher = None
Beispiel #40
0
 def __init__(self, url):
     KRun.__init__(self, KURL(url))
     self.setAutoDelete(False)
     krun.__savedInstances.append(self)
     QObject.connect(self, SIGNAL("finished()"), self._slotExit)
Beispiel #41
0
 def __init__(self):
     KProcess.__init__(self)
     QObject.connect(self,
         SIGNAL("processExited(KProcess*)"), self._slotExit)
Beispiel #42
0
 def sig(func):
     QObject.connect(sender, SIGNAL(signal), func)
     return func
Beispiel #43
0
    def __init__(self):
        """ Constructor. """

        QObject.__init__(self)
        self.__mainThreadIdentifier = get_ident()
Beispiel #44
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

from kdecore import KApplication, KAboutData, KCmdLineArgs, KGlobal, KIcon
from qt import QObject, SIGNAL, SLOT

from pakito.gui.mainwindow import MainWindow

def I18N_NOOP(x):
    return x

name = "Pakito"
version = "0.3"
mail = "*****@*****.**"
description = I18N_NOOP("A tool for accelerating package making process")

if __name__ == "__main__":    
    about = KAboutData(name.lower(), name, version, description, KAboutData.License_GPL_V2, "(C) Gökçen Eraslan 2007", None, None, mail)
    about.addAuthor("Gökçen Eraslan", None, mail)
    KCmdLineArgs.init(sys.argv, about)
    app = KApplication()
    programLogo = KGlobal.iconLoader().loadIcon("pisikga", KIcon.Desktop)
    about.setProgramLogo(programLogo.convertToImage())
    QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
    pac = MainWindow(None, name)
    app.setMainWidget(pac)
    pac.show()
    app.exec_loop()
Beispiel #45
0
    def __init__(self):
        """ Constructor. """

        QObject.__init__(self)
        self.__mainThreadIdentifier = get_ident()