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


Python QApplication.quit方法代码示例

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


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

示例1: closeEvent

# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import quit [as 别名]
def closeEvent(self, event):
        if self.minimize_on_close and not self.need_close:
            self.hide()
            event.ignore()
            self.systray_notification.emit("Parsec", _("TEXT_TRAY_PARSEC_STILL_RUNNING_MESSAGE"))
        else:
            if self.config.gui_confirmation_before_close and not self.force_close:
                result = ask_question(
                    self if self.isVisible() else None,
                    _("TEXT_PARSEC_QUIT_TITLE"),
                    _("TEXT_PARSEC_QUIT_INSTRUCTIONS"),
                    [_("ACTION_PARSEC_QUIT_CONFIRM"), _("ACTION_CANCEL")],
                )
                if result != _("ACTION_PARSEC_QUIT_CONFIRM"):
                    event.ignore()
                    self.force_close = False
                    self.need_close = False
                    return

            self.close_all_tabs()
            event.accept()
            QApplication.quit() 
开发者ID:Scille,项目名称:parsec-cloud,代码行数:24,代码来源:main_window.py

示例2: set_menu

# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import quit [as 别名]
def set_menu(self):
    menubar = self.menuBar()
    fileMenu = menubar.addMenu('&File')

    exit = QtWidgets.QAction("Exit", self)
    exit.setShortcut("Ctrl+Q")
    exit.setStatusTip('Exit application')
    exit.triggered.connect(qApp.quit)
    fileMenu.addAction(exit)

    save = QtWidgets.QAction("Save", self)
    save.setShortcut("Ctrl+S")
    save.setStatusTip('save obj file')
    save.triggered.connect(self.viewer3D.save)
    fileMenu.addAction(save)

    self.flag_ = 0
    self.label_ = "female"
    self.mode = {0:"global_mapping", 1:"local_with_mask", 2:"local_with_rfemat"}
    for i in range(0, len(self.mode)):
      mode = myAction(i, self.mode[i], self)
      mode.myact.connect(self.select_mode)
      #self.connect(mode, QtCore.SIGNAL('myact(int)'), self.select_mode)
      fileMenu.addAction(mode)
    self.setToolTip('This is a window, or <b>something</b>') 
开发者ID:1900zyh,项目名称:3D-Human-Body-Shape,代码行数:27,代码来源:demo.py

示例3: quit

# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import quit [as 别名]
def quit(self):
        print(util.whoami())
        self.commTerminate()
        QApplication.quit()

    # 에러코드의 메시지를 출력한다. 
开发者ID:coreanq,项目名称:kw_condition,代码行数:8,代码来源:main.py

示例4: on_sigterm

# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import quit [as 别名]
def on_sigterm(signum, frame):
    logger.info("SIGNAL handler")
    QApplication.quit() 
开发者ID:vlaci,项目名称:openconnect-sso,代码行数:5,代码来源:webengine_process.py

示例5: qt_schedule

# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import quit [as 别名]
def qt_schedule():
    import signal
    import sys
    from apscheduler.schedulers.qt import QtScheduler

    try:
        from PyQt5.QtWidgets import QApplication, QLabel
    except ImportError:
        try:
            from PyQt4.QtGui import QApplication, QLabel
        except ImportError:
            from PySide.QtGui import QApplication, QLabel

    def tick():
        label.setText('Tick! The time is: %s' % datetime.now())

    app = QApplication(sys.argv)

    # This enables processing of Ctrl+C keypresses
    signal.signal(signal.SIGINT, lambda *args: QApplication.quit())

    label = QLabel('The timer text will appear here in a moment!')
    label.setWindowTitle('QtScheduler example')
    label.setFixedSize(280, 50)
    label.show()

    scheduler = QtScheduler()
    scheduler.add_job(tick, 'interval', seconds=3)
    scheduler.start()

    # Execution will block here until the user closes the windows or Ctrl+C is pressed.
    app.exec_() 
开发者ID:tomoncle,项目名称:Python-notes,代码行数:34,代码来源:schdule.py

示例6: _interrupt_handler

# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import quit [as 别名]
def _interrupt_handler(signum, frame):
    QApplication.quit() 
开发者ID:thejoeejoee,项目名称:VUT-FIT-IFJ-2017-toolkit,代码行数:4,代码来源:main.py

示例7: close_all

# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import quit [as 别名]
def close_all(self):
        QApplication.quit()


# Main entry to program. 
开发者ID:qkitgroup,项目名称:qkit,代码行数:7,代码来源:main.py

