Python PyQt4.QtCore 模块,QObject() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用PyQt4.QtCore.QObject()

项目:quartz-browser    作者:ksharindam    | 项目源码 | 文件源码
def setupUi(self, Dialog, mymodel):
        Dialog.setObjectName(_fromUtf8("Downloads_Dialog"))
        Dialog.resize(740, 440)
        self.verticalLayout = QtGui.QVBoxLayout(Dialog)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.tableView = DownloadsTable(mymodel)
        self.tableView.setObjectName(_fromUtf8("tableView"))
        self.verticalLayout.addWidget(self.tableView)
        self.buttonBox = QtGui.QDialogButtonBox(Dialog)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Close)
        self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
        self.verticalLayout.addWidget(self.buttonBox)

        self.retranslateUi(Dialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
项目:pyshell    作者:oglops    | 项目源码 | 文件源码
def closeEvent(self, event):

        print 'ui closed'
        # restore stdout
        sys.stdout = self.textEdit.stdout_bak
        sys.stderr = self.textEdit.stderr_bak

        # ptr = apiUI.MQtUtil.mainWindow()
        # mwin=sip.wrapinstance(long(ptr), QtGui.QObject)
        # cmdReporters = cmds.lsUI(type='cmdScrollFieldReporter')
        # cmdReporter = mwin.findChild(QtGui.QTextEdit, cmdReporters[0])

        # sys.stdout=cmdReporter
        # sys.stderr =cmdReporter

        event.accept()
        # event.ignore()
项目:pyshell    作者:oglops    | 项目源码 | 文件源码
def fix_channelbox_font():
    from PyQt4 import QtCore, QtGui

    import maya.cmds as cmds
    import maya.OpenMayaUI as mui

    import sip

    ptr = mui.MQtUtil.findControl('mainChannelBox')
    channelBox = sip.wrapinstance(long(ptr), QtCore.QObject)

    # styleSheet = '''
    #     QWidget {
    #       /* font-family: "Courier New"; */
    #       font: normal %spx;
    #     }
    #     ''' % '16'
    # channelBox.setStyleSheet(styleSheet)

    channelBox.verticalHeader().setDefaultSectionSize(18)
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, clientname):
        QtCore.QObject.__init__(self)
        self.clientname = clientname
        self.api = rtmidi.get_compiled_api()[0]
        self.listener_in = rtmidi.MidiIn(self.api, clientname)
        self.listener_in.ignore_types(sysex=False)
        self.listener_out = rtmidi.MidiOut(self.api, clientname)
        self.ports = {INPUT: [self.listener_in], OUTPUT: [self.listener_out]}
        self.connections = {self.listener_in: None, self.listener_out: None}
        self.default_in_caps = 66
        self.default_out_caps = 33
        self.default_type = 1048578
        self.alsa_mode = True if 'linux' in sys.platform else False
        self.in_graph_dict = {}
        self.out_graph_dict = {}
        self.client_dict = {}
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, main):
        QtCore.QObject.__init__(self)
        self.main = main
        self.type = RTMIDI
        self.active = False
        self.sysex_buffer = []
        self.seq = RtMidiSequencer(clientname='Bigglesworth')
        self.keep_going = True
        self.graph = self.main.graph = Graph(self.seq)
        self.seq.client_created.connect(self.graph.client_created)
        self.seq.client_destroyed.connect(self.graph.client_destroyed)
        self.seq.port_created.connect(self.graph.port_created)
        self.seq.port_destroyed.connect(self.graph.port_destroyed)
        self.seq.conn_created.connect(self.graph.conn_created)
        self.seq.conn_destroyed.connect(self.graph.conn_destroyed)
        self.seq.midi_event.connect(self.create_midi_event)
#        self.graph.conn_register.connect(self.conn_register)
#        self.id = self.seq.client_id
#        self.input = self.graph.port_id_dict[self.id][input_id]
#        self.output = self.graph.port_id_dict[self.id][output_id]
        self.input = self.graph.port_id_dict[0][0]
        self.output = self.graph.port_id_dict[1][0]
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, data=None, source=SRC_LIBRARY):
        QtCore.QObject.__init__(self)
        if data is not None:
            self._bank = data[0]
            self._prog = data[1]
            self._data = data[2:]
            self._name = ''.join([str(unichr(l)) if l != 127 else u'°' for l in self.data[363:379]])
            cat = self.data[379]
            if cat < len(categories):
                self._cat = cat
            else:
                self._cat = len(categories) - 1
            self.source = source
            self._state = STORED|(source<<1)
        else:
            self._bank = self._prog = 0
            self._data = []
            self._name = 'None'
            self._cat = None
            self.source = SRC_LIBRARY
            self._state = EMPTY

        self._done = True
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def __setattr__(self, attr, value):
        try:
            try:
                self.object_dict[attr].value = value
                if self.notify:
                    self.edited = True
                    self.display.statusParamUpdate(attr, value)
                if self.send:
                    value = self.object_dict[attr].value
                    self.send_value(attr, value)
                if self.save:
                    value = self.object_dict[attr].value
                    setattr(self.sound, attr, value)
            except:
                QtCore.QObject.__setattr__(self, attr, value)
        except Exception as e:
            raise e
