当前位置: 首页>>代码示例>>Python>>正文


Python QtCore.QCoreApplication类代码示例

本文整理汇总了Python中PySide.QtCore.QCoreApplication的典型用法代码示例。如果您正苦于以下问题:Python QCoreApplication类的具体用法?Python QCoreApplication怎么用?Python QCoreApplication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QCoreApplication类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self, parent = None):
     super(UserList, self).__init__(parent = parent)
     query = grizzle.User.query(keys_only = False)
     query.add_sort("email")
     self.setQueryAndColumns(query, "email", "display_name", "status")
     #self.setMinimumSize(400, 600)
     QCoreApplication.instance().refresh.connect(self.refresh)
开发者ID:JanDeVisser,项目名称:Grumble,代码行数:7,代码来源:usertab.py

示例2: readDatas

 def readDatas(self):
     if self.socket is not None:
         if self.socket.isValid():
             ins = QDataStream(self.socket)
             ins.setVersion(QDataStream.Qt_4_2)
             loop = 0
             while not ins.atEnd():
                 QCoreApplication.processEvents()
                 loop += 1
                 if loop > 1000: break
                 if self.socket is not None:
                     if self.socket.isValid():
                         if self.blockSize == 0:
                             if self.socket.isValid():
                                 if self.socket.bytesAvailable() < 4:
                                     return
                                 self.blockSize = ins.readUInt32()
                             else:
                                 return
                         if self.socket.isValid():
                             if self.socket.bytesAvailable() < self.blockSize:
                                 bytesReceived = str(self.socket.bytesAvailable())
                                 return
                             bytesReceived = str(self.socket.bytesAvailable())
                         else:
                             return
                         action = ins.readQString()
                         self.handleAction(action, ins)
                         self.blockSize = 0
                     else:
                         return
                 else:
                     return
             return
开发者ID:FAForever,项目名称:legacy-updater,代码行数:34,代码来源:updateServerThread.py

示例3: __init__

 def __init__(self):
     super(STMainWindow, self).__init__()
     self.createActions()
     self.createMenus()
     layout = QVBoxLayout()
     self.tabs = QTabWidget()
     self.tabs.setTabPosition(QTabWidget.West)
     self.tabs.currentChanged[int].connect(self.tabChanged)
     self.sessiontab = sweattrails.qt.sessiontab.SessionTab(self)
     self.tabs.addTab(self.sessiontab, "Sessions")
     self.tabs.addTab(sweattrails.qt.fitnesstab.FitnessTab(self),
                      "Fitness")
     self.tabs.addTab(sweattrails.qt.profiletab.ProfileTab(self),
                      "Profile")
     self.usertab = sweattrails.qt.usertab.UserTab(self)
     self.tabs.addTab(self.usertab, "Users")
     self.usertab.hide()
     layout.addWidget(self.tabs)
     w = QWidget(self)
     w.setLayout(layout)
     self.setCentralWidget(w)
     self.statusmessage = QLabel()
     self.statusmessage.setMinimumWidth(200)
     self.statusBar().addPermanentWidget(self.statusmessage)
     self.progressbar = QProgressBar()
     self.progressbar.setMinimumWidth(100)
     self.progressbar.setMinimum(0)
     self.progressbar.setMaximum(100)
     self.statusBar().addPermanentWidget(self.progressbar)
     self.setWindowTitle("SweatTrails")
     self.setWindowIconText("SweatTrails")
     icon = QPixmap("image/sweatdrops.png")
     self.setWindowIcon(QIcon(icon))
     QCoreApplication.instance().refresh.connect(self.userSet)
开发者ID:JanDeVisser,项目名称:Grumble,代码行数:34,代码来源:mainwindow.py

示例4: file_import

 def file_import(self):
     (fileNames, _) = QFileDialog.getOpenFileNames(self,
                            "Open Activity File",
                            "",
                            "Activity Files (*.tcx *.fit *.csv)")
     if fileNames:
         QCoreApplication.instance().import_files(*fileNames)
开发者ID:JanDeVisser,项目名称:Grumble,代码行数:7,代码来源:mainwindow.py