示例8: exit

# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import quit [as 别名]
def exit(manager: Manager):
    # TODO: Do cleanup actions
    # TODO: Save state for resume
    print("Shutdown initiated, stopping all services...")
    manager.stop_all()
    # Terminate entire process group, just in case.
    # os.killpg(0, signal.SIGINT)

    QApplication.quit() 
开发者ID:ActivityWatch,项目名称:aw-qt,代码行数:11,代码来源:trayicon.py

示例9: run

# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import quit [as 别名]
def run(manager, testing=False):
    logger.info("Creating trayicon...")
    # print(QIcon.themeSearchPaths())

    app = QApplication(sys.argv)

    # Without this, Ctrl+C will have no effect
    signal.signal(signal.SIGINT, lambda *args: exit(manager))
    # Ensure cleanup happens on SIGTERM
    signal.signal(signal.SIGTERM, lambda *args: exit(manager))

    timer = QtCore.QTimer()
    timer.start(100)  # You may change this if you wish.
    timer.timeout.connect(lambda: None)  # Let the interpreter run each 500 ms.

    if not QSystemTrayIcon.isSystemTrayAvailable():
        QMessageBox.critical(None, "Systray", "I couldn't detect any system tray on this system. Either get one or run the ActivityWatch modules from the console.")
        sys.exit(1)

    widget = QWidget()
    if sys.platform == "darwin":
        icon = QIcon(":/black-monochrome-logo.png")
        # Allow macOS to use filters for changing the icon's color
        icon.setIsMask(True)
    else:
        icon = QIcon(":/logo.png")

    trayIcon = TrayIcon(manager, icon, widget, testing=testing)
    trayIcon.show()

    QApplication.setQuitOnLastWindowClosed(False)

    # Run the application, blocks until quit
    return app.exec_() 
开发者ID:ActivityWatch,项目名称:aw-qt,代码行数:36,代码来源:trayicon.py

示例10: quit

# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import quit [as 别名]
def quit(self):
        """ Quit the server """

        self.disconnect_real_data(self.S_SCREEN_NO)
        QApplication.quit() 
开发者ID:softage0,项目名称:algorithm-trading-webapp,代码行数:7,代码来源:kiwoom.py

示例11: make_excel

# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import quit [as 别名]
def make_excel(self, file_path, data_dict):
        result = False
        result = os.path.isfile(file_path)

        if( result == False):
            with open( CHEGYEOL_INFO_EXCEL_FILE_PATH, 'w', encoding = 'utf8' ) as f:
                f.write('')

        # excel open 
        wb = xw.Book(file_path)
        sheet_names = [sheet.name for sheet in wb.sheets]
        insert_sheet_names = []
        # print(sheet_names)
        for key, value in data_dict.items():
            # sheet name 이 존재 안하면 sheet add
            sheet_name = key[0:4]
            if( sheet_name not in sheet_names ):
                if( sheet_name not in insert_sheet_names ):
                    insert_sheet_names.append(sheet_name)

        for insert_sheet in insert_sheet_names:
            wb.sheets.add(name = insert_sheet)
        # sheet name 은 YYMM 형식 
        sheet_names = [sheet.name for sheet in wb.sheets]

        for sheet_name in sheet_names:
            # key 값이 match 되는것을 찾음 
            row_count = 1
            excel_row_string = 'A{}'
            for sorted_key in sorted(data_dict):
                input_data_sheet_name = sorted_key[0:4]
                if( input_data_sheet_name == sheet_name ):
                    wb.sheets[sheet_name].activate()
                    xw.Range(excel_row_string.format(row_count)).value = [ sorted_key, '-' * 156 ]
                    row_count += 1

                    for line in data_dict[sorted_key]:
                        items = [ item.strip() for item in line.split('|') ]
                        # 빈칸 두개 추가 
                        items.insert(0, '')
                        items.insert(0, '')
                        wb.sheets[sheet_name].activate()
                        xw.Range(excel_row_string.format(row_count)).value = items 
                        row_count += 1

        # save
        wb.save()
        wb.app.quit()

    # method 
    # 로그인
    # 0 - 성공, 음수값은 실패
    # 단순 API 호출이 되었느냐 안되었느냐만 확인 가능 
开发者ID:coreanq,项目名称:kw_condition,代码行数:55,代码来源:main.py

示例12: main

# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import quit [as 别名]
def main(argv):
    """Main function to open a h5 file with qviewkit.

    This function is called via command line. It opens the optional parsed
    h5 file and the optional parsed datasets automatically.
    The DatasetsWindow object creates a Qt based window with some UI buttons
    for file handling and a populated tree of the datasets.

    Args:
        '-f','--file',     type=str, help='hdf filename to open'
        '-ds','--datasets', type=str, help='(optional) datasets opened by default'

        '-rt','--refresh_time', type=float, help='(optional) refresh time'
        '-sp','--save_plot',  default=False,action='store_true', help='(optional) save default plots'
        '-live','--live_plot',default=False,action='store_true', help='(optional) if set, plots are reloaded'
        '-qinfo','--qkit_info',default=False,action='store_true', help='(optional) if set, listen to qkit infos'
    """
    # some configuration boilerplate
    data = DATA()

    parser = argparse.ArgumentParser(
        description="Qviewkit / qkit tool to visualize qkit-hdf files // HR@KIT 2015")


    parser.add_argument('-f','--file',     type=str, help='hdf filename to open')
    parser.add_argument('-ds','--datasets', type=str, help='(optional) datasets opened by default')

    parser.add_argument('-rt','--refresh_time', type=float, help='(optional) refresh time')
    parser.add_argument('-sp','--save_plot',  default=False,action='store_true', help='(optional) save default plots')
    parser.add_argument('-live','--live_plot',default=False,action='store_true', help='(optional) if set, plots are reloaded')
    parser.add_argument('-qinfo','--qkit_info',default=False,action='store_true', help='(optional) if set, listen to qkit infos')
    args=parser.parse_args()
    data.args = args

    # create Qt application
    if in_pyqt5:
        app = QApplication(argv)
    if in_pyqt4:
        app = QApplication(argv,True)

    # if activated, start info thread
    if data.args.qkit_info:
        from qkit.gui.qviewkit.info_subsys import info_thread
        it = info_thread(data)
        it.start()


    # create main window
    from qkit.gui.qviewkit.DatasetsWindow import DatasetsWindow
    #
    dsw = DatasetsWindow(data)
    dsw.show()
    dsw.raise_()

    # Connect signal for app quit
    app.lastWindowClosed.connect(quit)
    app.exec_() 
开发者ID:qkitgroup,项目名称:qkit,代码行数:59,代码来源:main.py

示例13: __init__

# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import quit [as 别名]
def __init__(self, k_queue):
        super().__init__()
        self.S_SCREEN_NO = "0001"
        self.MARKET_LIST = {
            0: '장내',
            3: 'ELW',
            4: '뮤추얼펀드',
            5: '신주인수권',
            6: '리츠',
            8: 'ETF',
            9: '하이일드펀드',
            10: '코스닥',
            30: '제3시장'
        }
        self.ORDER_TYPE = {
            1: '신규매수',
            2: '신규매도',
            3: '매수취소',
            4: '매도취소'
        }
        self.HOGA = {
            '00': '지정가',
            '03': '시장가'
        }

        self.q = k_queue
        self.qs = {
            'OnReceiveTrData': queue.Queue(),
            'OnReceiveRealData': queue.Queue(),
            'OnReceiveMsg': queue.Queue(),
            'OnReceiveChejanData': queue.Queue(),
            'OnEventConnect': queue.Queue(),
            'OnReceiveRealCondition': queue.Queue(),
            'OnReceiveTrCondition': queue.Queue(),
            'OnReceiveConditionVer': queue.Queue()
        }
        self.ocx = QAxWidget("KHOPENAPI.KHOpenAPICtrl.1")
        self.ocx.OnReceiveTrData[str, str, str, str, str, int, str, str, str].connect(self.OnReceiveTrData)
        self.ocx.OnReceiveRealData[str, str, str].connect(self.OnReceiveRealData)
        self.ocx.OnReceiveMsg[str, str, str, str].connect(self.OnReceiveMsg)
        self.ocx.OnReceiveChejanData[str, int, str].connect(self.OnReceiveChejanData)
        self.ocx.OnEventConnect[int].connect(self.OnEventConnect)
        self.ocx.OnReceiveRealCondition[str, str, str, str].connect(self.OnReceiveRealCondition)
        self.ocx.OnReceiveTrCondition[str, str, str, int, int].connect(self.OnReceiveTrCondition)
        self.ocx.OnReceiveConditionVer[int, str].connect(self.OnReceiveConditionVer)
        atexit.register(self.quit)

    ####################################################
    # Interface Methods
    #################################################### 
开发者ID:softage0,项目名称:algorithm-trading-webapp,代码行数:52,代码来源:kiwoom.py


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