#            raise NameError('{} attribute does not exist!'.format(attr))
项目:mol    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, max_size=64, trigger_types=(NOTEON, ), time_threshold=100, ignore_doublenote=False):
        QtCore.QObject.__init__(self)
        self.max_size = max_size
        self.main_data = deque2([], max_size)
        self.note_data = deque2([], max_size)
        self.rev_note_data = deque2([], max_size)
        self.time_data = deque2([], max_size)
        self.rev_time_data = deque2([], max_size)
        self.vel_data = deque2([], max_size)
        self.rev_vel_data = deque2([], max_size)
        self.source_data = []
        self.other_data = []
        self.trigger_types = trigger_types
        self.time_threshold = time_threshold
        self.ignore_doublenote = ignore_doublenote
        self.lock = Lock()
        self.watch_id = None
        self.pattern = []
        self.noteoff = {}
        self.last_note = None
        self.pattern_data = []
        self.pattern_set = False
        self.repeats = 1
        self.max_repeats = 3
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def Establish_Connections(self):
        # loop button and menu action to link to functions
        for ui_name in self.uiList.keys():
            if ui_name.endswith('_btn'):
                QtCore.QObject.connect(self.uiList[ui_name], QtCore.SIGNAL("clicked()"), getattr(self, ui_name[:-4]+"_action", partial(self.default_action,ui_name)))
            elif ui_name.endswith('_atn'):
                QtCore.QObject.connect(self.uiList[ui_name], QtCore.SIGNAL("triggered()"), getattr(self, ui_name[:-4]+"_action", partial(self.default_action,ui_name)))
            elif ui_name.endswith('_btnMsg'):
                QtCore.QObject.connect(self.uiList[ui_name], QtCore.SIGNAL("clicked()"), getattr(self, ui_name[:-7]+"_message", partial(self.default_message,ui_name)))
            elif ui_name.endswith('_atnMsg'):
                QtCore.QObject.connect(self.uiList[ui_name], QtCore.SIGNAL("triggered()"), getattr(self, ui_name[:-7]+"_message", partial(self.default_message,ui_name)))
        # custom connection

    #=======================================
    # UI Response functions (custom + prebuilt functions)
    #=======================================
    #-- ui actions
项目:TMV3    作者:HenricusRex    | 项目源码 | 文件源码
def __init__( self,parent = None ):
        QtCore.QObject.__init__(self)
        self.signals=Signal()
        self.graphName = ''
        self.parent = parent

        snakemq.init_logging()
        logger = logging.getLogger("snakemq")
        logger.setLevel(logging.ERROR)
        self.q = queue.Queue()
        self.qRun = False

        self.link = snakemq.link.Link()
        self.link.add_listener(("",4000))

        _pktr = snakemq.packeter.Packeter(self.link)
        self.messaging = snakemq.messaging.Messaging("Controller", "", _pktr)
#        self.messaging.on_message_recv.add(self.on_recv)
        rh = snakemq.messaging.ReceiveHook(self.messaging)
        srpc = snakemq.rpc.RpcServer(rh)
        srpc.register_object(myClass(),"test")
        self.signalWaitForProcessThumbnail.set()
        t = threading.Thread(name="ClientWorker",target=self.worker)
        t.start()
项目:code    作者:ActiveState    | 项目源码 | 文件源码
def __init__(self, PARENT_WIDGET):
        QtCore.QObject.__init__(self)
        self._PARENT_WIDGET        = PARENT_WIDGET
        self._input_panel_all      = SoftInputWidget(PARENT_WIDGET, 'default')
        self._input_panel_numeric  = SoftInputWidget(PARENT_WIDGET, 'numeric')
项目:BlendTransforms    作者:duncanskertchly    | 项目源码 | 文件源码
def BT_GetMayaWindow():
    ptr = apiUI.MQtUtil.mainWindow()
    if ptr is not None:
        if BT_MayaVersionNumber < 2014:
            return wrapinstance(long(ptr), QtCore.QObject)
        else:
            return wrapInstance(long(ptr), QtGui.QWidget)
