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


Python QCoreApplication.instance方法代码示例

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


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

示例1: move

# 需要导入模块: from PySide.QtCore import QCoreApplication [as 别名]
# 或者: from PySide.QtCore.QCoreApplication import instance [as 别名]
 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,代码行数:9,代码来源:Units.py

示例2: file_import

# 需要导入模块: from PySide.QtCore import QCoreApplication [as 别名]
# 或者: from PySide.QtCore.QCoreApplication import instance [as 别名]
 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,代码行数:9,代码来源:mainwindow.py

示例3: __init__

# 需要导入模块: from PySide.QtCore import QCoreApplication [as 别名]
# 或者: from PySide.QtCore.QCoreApplication import instance [as 别名]
 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,代码行数:36,代码来源:mainwindow.py

示例4: __init__

# 需要导入模块: from PySide.QtCore import QCoreApplication [as 别名]
# 或者: from PySide.QtCore.QCoreApplication import instance [as 别名]
 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,代码行数:9,代码来源:usertab.py

示例5: setUpClass

# 需要导入模块: from PySide.QtCore import QCoreApplication [as 别名]
# 或者: from PySide.QtCore.QCoreApplication import instance [as 别名]
    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,代码行数:10,代码来源:mainwidget_test.py

示例6: __init__

# 需要导入模块: from PySide.QtCore import QCoreApplication [as 别名]
# 或者: from PySide.QtCore.QCoreApplication import instance [as 别名]
    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,代码行数:56,代码来源:sessiontab.py

示例7: createActions

# 需要导入模块: from PySide.QtCore import QCoreApplication [as 别名]
# 或者: from PySide.QtCore.QCoreApplication import instance [as 别名]
    def createActions(self):
        self.switchUserAct = QAction("&Switch User", self, shortcut = "Ctrl+U", statusTip = "Switch User", triggered = self.switch_user)
        self.importFileAct = QAction("&Import", self, shortcut = "Ctrl+I", statusTip = "Import Session", triggered = self.file_import)
        self.downloadAct = QAction("&Download", self, shortcut = "Ctrl+D",
                                   statusTip = "Download activities from device",
                                   triggered = QCoreApplication.instance().download)
        self.downloadAct = QAction("&Withings", self,
                                   statusTip = "Download Withings data",
                                   triggered = QCoreApplication.instance().withings)
        self.exitAct = QAction("E&xit", self, shortcut = "Ctrl+Q", statusTip = "Exit SweatTrails", triggered = self.close)

        self.aboutAct = QAction("&About", self, triggered = self.about)
        self.aboutQtAct = QAction("About &Qt", self, triggered = QApplication.aboutQt)
开发者ID:JanDeVisser,项目名称:Grumble,代码行数:15,代码来源:mainwindow.py

示例8: app_version

# 需要导入模块: from PySide.QtCore import QCoreApplication [as 别名]
# 或者: from PySide.QtCore.QCoreApplication import instance [as 别名]
def app_version():
    """
    Detect and return the application version for the running application. The
    following locations are searched, in this order, for a version string:

        1. ``siding.plugins.version``
        2. :func:`PySide.QtCore.QCoreApplication.applicationVersion`
        3. ``__main__.version``
        4. ``__main__.__version__``

    If the version is not found in one of those locations, a
    :class:`RuntimeError` will be raised.
    """
    if version:
        return version

    ver = QCoreApplication.instance().applicationVersion()
    if ver:
        return ver

    import __main__
    if hasattr(__main__, 'version'):
        return __main__.version
    elif hasattr(__main__, '__version__'):
        return __main__.__version__

    raise RuntimeError("Application version not set.")
开发者ID:gitter-badger,项目名称:a2,代码行数:29,代码来源:plugins.py

示例9: create

# 需要导入模块: from PySide.QtCore import QCoreApplication [as 别名]
# 或者: from PySide.QtCore.QCoreApplication import instance [as 别名]
 def create(self):
     password = self.pwd.text()
     if password != self.pwd_again.text():
         QMessageBox.critical(self, "Passwords don't match",
             "The passwords entered are different")
         self.reject()
     try:
         QCoreApplication.instance().add_user(self.email.text(),
                                              password,
                                              self.display_name.text(),
                                              self.savecreds.isChecked())
         self.accept()
     except Exception as e:
         logger.exception("Exception creating user")
         QMessageBox.critical(self, "Error", str(e))
         self.reject()
开发者ID:JanDeVisser,项目名称:Grumble,代码行数:18,代码来源:mainwindow.py

示例10: __init__

# 需要导入模块: from PySide.QtCore import QCoreApplication [as 别名]
# 或者: from PySide.QtCore.QCoreApplication import instance [as 别名]
 def __init__(self, parent = None):
     super(SettingsPage, self).__init__(parent)
     self.setMinimumSize(800, 600)
     self.addProperty(grizzle.User, "email", 0, 0)
     self.addProperty(grizzle.User, "display_name", 1, 0)
     self.addProperty(sweattrails.userprofile.UserProfile,
                      "_userprofile.dob", 2, 0)
     self.addProperty(sweattrails.userprofile.UserProfile,
                      "_userprofile.gender", 3, 0,
                      style = "radio")
     self.addProperty(sweattrails.userprofile.UserProfile,
                      "_userprofile.height", 4, 0,
                      min = 100, max = 240, suffix = "cm")
     self.addProperty(sweattrails.userprofile.UserProfile,
                      "_userprofile.units", 5, 0,
                      style = "radio")
     
     withingsB = QGroupBox("Withings Support",  self)
     withingsL = QGridLayout(withingsB)
     self.enableWithings = QCheckBox("Enable Withings",  withingsB)
     self.enableWithings.toggled.connect(self.toggleWithings)
     withingsL.addWidget(self.enableWithings, 0, 0)
     withingsL.addWidget(QLabel("Withings User ID"), 1, 0)
     self.withingsUserID = QLineEdit(withingsB)
     withingsL.addWidget(self.withingsUserID, 1, 1)
     withingsL.addWidget(QLabel("Withings Key"), 2, 0)
     self.withingsKey = QLineEdit(withingsB)
     withingsL.addWidget(self.withingsKey, 2, 1)
     self.addWidget(withingsB, self.form.rowCount(), 0, 1, 2)
     self.addStretch()
     self.statusMessage.connect(QCoreApplication.instance().status_message)
