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


Python Gtk.main_level方法代码示例

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


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

示例1: quit

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_level [as 别名]
def quit(self):
        """Gracefully shut down application."""
        try:
            self._pa_mgr.close()
        except AttributeError:
            pass
        if Gtk.main_level() > 0:
            try:
                self._preferences.response(0)
            except AttributeError:
                pass
            try:
                self._about_win.close()
            except AttributeError:
                pass
            Gtk.main_quit()
        else:
            sys.exit(1) 
开发者ID:buzz,项目名称:volctl,代码行数:20,代码来源:app.py

示例2: mainloop

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_level [as 别名]
def mainloop(self):
        if Gtk.main_level() == 0:
            Gtk.main() 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:5,代码来源:backend_gtk3.py

示例3: destroy

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_level [as 别名]
def destroy(self, *args):
        if _debug: print 'FigureManagerGTK3.%s' % fn_name()
        self.vbox.destroy()
        self.window.destroy()
        self.canvas.destroy()
        if self.toolbar:
            self.toolbar.destroy()
        self.__dict__.clear()   #Is this needed? Other backends don't have it.

        if Gcf.get_num_fig_managers()==0 and \
               not matplotlib.is_interactive() and \
               Gtk.main_level() >= 1:
            Gtk.main_quit() 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:15,代码来源:backend_gtk3.py

示例4: destroy

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_level [as 别名]
def destroy(self, *args):
        self.vbox.destroy()
        self.window.destroy()
        self.canvas.destroy()
        if self.toolbar:
            self.toolbar.destroy()

        if (Gcf.get_num_fig_managers() == 0 and
                not matplotlib.is_interactive() and
                Gtk.main_level() >= 1):
            Gtk.main_quit() 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:13,代码来源:backend_gtk3.py

示例5: mainloop

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_level [as 别名]
def mainloop():
        if Gtk.main_level() == 0:
            Gtk.main() 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:5,代码来源:backend_gtk3.py

示例6: destroy

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_level [as 别名]
def destroy(self, *args):
        if _debug: print('FigureManagerGTK3.%s' % fn_name())
        self.vbox.destroy()
        self.window.destroy()
        self.canvas.destroy()
        if self.toolbar:
            self.toolbar.destroy()

        if Gcf.get_num_fig_managers()==0 and \
               not matplotlib.is_interactive() and \
               Gtk.main_level() >= 1:
            Gtk.main_quit() 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:14,代码来源:backend_gtk3.py

示例7: stop_gtk

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_level [as 别名]
def stop_gtk():
    # shutdown twisted correctly
    if reactor_required():
        from twisted.internet import reactor
        if reactor.running:
            reactor.callFromThread(reactor.stop)
        # Twisted can be imported without the reactor being used
        # => check if GTK main loop is running
        elif Gtk.main_level() > 0:
            GLib.idle_add(Gtk.main_quit)
    else:
        GLib.idle_add(Gtk.main_quit)

    # Run the GTK loop until no more events are being generated and thus the GUI is fully destroyed
    wait_for_gui() 
开发者ID:DLR-RM,项目名称:RAFCON,代码行数:17,代码来源:start.py

示例8: show

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_level [as 别名]
def show(self):
        self.window.show_all()

        if gtk.main_level() == 0:
            if self.pywebview_window.hidden:
                self.window.hide()
            gtk.main()
        else:
            glib.idle_add(self.window.show_all) 
开发者ID:r0x0r,项目名称:pywebview,代码行数:11,代码来源:gtk.py

示例9: evaluate_js

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_level [as 别名]
def evaluate_js(self, script):
        def _evaluate_js():
            callback = None if old_webkit else _callback
            self.webview.run_javascript(script, None, callback, None)

        def _callback(webview, task, data):
            value = webview.run_javascript_finish(task)
            if value:
                self.js_results[unique_id]['result'] = value.get_js_value().to_string()
            else:
                self.js_results[unique_id]['result'] = None

            result_semaphore.release()

        unique_id = uuid1().hex
        result_semaphore = Semaphore(0)
        self.js_results[unique_id] = {'semaphore': result_semaphore, 'result': None}

        if old_webkit:
            script = 'document.title = JSON.stringify({{"type": "eval", "uid": "{0}", "result": {1}}})'.format(unique_id, script)

        self.loaded.wait()
        glib.idle_add(_evaluate_js)
        result_semaphore.acquire()

        if not gtk.main_level():
            # Webview has been closed, don't proceed
            return None

        result = self.js_results[unique_id]['result']
        result = None if result == 'undefined' or result == 'null' or result is None else result if result == '' else json.loads(result)

        del self.js_results[unique_id]

        return result 
开发者ID:r0x0r,项目名称:pywebview,代码行数:37,代码来源:gtk.py

示例10: _on_destroy_window

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_level [as 别名]
def _on_destroy_window(self, window):
		self.remove_window(window)
		if not self._windows:
			from gi.repository import Gtk

			logger.debug('Last toplevel destroyed, quit')
			if Gtk.main_level() > 0:
				Gtk.main_quit() 
开发者ID:zim-desktop-wiki,项目名称:zim-desktop-wiki,代码行数:10,代码来源:__init__.py

示例11: _setup_signal_handling

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_level [as 别名]
def _setup_signal_handling(self):
		def handle_sigterm(signal, frame):
			from gi.repository import Gtk

			logger.info('Got SIGTERM, quit')
			if Gtk.main_level() > 0:
				Gtk.main_quit()

		signal.signal(signal.SIGTERM, handle_sigterm) 
开发者ID:zim-desktop-wiki,项目名称:zim-desktop-wiki,代码行数:11,代码来源:__init__.py

示例12: quit

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_level [as 别名]
def quit(self):
		'''Menu action for quit.
		@emits: quit
		'''
		if Gtk.main_level() > 0:
			Gtk.main_quit()
		# We expect the application to call "destroy" on all windows once
		# it is bumped out of the main loop 
开发者ID:zim-desktop-wiki,项目名称:zim-desktop-wiki,代码行数:10,代码来源:uiactions.py

示例13: do_quit

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_level [as 别名]
def do_quit(self):
		'''Quit zim.'''
		if Gtk.main_level() > 0:
			Gtk.main_quit() 
开发者ID:zim-desktop-wiki,项目名称:zim-desktop-wiki,代码行数:6,代码来源:trayicon.py


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