项目:BlendTransforms    作者:duncanskertchly    | 项目源码 | 文件源码
def BT_GetMayaWindow():
    ptr = apiUI.MQtUtil.mainWindow()
    if ptr is not None:
        if BT_MayaVersionNumber < 2014:
            return wrapinstance(long(ptr), QtCore.QObject)
        else:
            return wrapInstance(long(ptr), QtGui.QWidget)
项目:BlendTransforms    作者:duncanskertchly    | 项目源码 | 文件源码
def BT_GetMayaWindow():
    ptr = apiUI.MQtUtil.mainWindow()
    if ptr is not None:
        if BT_MayaVersionNumber < 2014:
            return wrapinstance(long(ptr), QtCore.QObject)
        else:
            return wrapInstance(long(ptr), QtGui.QWidget)
项目:BlendTransforms    作者:duncanskertchly    | 项目源码 | 文件源码
def BT_GetMayaWindow():
    ptr = apiUI.MQtUtil.mainWindow()
    if ptr is not None:
        if BT_MayaVersionNumber < 2014:
            return wrapinstance(long(ptr), QtCore.QObject)
        else:
            return wrapInstance(long(ptr), QtGui.QWidget)
项目:pyshell    作者:oglops    | 项目源码 | 文件源码
def getMayaWindow():
    'Get the maya main window as a QMainWindow instance'
    ptr = mui.MQtUtil.mainWindow()
    return sip.wrapinstance(long(ptr), QtCore.QObject)
项目:SOLAMS    作者:aishmittal    | 项目源码 | 文件源码
def setMouseTracking(self, flag):
        def recursive_set(parent):
            for child in parent.findChildren(QtCore.QObject):
                try:
                    child.setMouseTracking(flag)
                except:
                    pass
                recursive_set(child)
        QtGui.QWidget.setMouseTracking(self, flag)
        recursive_set(self)
项目:dxf2gcode    作者:cnc-club    | 项目源码 | 文件源码
def __init__(self, filename=None):
        QtCore.QObject.__init__(self)

        # Setting up logger
        # logger = g.logger.logger

        str_ = self.Read_File(filename)
        g.config.metric = self.Get_Unit(str_)

        self.update_tool_values()

        # Load the contour and store the values in the classes
        self.line_pairs = self.Get_Line_Pairs(str_)

        # Debug Informationen
        # logger.info(("\n\nFile has   %0.0f Lines" % len(str_)), 1)
        # logger.info(("\nFile has   %0.0f Linepairs" % self.line_pairs.nrs), 1)

        logger.info(self.tr("Reading DXF Structure"))
        sections_pos = self.Get_Sections_pos()
        self.layers = self.Read_Layers(sections_pos)

        blocks_pos = self.Get_Blocks_pos(sections_pos)
        self.blocks = self.Read_Blocks(blocks_pos)
        self.entities = self.Read_Entities(sections_pos)

        # Aufruf der Klasse um die Konturen zur suchen
        # Schleife fr die Anzahl der Blcke und den Layern
        # Call the class to define the contours of search
        # Loop for the number of blocks and the layer
        for i in range(len(self.blocks.Entities)):
            # '\n'
            # print self.blocks.Entities[i]
            logger.info(self.tr("Creating Contours of Block Nr: %i") %i)
            self.blocks.Entities[i].cont = self.Get_Contour(self.blocks.Entities[i])

        logger.info(self.tr("Creating Contours of Entities"))
        self.entities.cont = self.Get_Contour(self.entities)
项目:electrum-joinmarket-plugin    作者:AdamISZ    | 项目源码 | 文件源码
def __init__(self, plugin):
        super(JoinmarketTab, self).__init__()
        self.plugin = plugin
        #manual counterparty choice disabled for now, see #7 on github.
        self.c_choosers = {
            "randomly chosen but preferring cheaper offers":
            weighted_order_choose
        }
        #,"choose counterparties manually": weighted_order_choose}
        self.initUI()
        self.taker = None
        self.filter_offers_response = None
        self.taker_info_response = None
        self.clientfactory = None
        #signals from client backend to GUI
        self.jmclient_obj = QObject()
        #This signal/callback requires user acceptance decision.
        self.jmclient_obj.connect(self.jmclient_obj, SIGNAL('JMCLIENT:offers'),
                                                            self.checkOffers)
        #This signal/callback is for information only (including abort/error
        #conditions which require no feedback from user.
        self.jmclient_obj.connect(self.jmclient_obj, SIGNAL('JMCLIENT:info'),
                                  self.takerInfo)
        #Signal indicating Taker has finished its work
        self.jmclient_obj.connect(self.jmclient_obj, SIGNAL('JMCLIENT:finished'),
                                  self.takerFinished)