开发者ID:JanDeVisser,项目名称:Grumble,代码行数:33,代码来源:profiletab.py

示例11: init_config

# 需要导入模块: from PySide.QtCore import QCoreApplication [as 别名]
# 或者: from PySide.QtCore.QCoreApplication import instance [as 别名]
 def init_config(self, args):
     save = False
     self.user = self.user_id = None
     if "qtapp" not in gripe.Config:
         gripe.Config.qtapp = {}
     self.config = gripe.Config.qtapp
     if "settings" not in self.config:
         self.config["settings"] = {}
         save = True
     if save:
         self.config = gripe.Config.set("qtapp", self.config)
     save = False
     if args.user and args.password:
         if QCoreApplication.instance().has_users():
             self.authenticate(args.user, args.password, args.savecreds)
         else:
             self.add_user(args.user, args.password, args.user, args.savecreds)
     else:
         if "user" in self.config.settings:
             user_settings = self.config.settings.user
             uid = user_settings.user_id if "user_id" in user_settings else None
             password = user_settings.password if "password" in user_settings else None
             logger.debug("Auto-login uid %s", uid)
             if not uid or not self.authenticate(uid, password, False):
                 del self.config.settings["user"]
                 save = True
     if save:
         self.config = gripe.Config.set("qtapp", self.config)
开发者ID:JanDeVisser,项目名称:Grumble,代码行数:30,代码来源:app.py

示例12: install

# 需要导入模块: from PySide.QtCore import QCoreApplication [as 别名]
# 或者: from PySide.QtCore.QCoreApplication import instance [as 别名]
def install(app=None, timeout=0.02):
    """
    Creates a :class:`~PySide.QtCore.QTimer` instance that will be triggered
    continuously to call :func:`Engine.poll() <pants.engine.Engine.poll>`,
    ensuring that Pants remains responsive.

    =========  ========  ============
    Argument   Default   Description
    =========  ========  ============
    app        None      *Optional.* The :class:`~PySide.QtCore.QCoreApplication` to attach to. If no application is provided, it will attempt to find an existing application in memory, or, failing that, create a new application instance.
    timeout    ``0.02``  *Optional.* The maximum time to wait, in seconds, before running :func:`Engine.poll() <pants.engine.Engine.poll>`.
    =========  ========  ============
    """
    global timer
    global _timeout

    Engine.instance()._install_poller(_Qt())

    if app is None:
        app = QCoreApplication.instance()
    if app is None:
        app = QCoreApplication([])

    _timeout = timeout * 1000

    timer = QTimer(app)
    timer.timeout.connect(do_poll)
    timer.start(_timeout)
开发者ID:ixokai,项目名称:pants,代码行数:30,代码来源:qt.py

示例13: __init__

# 需要导入模块: from PySide.QtCore import QCoreApplication [as 别名]
# 或者: from PySide.QtCore.QCoreApplication import instance [as 别名]
    def __init__(self):
        self._reads = {}
        self._writes = {}
        self._notifiers = {}
        self._timer = QTimer()
        self._timer.setSingleShot(True)
        QObject.connect(self._timer, SIGNAL("timeout()"), self.iterate)

        if QCoreApplication.instance() is None:
            # Application Object has not been started yet
            self.qApp=QCoreApplication([])
            self._ownApp=True
        else:
            self.qApp = QCoreApplication.instance()
            self._ownApp=False
        self._blockApp = None
        posixbase.PosixReactorBase.__init__(self)
开发者ID:mjirik,项目名称:kinect-server,代码行数:19,代码来源:qt4reactor.py

示例14: doit

# 需要导入模块: from PySide.QtCore import QCoreApplication [as 别名]
# 或者: from PySide.QtCore.QCoreApplication import instance [as 别名]
 def doit():
     try:
         app = QApplication([])
     except RuntimeError:
         app = QCoreApplication.instance()
     main_window = main_window_factory()
     main_window.show()
     app.exec_()
开发者ID:andreasbuhr,项目名称:pymor,代码行数:10,代码来源:qt.py

示例15: select_user

# 需要导入模块: from PySide.QtCore import QCoreApplication [as 别名]
# 或者: from PySide.QtCore.QCoreApplication import instance [as 别名]
 def select_user(self):
     ret = False
     if QCoreApplication.instance().user:
         return True
     elif QCoreApplication.instance().has_users():
         dialog = SelectUser(self)
         dialog.select()
         ret = QCoreApplication.instance().is_authenticated()
         if ret:
             self.refresh()
     else:
         dialog = CreateUser(self)
         dialog.exec_()
         ret = QCoreApplication.instance().is_authenticated()
         if ret:
             self.refresh()
     return ret
开发者ID:JanDeVisser,项目名称:Grumble,代码行数:19,代码来源:mainwindow.py


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