示例5: generate_classifier

def generate_classifier(mpec_data,mainWindow):
	for i in range(0,len(mpec_data)):
		mainWindow.ReadProgressBar.setValue(75+25*i/len(mpec_data))
		tmp_out = open("classifier.csv","w+")
		str_out = ""
		vector = []
		for j in range(1,5):
			key = "w"+str(j)+"mpro"
			str_out += str(mpec_data[i][key])+","
			vector.append(float(mpec_data[i][key]))
		for j in range(1,5):
			key = "w"+str(j)+"sigmpro"
			str_out +=str(mpec_data[i][key])
			if j!=4:
				str_out+=","
			vector.append(float(mpec_data[i][key]))
		mainWindow.NetworkView.getData(vector)
		time.sleep(1)
		mainWindow.NetworkView.update()
		tmp_out.write(str_out)
		tmp_out.close()
		command = "java -jar ../out/artifacts/NASAProject_jar/NASAProject.jar ../Data/Model.NN classifier.csv"
		sub_proc = subprocess.Popen(command,stdout=subprocess.PIPE, stderr=subprocess.PIPE)
		(output, error) = sub_proc.communicate()
		output = output.split()
		mpec_data[i]['class'] = output[-1]
		if mpec_data[i]['class'] =="":
			mpec_data[i]['class'] = "0"
		mpec_tmp = mpec_data
		mainWindow.AsteroidBrowser.setHtml(format_mpec_table(mpec_tmp))
		mainWindow.Map.drawPlot(mpec_data)
		QCoreApplication.processEvents()
	return mpec_data
开发者ID:j3doucet,项目名称:DBNN.NASA,代码行数:33,代码来源:query.py

示例6: resolveDependencies

    def resolveDependencies(self, specs):
        if self.hasError:
            return False
        if self.state is PluginState.Resolved:
            # Go back, so we just re-resolve the dependencies.
            self.state = PluginState.Read
        if self.state is not PluginState.Read:
            self.errorString = QCoreApplication.translate(None, "Resolving dependencies failed because state != Read")
            self.hasError = True
            return False
        resolvedDependencies = []
        for dependency in self.dependencies:
            found = None
            for spec in specs:
                if spec.provides(dependency.name, dependency.version):
                    found = spec
                    spec.private.addProvidesForPlugin(self.pluginSpec)
                    break
            if not found:
                self.hasError = True
                if self.errorString:
                    self.errorString += "\n"
                msg = QCoreApplication.translate(None, "Could not resolve dependency {0}({1})")
                self.errorString += msg.format(dependency.name, dependency.version)
                continue
            resolvedDependencies.append(found)
        if self.hasError:
            return False

        self.dependencySpecs = resolvedDependencies
        self.state = PluginState.Resolved
        return True
开发者ID:nichollyn,项目名称:libspark,代码行数:32,代码来源:pluginspec.py

示例7: main

def main():
    parser = OptionParser(
        description='A chat client/server')
    parser.add_option('-s', '--server', help='Start a server.  If not '
                      'given, a client will be started',
                      action='store_true')
    opts, args = parser.parse_args()
    if opts.server:
        from PySide.QtCore import QCoreApplication
        app = QCoreApplication(sys.argv)
        # spawn a server
        server = ChatServer()
        listening = server.listen(HOST_ADDRESS, PORT)
        if not listening:
            # a server error
            print('Server start failed: {}'.format(server.errorString()),
                  file=sys.stderr)
        server.serverShutdown.connect(app.quit)
        # print everything received by the server to standard output
        server.textReceived.connect(partial(print, '>>'))
    else:
        app = QApplication(sys.argv)
        chat_window = ChatWindow()
        chat_window.show()

    app.exec_()
开发者ID:MiguelCarrilhoGT,项目名称:snippets,代码行数:26,代码来源:tcp_socket.py

示例8: move

 def move(self, i, j):
     tiles = self.tile.map.tiles
     self.tile.removeUnit(self)
     tiles[i][j].addUnit(self)
     self.tile.setChosenByDist(-1)
     self.tile.ensureVisible()
     QCoreApplication.instance().processEvents()