项目:Modular_Rigging_Thesis    作者:LoganKelly    | 项目源码 | 文件源码
def getMayaWindow():
    """
    Get the main Maya window as a QtGui.QMainWindow instance
    @return: QtGui.QMainWindow instance of the top level Maya windows
    """
    ptr = apiUI.MQtUtil.mainWindow()
    if ptr is not None:
        return sip.wrapinstance(long(ptr), QtCore.QObject)
项目:Modular_Rigging_Thesis    作者:LoganKelly    | 项目源码 | 文件源码
def toQtObject(mayaName):
    """
    Convert a Maya ui path to a Qt object
    @param mayaName: Maya UI Path to convert (Ex: "scriptEditorPanel1Window|TearOffPane|scriptEditorPanel1|testButton" )
    @return: PyQt representation of that object
    """
    ptr = apiUI.MQtUtil.findControl(mayaName)
    if ptr is None:
        ptr = apiUI.MQtUtil.findLayout(mayaName)
    if ptr is None:
        ptr = apiUI.MQtUtil.findMenuItem(mayaName)
    if ptr is not None:
        return sip.wrapinstance(long(ptr), QtCore.QObject)
项目:dfViewer    作者:sterry24    | 项目源码 | 文件源码
def __init__(self, parent=None):
        """Constructs the object with the given parent.

        Args:
            parent (QtCore.QObject, optional): Causes the objected to be owned
                by `parent` instead of Qt. Defaults to `None`.

        """
        super(SupportedDtypesTranslator, self).__init__(parent)

        # we are not supposed to use str objects (str/ dtype('S'))
        self._strs = [(np.dtype(object), self.tr('text'))]

        self._ints = [(np.dtype(np.int8), self.tr('small integer (8 bit)')),
                      (np.dtype(np.int16), self.tr('small integer (16 bit)')),
                      (np.dtype(np.int32), self.tr('integer (32 bit)')),
                      (np.dtype(np.int64), self.tr('integer (64 bit)'))]

        self._uints = [(np.dtype(np.uint8), self.tr('unsigned small integer (8 bit)')),
                       (np.dtype(np.uint16), self.tr('unsigned small integer (16 bit)')),
                       (np.dtype(np.uint32), self.tr('unsigned integer (32 bit)')),
                       (np.dtype(np.uint64), self.tr('unsigned integer (64 bit)'))]

        self._floats = [(np.dtype(np.float16), self.tr('floating point number (16 bit)')),
                      (np.dtype(np.float32), self.tr('floating point number (32 bit)')),
                      (np.dtype(np.float64), self.tr('floating point number (64 bit)'))]

        self._datetime = [(np.dtype('<M8[ns]'), self.tr('date and time'))]

        self._bools = [(np.dtype(bool), self.tr('true/false value'))]

        self._all = self._strs + self._ints + self._uints + self._floats + self._bools + self._datetime
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, main):
        QtCore.QObject.__init__(self)
        self.main = main
        self.silent = True
        self.timer = QtCore.QTimer()
        self.timer.setInterval(30000)
        self.timer.timeout.connect(self.error.emit)
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, data):
        QtCore.QObject.__init__(self)
        self.splitted_values = []
        for w in xrange(64):
            data_iter = iter(data[w * 410 + 8:w * 410 + 392])
            values = []
            for s in xrange(128):
                value = (data_iter.next() << 14) + (data_iter.next() << 7) + data_iter.next()
                if value >= 1048576:
                    value -= 2097152
                values.append(value)
            self.splitted_values.append(values)
        self.slot = data[5]
        self.name = ''.join([str(unichr(l)) if l!=127 else '°' for l in data[392:406]])
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, main):
        QtCore.QObject.__init__(self)
        self.main = main
        self.model = QtGui.QStandardItemModel()
        self.model.setHorizontalHeaderLabels(['Name', 'Slot', 'Last modified'])
        self.wavetable_data = {}
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, model, parent=None, banks=26):
        QtCore.QObject.__init__(self, parent)
#        self.data = [[Sound(b, p) for p in range(128)] for b in range(banks)]
        self.model = model
        self.banks = banks
        self.model.cleared.connect(self.clear)
        self.clear()
        self.sorted = SortedLibrary(self)
        self.menu = None
#        self.create_menu()
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, parent, library, source, wavetable_library, limit=None):
        self.limit = limit
        QtCore.QObject.__init__(self)
        self.library = library
        self.wavetable_library = wavetable_library
        source = str(source)
        if source == 'personal':
            #should do pass