开发者ID:Temppa,项目名称:Vuoropohjainen-peli,代码行数:7,代码来源:Units.py

示例9: ProducerConsumer

class ProducerConsumer(unittest.TestCase):
    '''Basic test case for producer-consumer QThread'''

    def setUp(self):
        #Create fixtures
        self.app = QCoreApplication([])

    def tearDown(self):
        #Destroy fixtures
        del self.app

    def finishCb(self):
        #Quits the application
        self.app.exit(0)

    def testProdCon(self):
        #QThread producer-consumer example
        bucket = Bucket()
        prod = Producer(bucket)
        cons = Consumer(bucket)

        prod.start()
        cons.start()

        QObject.connect(prod, SIGNAL('finished()'), self.finishCb)
        QObject.connect(cons, SIGNAL('finished()'), self.finishCb)

        self.app.exec_()

        prod.wait()
        cons.wait()

        self.assertEqual(prod.production_list, cons.consumption_list)
开发者ID:Hasimir,项目名称:PySide,代码行数:33,代码来源:qthread_prod_cons_test.py

示例10: read

 def read(self, fileName):
     self.state = PluginState.Invalid
     self.hasError = False
     self.dependencies = []
     specFile = QFile(fileName)
     if not specFile.exists():
         msg = QCoreApplication.translate(None, "File does not exist: {name}")
         return self.__reportError(msg.format(name=specFile.fileName()))
     if not specFile.open(QIODevice.ReadOnly):
         msg = QCoreApplication.translate(None, "Could not open file for read: {name}")
         return self.__reportError(msg.format(name=specFile.fileName()))
     fileInfo = QFileInfo(specFile)
     self.location = fileInfo.absolutePath()
     self.filePath = fileInfo.absoluteFilePath()
     reader = QXmlStreamReader(specFile)
     while not reader.atEnd():
         reader.readNext()
         tokenType = reader.tokenType()
         if tokenType is QXmlStreamReader.StartElement:
             self.__readPluginSpec(reader)
         else:
             pass
     if reader.hasError():
         msg = QCoreApplication.translate(None, "Error parsing file {0}: {1}, at line {2}, column {3}")
         return self.__reportError(msg.format(specFile.fileName(), reader.errorString(),
                                              reader.lineNumber(), reader.columnNumber()))
     self.state = PluginState.Read
     return True
开发者ID:nichollyn,项目名称:libspark,代码行数:28,代码来源:pluginspec.py

示例11: setUpClass

    def setUpClass(cls):
        if not QCoreApplication.instance():
            cls.app = QApplication(sys.argv)
        else:
            cls.app = QCoreApplication.instance()

        cls.window = mainwidget.MainWindow()
        cls.form = cls.window.ui
开发者ID:diegoponciano,项目名称:Pomotimer,代码行数:8,代码来源:mainwidget_test.py

示例12: __init__

	def __init__(self,audio=True,vibra=True):
		_d = NotifierDebug();
		self._d = _d.d;

		self.manager = MNotificationManager('wazappnotify','WazappNotify');
		self.vibra = vibra

		self.personalRingtone = WAConstants.DEFAULT_SOUND_NOTIFICATION;
		self.personalVibrate = True;
		self.groupRingtone = WAConstants.DEFAULT_SOUND_NOTIFICATION;
		self.groupVibrate = True;
		
		QCoreApplication.setApplicationName("Wazapp");


		self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, None)
		self.mediaObject = Phonon.MediaObject(None)
		Phonon.createPath(self.mediaObject, self.audioOutput)		

		self.profileChanged(0, 0, self.getCurrentProfile(), 0)
		bus = dbus.SessionBus()
		mybus = bus.get_object('com.nokia.profiled', '/com/nokia/profiled')
		self.nface = dbus.Interface(mybus, 'com.nokia.profiled')
		self.nface.connect_to_signal("profile_changed", self.profileChanged)
		#prof = self.getCurrentProfile()
		#reply = self.nface.get_value(prof,"ringing.alert.volume");
		#self.currentProfile = prof
		#self.currentVolume = "1.0" if reply=="100" else "0." + reply
		#self._d("Checking current profile: " + prof + " - Volume: " + self.currentVolume)
		#self.audioOutput.setVolume(float(self.currentVolume))

		
		#self.newMessageSound = WAConstants.DEFAULT_SOUND_NOTIFICATION #fetch from settings
		self.devInfo = QSystemDeviceInfo();
		
		#self.devInfo.currentProfileChanged.connect(self.profileChanged);
		
		self.audio = True
		'''if audio:
			self.audio = QMediaPlayer(None,QMediaPlayer.LowLatency); 
			self.audio.setVolume(100);
		else:
			self.audio = False'''
			
		self.enabled = True
		self.notifications = {}
		

		# vibration comes too early here, now handled by ui.py when the message is already added in QML
		# well, the truth is that sound comes too late... :D
		#>> Any notification should be handler by the notifier, not UI :P I don't feel it's too early though,
		# but if necessary connect to a signal and vibrate from here.
		if self.vibra:
			self.vibra = QFeedbackHapticsEffect();
			self.vibra.setIntensity(1.0);
			self.vibra.setDuration(200);