#            self.source = local_path('presets/blofeld_fact_200802.mid')
            self.source = source
        elif source in ['200801', '200802', '201200']:
            self.source = local_path('presets/blofeld_fact_{}.mid'.format(source))
        else:
            self.source = source
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, graph, src, dest, show=True):
        QtCore.QObject.__init__(self)
        self.graph = graph
        self.seq = graph.seq
        self.src = src
        self.dest = dest
        self.hidden = not show
        self.info = self.seq.get_connect_info(src.addr, dest.addr)
        self.exclusive = self.info.get('exclusive', 0)
        self.queue = self.info.get('queue', 0)
        self.time_real = self.info.get('time_real', 0)
        self.time_update = self.info.get('time_update', 0)
        self.active = True
        self.active_lock = Lock()
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, seq):
        QtCore.QObject.__init__(self)
        self.seq = seq
        if seq.__class__.__name__ == 'RtMidiSequencer':
            self.backend = RTMIDI
        else:
            self.backend = ALSA
        self.client_id_dict = {}
        self.port_id_dict = {}
        self.connections = {}
        graph_raw = seq.connection_list()
        conn_raw = []
        for client_name, client_id, ports in graph_raw:
            client = Client(self, client_id)
            self.client_id_dict[client_id] = client
            self.port_id_dict[client_id] = client.port_dict
            for port_name, port_id, (conn_out, conn_in) in ports:
                port = client.add_port(port_id)
                self.connections[port] = port.connections
                for conn in conn_in:
                    conn_tuple = ((conn[0], conn[1]), (client_id, port_id))
                    conn_raw.append(conn_tuple)
                for conn in conn_out:
                    conn_tuple = ((client_id, port_id), (conn[0], conn[1]))
                    conn_raw.append(conn_tuple)
        conn_set = set(conn_raw)
        for conn_src, conn_dest in conn_set:
            src = self.get_port(*conn_src)
            dest = self.get_port(*conn_dest)
            conn = Connection(self, src, dest, False if any([src.hidden, dest.hidden]) else True)
            self.connections[src].append(conn)
            self.connections[dest].append(conn)
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, parent):
        self.main = parent
        self.value = 0
        QtCore.QObject.__init__(self, parent)
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, index, values=None):
        QtCore.QObject.__init__(self)
        self.index = index
        self.values = self.sine_values
        #do we really need to create a self.preview_path?
        self.preview_path = QtGui.QPainterPath(self.sine_preview_wavepath)
        self.preview_path_item = QtGui.QGraphicsPathItem(self.preview_path)
        self.preview_path_item.setFlag(QtGui.QGraphicsPathItem.ItemIsSelectable)
        self.preview_rect = WavePlaceHolderItem(self, index, self.preview_path_item.boundingRect())
        self.path = QtGui.QPainterPath(self.sine_wavepath)
        self.hover.connect(self.preview_highlight)
        self._selected_state = False
        #this is a *BAD* workaround for setting values (vertical alignment problem) fix it!
        if values is not None:
            QtCore.QTimer.singleShot(0, lambda: self.setValues(values))
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, main):
        QtCore.QObject.__init__(self)
        self.main = main
        self.type = ALSA
        self.active = False
        self.sysex_buffer = []
        self.seq = alsaseq.Sequencer(clientname='Bigglesworth')
        self.keep_going = True
        input_id = self.seq.create_simple_port(
            name='input', 
            type=alsaseq.SEQ_PORT_TYPE_MIDI_GENERIC|alsaseq.SEQ_PORT_TYPE_APPLICATION, 
            caps=alsaseq.SEQ_PORT_CAP_WRITE|alsaseq.SEQ_PORT_CAP_SUBS_WRITE|
            alsaseq.SEQ_PORT_CAP_SYNC_WRITE)
        output_id = self.seq.create_simple_port(name='output', 
                                                type=alsaseq.SEQ_PORT_TYPE_MIDI_GENERIC|alsaseq.SEQ_PORT_TYPE_APPLICATION, 
                                                caps=alsaseq.SEQ_PORT_CAP_READ|alsaseq.SEQ_PORT_CAP_SUBS_READ|
                                                alsaseq.SEQ_PORT_CAP_SYNC_READ)

        self.seq.connect_ports((alsaseq.SEQ_CLIENT_SYSTEM, alsaseq.SEQ_PORT_SYSTEM_ANNOUNCE), (self.seq.client_id, input_id))
#        self.seq.connect_ports((16, 0), (self.seq.client_id, input_id))
#        self.seq.connect_ports((self.seq.client_id, output_id), (130, 0))
#        self.seq.connect_ports((self.seq.client_id, output_id), (132, 0))

        self.graph = self.main.graph = Graph(self.seq)
#        self.graph.client_start.connect(self.client_start)
#        self.graph.client_exit.connect(self.client_exit)
#        self.graph.port_start.connect(self.port_start)
#        self.graph.port_exit.connect(self.port_exit)
        self.graph.conn_register.connect(self.conn_register)
        self.id = self.seq.client_id
        self.input = self.graph.port_id_dict[self.id][input_id]
        self.output = self.graph.port_id_dict[self.id][output_id]
项目:QGISSortAndNumber    作者:ArMoraer    | 项目源码 | 文件源码
def tr(self, message):
        """Get the translation for a string using Qt translation API.

        We implement this ourselves since we do not inherit QObject.

        :param message: String for translation.
        :type message: str, QString

        :returns: Translated version of message.
        :rtype: QString
        """
        # noinspection PyTypeChecker,PyArgumentList,PyCallByClass
        return QCoreApplication.translate('SortNumber', message)
项目:mol    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, event, time=0, source=None):
        QtCore.QObject.__init__(self)
        self.event = event
        self.vel = event.data2
        self.time = time
        self.time_ms = time/(10.**6)
        self.source = source
        self.timer = QtCore.QTimer()
        self.timer.setSingleShot(True)
        self.timer.timeout.connect(self.event_play)
项目:mol    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, graph, src, dest, show=True):
        QtCore.QObject.__init__(self)
        self.graph = graph
        self.seq = graph.seq
        self.src = src
        self.dest = dest
        self.hidden = not show
        self.info = self.seq.get_connect_info(src.addr, dest.addr)
        self.exclusive = self.info.get('exclusive', 0)
        self.queue = self.info.get('queue', 0)
        self.time_real = self.info.get('time_real', 0)
        self.time_update = self.info.get('time_update', 0)
        self.active = True
        self.active_lock = Lock()
项目:mol    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, client, port_id):
        QtCore.QObject.__init__(self)
        self.client = client
        self.graph = client.graph
        self.seq = self.client.seq
        self.id = port_id
        self.addr = (self.client.id, self.id)
        self.exp = '{}:{}'.format(*self.addr)
        self.info_dict = self.seq.get_port_info(self.id, self.client.id)
        self.name = self.info_dict['name']
        self.caps = get_port_caps(self.info_dict['capability'])
        self.type = get_port_type(self.info_dict['type'])
        if not len(self.type) or alsaseq.SEQ_PORT_CAP_NO_EXPORT in self.caps:
            self.hidden = True
        else:
            self.hidden = False
        self.is_input = self.is_output = False
        if alsaseq.SEQ_PORT_CAP_DUPLEX in self.caps:
            self.is_input = self.is_output = True
        else:
            #TODO trova un modo più veloce per trovare il tipo di porta, qui generi ogni volta 2 set
            if set([int(t) for t in [alsaseq.SEQ_PORT_CAP_READ, alsaseq.SEQ_PORT_CAP_SYNC_READ, alsaseq.SEQ_PORT_CAP_SUBS_READ]]) & set([int(t) for t in self.caps]):
                self.is_output = True
            if set([int(t) for t in [alsaseq.SEQ_PORT_CAP_WRITE, alsaseq.SEQ_PORT_CAP_SUBS_WRITE, alsaseq.SEQ_PORT_CAP_SUBS_WRITE]]) & set([int(t) for t in self.caps]):
                self.is_input = True
        if self.is_input and self.is_output:
            self.is_duplex = True
        else:
            self.is_duplex = False
        self.connections = ConnList(self)