开发者ID:AbinashBishoyi,项目名称:wazapp,代码行数:56,代码来源:notifier.py

示例13: __init__

    def __init__(self, interval, parent = None):
        super(IntervalPage, self).__init__(parent,
                                           grumble.qt.bridge.FormButtons.AllButtons
                                               if interval.basekind() == "session"
                                               else grumble.qt.bridge.FormButtons.EditButtons)
        with gripe.db.Tx.begin():
            interval = interval()
            self.interval = interval
            if isinstance(interval, sweattrails.session.Session):
                self.addProperty(sweattrails.session.Session, "sessiontype", 0, 0,
                                 readonly = True, has_label = False, rowspan = 3,
                                 bridge = grumble.qt.bridge.Image, height = 64,
                                 displayconverter = sweattrails.qt.view.SessionTypeIcon())
                self.addProperty(sweattrails.session.Session, "start_time", 0, 1, readonly = True)
                self.addProperty(sweattrails.session.Session, "description", 1, 1, colspan = 3)
                col = 1
                row = 2
            else:
                self.addProperty(sweattrails.session.Interval, "timestamp", 0, 0, colspan = 3,
                                 readonly = True)
                col = 0
                row = 1
            self.addProperty(sweattrails.session.Interval, "elapsed_time", row, col,
                             readonly = True)
            self.addProperty(sweattrails.session.Interval, "duration", row, col + 2,
                             readonly = True)
            row += 1
            self.addProperty(sweattrails.session.Interval, "distance", row, col,
                             readonly = True, displayconverter = sweattrails.qt.view.Distance())
            row += 1
            self.addProperty(sweattrails.session.Interval, "average_speed", row, col,
                             readonly = True, displayconverter = sweattrails.qt.view.PaceSpeed("Average"))
            self.addProperty(sweattrails.session.Interval, "max_speed", row, col + 2,
                             readonly = True,
                             displayconverter = sweattrails.qt.view.PaceSpeed({"Pace": "Best", "Speed": "Maximum"}))
            row += 1
            self.setInstance(interval)
            intervals = sweattrails.session.Interval.query(parent = interval).fetchall()
            if len(intervals) > 1:
                page = IntervalListPage(self)
                self.addTab(page, "Intervals")
                page.list.objectSelected.connect(parent.addInterval)
            self.partSpecificContent(interval)
            self.addTab(GraphPage(self, interval), "Graphs")
            self.addTab(MapPage(self, interval), "Map")
            self.addTab(MiscDataPage(self, interval), "Other Data")
            if interval.basekind() == "session":
                self.addTab(RawDataPage(self), "Raw Data")

            self.statusMessage.connect(QCoreApplication.instance().status_message)
            self.exception.connect(QCoreApplication.instance().status_message)
            self.instanceSaved.connect(QCoreApplication.instance().status_message)
            self.instanceDeleted.connect(QCoreApplication.instance().status_message)
            self.setInstance(interval)
开发者ID:JanDeVisser,项目名称:Grumble,代码行数:54,代码来源:sessiontab.py

示例14: play

 def play(self, do_loop=False, real_time=True):
     time = 0.0 # seconds
     timer = QElapsedTimer()
     timer.restart()
     dtime = 1.0 / self.frames_per_second
     key_frame_number = 0
     frame_number = 0
     for kf in self._key_frames:
         self.current_key_frame_index = key_frame_number
         key_frame_time = 0.0
         while key_frame_time < kf.time_to_next_frame:
             # Drop frames if we are going too slow
             # if real_time and (timer.elapsed() - 200) > time*1000.0:
             #     continue
             tf = key_frame_time / kf.time_to_next_frame
             interpolation_parameter = tf + key_frame_number
             camera_state = camera.State()
             focus_x = self.spline.interpolate_sequence(
                         self._focusx, 
                         interpolation_parameter,
                         do_loop)
             focus_y = self.spline.interpolate_sequence(
                         self._focusy, 
                         interpolation_parameter,
                         do_loop)
             focus_z = self.spline.interpolate_sequence(
                         self._focusz, 
                         interpolation_parameter,
                         do_loop)
             camera_state.focus= Vec3([focus_x, focus_y, focus_z])
             camera_state.zFocus_vheight = self.spline.interpolate_sequence(
                         self._zfv,
                         interpolation_parameter,
                         do_loop)
             quat = self.spline.interpolate_quaternion_sequence(
                         self._quat,
                         interpolation_parameter,
                         do_loop)
             camera_state.rotation = quat.to_rotation()
             if real_time:
                 while timer.elapsed() < time*1000.0:
                     # TODO - use threading instead
                     QCoreApplication.processEvents()
             frame = KeyFrame(camera_state)
             frame.frame_number = frame_number + 1
             frame.key_frame_number = key_frame_number + 1
             yield frame
             key_frame_time += dtime
             time += dtime
             frame_number += 1
             if (not do_loop) and (key_frame_number == len(self._key_frames) - 1):
                 return # Don't go past final frame
         key_frame_number += 1
开发者ID:harry159821,项目名称:cinemol,代码行数:53,代码来源:movie.py

示例15: on_action_update_triggered

    def on_action_update_triggered(self):
        """Sequentially updates all series in the database.

        .. todo::
            Update should also recognize/announce updated episodes.

        """
        series_factory = SeriesFactory()

        for series in db_get_series():
            logger.info("Updating series '{}'".format(series.series_name))

            tvdb_show = tvdb.get_series(series.id, "en", cache=False)
            tvdb_show.update()
            tvdb_show.load_banners()
            series_factory.new_series(tvdb_show, update=series)
            db_commit()

            series_index = self.model.index_of(series)

            for removed_season in series_factory.removed:
                season_index = self.model.index_of(removed_season, series_index)
                season_row = self.model.node_at(season_index).child_index()
                self.model.removeRow(season_row, series_index)
                logger.info("  Removed season {} from series '{}'".format(
                    removed_season.season_number, series.series_name))

            for added_season in series_factory.added:
                self.model.add_item(added_season, series_index)
                logger.info(
                    "  Added season {}".format(added_season.season_number))

            for updated_season in series_factory.updated:
                season, added_episodes, removed_episodes = updated_season

                logger.info(
                    "  Updated season {} (Episodes added: {}, removed: {})".format(
                        season.season_number, len(added_episodes),
                        len(removed_episodes)))

                season_index = self.model.index_of(season, series_index)

                for removed_episode in removed_episodes:
                    episode_index = self.model.index_of(removed_episode,
                                                        season_index)
                    episode_row = self.model.node_at(
                        episode_index).child_index()
                    self.model.removeRow(episode_row, season_index)
                for added_episode in added_episodes:
                    self.model.add_item(added_episode, season_index)

            series_factory.reset()
            QCoreApplication.processEvents()
开发者ID:toroettg,项目名称:SeriesMarker,代码行数:53,代码来源:main_window.py


注:本文中的PySide.QtCore.QCoreApplication类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。