项目:mol    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, graph, client_id):
        QtCore.QObject.__init__(self)
        self.graph = graph
        self.seq = graph.seq
        self.id = client_id
        self.info_dict = self.seq.get_client_info(client_id)
        for s in ['broadcast_filter', 'error_bounce', 'event_filter', 'event_lost', 'type']:
            setattr(self, s, self.info_dict[s])
        self._name = self.info_dict['name']
        self.port_n = self.info_dict['num_ports']
        self.port_dict = {}
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def mui_to_qt(self, mui_name):
        if hostMode != "maya":
            return
        ptr = mui.MQtUtil.findControl(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findLayout(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findMenuItem(mui_name)
        if ptr is not None:
            if qtMode in (0,2):
                # ==== for pyside ====
                return shiboken.wrapInstance(long(ptr), QtWidgets.QWidget)
            elif qtMode in (1,3):
                # ==== for PyQt====
                return sip.wrapinstance(long(ptr), QtCore.QObject)
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def mui_to_qt(self, mui_name):
        if hostMode != "maya":
            return
        ptr = mui.MQtUtil.findControl(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findLayout(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findMenuItem(mui_name)
        if ptr is not None:
            if qtMode in (0,2):
                # ==== for pyside ====
                return shiboken.wrapInstance(long(ptr), QtWidgets.QWidget)
            elif qtMode in (1,3):
                # ==== for PyQt====
                return sip.wrapinstance(long(ptr), QtCore.QObject)
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def mui_to_qt(self, mui_name):
        if hostMode != "maya":
            return
        ptr = mui.MQtUtil.findControl(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findLayout(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findMenuItem(mui_name)
        if ptr is not None:
            if qtMode in (0,2):
                # ==== for pyside ====
                return shiboken.wrapInstance(long(ptr), QtWidgets.QWidget)
            elif qtMode in (1,3):
                # ==== for PyQt====
                return sip.wrapinstance(long(ptr), QtCore.QObject)
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def mui_to_qt(self, mui_name):
        ptr = mui.MQtUtil.findControl(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findLayout(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findMenuItem(mui_name)
        if ptr is not None:
            if qtMode == 0:
                # ==== for pyside ====
                return shiboken.wrapInstance(long(ptr), QtGui.QWidget)
            elif qtMode == 1:
                # ==== for PyQt====
                return sip.wrapinstance(long(ptr), QtCore.QObject)
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def main(mode=0):
    parentWin = None
    app = None
    if deskMode == 0:
        if qtMode == 0:
            # ==== for pyside ====
            parentWin = shiboken.wrapInstance(long(mui.MQtUtil.mainWindow()), QtGui.QWidget)
        elif qtMode == 1:
            # ==== for PyQt====
            parentWin = sip.wrapinstance(long(mui.MQtUtil.mainWindow()), QtCore.QObject)
    if deskMode == 1:
        app = QtGui.QApplication(sys.argv)

    # single UI window code, so no more duplicate window instance when run this function
    global single_TMP_UniversalToolUI_TND
    if single_TMP_UniversalToolUI_TND is None:
        single_TMP_UniversalToolUI_TND = TMP_UniversalToolUI_TND(parentWin, mode) # extra note: in Maya () for no parent; (parentWin,0) for extra mode input
    single_TMP_UniversalToolUI_TND.show()

    if deskMode == 1:
        sys.exit(app.exec_())

    # example: show ui stored
    # print(single_TMP_UniversalToolUI_TND.uiList.keys())
    return single_TMP_UniversalToolUI_TND

# If you want to be able to load multiple windows of the same ui in Maya, use code below
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def Establish_Connections(self):
        # loop button and menu action to link to functions
        for ui_name in self.uiList.keys():
            if ui_name.endswith('_btn'):
                QtCore.QObject.connect(self.uiList[ui_name], QtCore.SIGNAL("clicked()"), getattr(self, ui_name[:-4]+"_action", partial(self.default_action,ui_name)))
            if ui_name.endswith('_atn'):
                QtCore.QObject.connect(self.uiList[ui_name], QtCore.SIGNAL("triggered()"), getattr(self, ui_name[:-4]+"_action", partial(self.default_action,ui_name)))
            if ui_name.endswith('_atnMsg') or ui_name.endswith('_btnMsg'):
                QtCore.QObject.connect(self.uiList[ui_name], QtCore.SIGNAL("triggered()"), getattr(self, ui_name[:-7]+"_message", partial(self.default_message,ui_name)))
        QtCore.QObject.connect(self.uiList["dict_table"].horizontalHeader(), QtCore.SIGNAL("sectionDoubleClicked(int)"), self.changeTableHeader)

    #############################################
    # UI Response functions
    ##############################################
    #-- ui actions
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def loadLang(self):
        self.quickMenu(['language_menu;&Language'])
        cur_menu = self.uiList['language_menu']
        self.quickMenuAction('langDefault_atnLang', 'Default','','langDefault.png', cur_menu)
        cur_menu.addSeparator()
        QtCore.QObject.connect( self.uiList['langDefault_atnLang'], QtCore.SIGNAL("triggered()"), partial(self.setLang, 'default') )
        # store default language
        self.memoData['lang']={}
        self.memoData['lang']['default']={}
        for ui_name in self.uiList:
            ui_element = self.uiList[ui_name]
            if type(ui_element) in [ QtGui.QLabel, QtGui.QPushButton, QtGui.QAction, QtGui.QCheckBox ]:
                # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
                self.memoData['lang']['default'][ui_name] = str(ui_element.text())
            elif type(ui_element) in [ QtGui.QGroupBox, QtGui.QMenu ]:
                # uiType: QMenu, QGroupBox
                self.memoData['lang']['default'][ui_name] = str(ui_element.title())
            elif type(ui_element) in [ QtGui.QTabWidget]:
                # uiType: QTabWidget
                tabCnt = ui_element.count()
                tabNameList = []
                for i in range(tabCnt):
                    tabNameList.append(str(ui_element.tabText(i)))
                self.memoData['lang']['default'][ui_name]=';'.join(tabNameList)
            elif type(ui_element) == str:
                # uiType: string for msg
                self.memoData['lang']['default'][ui_name] = self.uiList[ui_name]

        # try load other language
        lang_path = os.path.dirname(self.location) # better in packed than(os.path.abspath(__file__))
        baseName = os.path.splitext( os.path.basename(self.location) )[0]
        for fileName in os.listdir(lang_path):
            if fileName.startswith(baseName+"_lang_"):
                langName = fileName.replace(baseName+"_lang_","").split('.')[0].replace(" ","")
                self.memoData['lang'][ langName ] = self.readRawFile( os.path.join(lang_path,fileName) )
                self.quickMenuAction(langName+'_atnLang', langName.upper(),'',langName + '.png', cur_menu)
                QtCore.QObject.connect( self.uiList[langName+'_atnLang'], QtCore.SIGNAL("triggered()"), partial(self.setLang, langName) )
        # if no language file detected, add export default language option
        if len(self.memoData['lang']) == 1:
            self.quickMenuAction('langExport_atnLang', 'Export Default Language','','langExport.png', cur_menu)
            QtCore.QObject.connect( self.uiList['langExport_atnLang'], QtCore.SIGNAL("triggered()"), self.exportLang )
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def main():
    parentWin = None
    app = None
    if deskMode == 0:
        if qtMode == 0:
            # ==== for pyside ====
            parentWin = shiboken.wrapInstance(long(mui.MQtUtil.mainWindow()), QtGui.QWidget)
        elif qtMode == 1:
            # ==== for PyQt====
            parentWin = sip.wrapinstance(long(mui.MQtUtil.mainWindow()), QtCore.QObject)
    if deskMode == 1:
        app = QtGui.QApplication(sys.argv)

    # single UI window code, so no more duplicate window instance when run this function
    global single_UITranslator
    if single_UITranslator is None:
        single_UITranslator = UITranslator(parentWin) # extra note: in Maya () for no parent; (parentWin,0) for extra mode input
    single_UITranslator.show()

    if deskMode == 1:
        sys.exit(app.exec_())

    # example: show ui stored
    print(single_UITranslator.uiList.keys())
    return single_UITranslator

# If you want to be able to load multiple windows of the same ui, use code below
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def mui_to_qt(self, mui_name):
        if hostMode != "maya":
            return
        ptr = mui.MQtUtil.findControl(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findLayout(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findMenuItem(mui_name)
        if ptr is not None:
            if qtMode in (0,2):
                # ==== for pyside ====
                return shiboken.wrapInstance(long(ptr), QtWidgets.QWidget)
            elif qtMode in (1,3):
                # ==== for PyQt====
                return sip.wrapinstance(long(ptr), QtCore.QObject)
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def mui_to_qt(self, mui_name):
        if hostMode != "maya":
            return
        ptr = mui.MQtUtil.findControl(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findLayout(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findMenuItem(mui_name)
        if ptr is not None:
            if qtMode in (0,2):
                # ==== for pyside ====
                return shiboken.wrapInstance(long(ptr), QtWidgets.QWidget)
            elif qtMode in (1,3):
                # ==== for PyQt====
                return sip.wrapinstance(long(ptr), QtCore.QObject)
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def mui_to_qt(self, mui_name):
        if hostMode != "maya":
            return
        ptr = mui.MQtUtil.findControl(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findLayout(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findMenuItem(mui_name)
        if ptr is not None:
            if qtMode in (0,2):
                # ==== for pyside ====
                return shiboken.wrapInstance(long(ptr), QtWidgets.QWidget)
            elif qtMode in (1,3):
                # ==== for PyQt====
                return sip.wrapinstance(long(ptr), QtCore.QObject)
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def mui_to_qt(self, mui_name):
        if hostMode != "maya":
            return
        ptr = mui.MQtUtil.findControl(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findLayout(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findMenuItem(mui_name)
        if ptr is not None:
            if qtMode in (0,2):
                # ==== for pyside ====
                return shiboken.wrapInstance(long(ptr), QtWidgets.QWidget)
            elif qtMode in (1,3):
                # ==== for PyQt====
                return sip.wrapinstance(long(ptr), QtCore.QObject)
项目:dzetsaka    作者:lennepkade    | 项目源码 | 文件源码
def __init__(self,inRaster,outRaster,inFilter,inFilterSize,inFilterIter, parent = None):
        QtCore.QObject.__init__(self, parent)
        self.killed = False
        self.inRaster = inRaster
        self.outRaster = outRaster
        self.inFilter = inFilter
        self.inFilterSize = inFilterSize
        self.inFilterIter = inFilterIter