本文整理汇总了Python中gi.repository.Gtk.main_quit方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.main_quit方法的具体用法?Python Gtk.main_quit怎么用?Python Gtk.main_quit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gtk
的用法示例。
在下文中一共展示了Gtk.main_quit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_quit [as 别名]
def __init__(self, pulse=True, title="", rate=0.01):
apply_colours_to_screen()
apply_styling_to_screen(self.CSS_PATH)
ProgressBar.__init__(self, pulse, rate)
self.get_style_context().add_class("KanoProgressBar")
self.win = Gtk.Window()
self.win.get_style_context().add_class("KanoProgressBar")
self.win.set_decorated(False)
self.win.set_resizable(False)
self.win.set_position(Gtk.WindowPosition.CENTER)
self.win.connect("delete-event", Gtk.main_quit)
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.win.add(box)
label = Gtk.Label(title)
label.set_padding(10, 10)
label.get_style_context().add_class("KanoProgressBar")
box.pack_start(label, False, False, 5)
box.pack_start(self, False, False, 0)
示例2: window_deleted_cb
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_quit [as 别名]
def window_deleted_cb(self, widget, event, view):
if (self._gui_config.get("confirm_close", self.DEFAULT_CONFIRM_CLOSE)
and self._source_buffer.get_text(self._source_buffer.get_start_iter(),
self._source_buffer.get_end_iter(), True) != self.text):
dlg = Gtk.MessageDialog(self._window, Gtk.DialogFlags.MODAL, Gtk.MessageType.QUESTION, Gtk.ButtonsType.NONE)
dlg.set_markup(
"<b>Do you want to close TexText without save?</b>\n\n"
"Your changes will be lost if you don't save them."
)
dlg.add_button("Continue editing", Gtk.ResponseType.CLOSE) \
.set_image(Gtk.Image.new_from_stock(Gtk.STOCK_GO_BACK, Gtk.IconSize.BUTTON))
dlg.add_button("Close without save", Gtk.ResponseType.YES) \
.set_image(Gtk.Image.new_from_stock(Gtk.STOCK_CLOSE, Gtk.IconSize.BUTTON))
dlg.set_title("Close without save?")
res = dlg.run()
dlg.destroy()
if res in (Gtk.ResponseType.CLOSE, Gtk.ResponseType.DELETE_EVENT):
return True
Gtk.main_quit()
return False
示例3: main
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_quit [as 别名]
def main():
"""Run the module from the command line."""
if len(sys.argv) <= 1 or len(sys.argv) > 5:
print(_("Usage: {} text [title] [markup] [icon_name]").format(
os.path.basename(__file__)), file=sys.stderr)
exit(1)
text = sys.argv[1]
if len(sys.argv) > 2 and sys.argv[2]:
title = sys.argv[2]
else:
title = "Epoptes"
if len(sys.argv) > 3 and sys.argv[3]:
markup = sys.argv[3].lower() == "true"
else:
markup = True
if len(sys.argv) > 4:
icon_name = sys.argv[4]
else:
icon_name = "dialog-information"
window = MessageWindow(text, title, markup, icon_name)
window.connect("destroy", Gtk.main_quit)
window.show_all()
Gtk.main()
示例4: _success_screen
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_quit [as 别名]
def _success_screen(self):
self._win.remove_main_widget()
title = _("Success")
description = _("You're connected")
buttons = [
{
'label': _("OK"),
'type': 'KanoButton',
'color': 'green',
'callback': Gtk.main_quit
}
]
img_path = os.path.join(img_dir, "internet.png")
self._win.set_main_widget(
Template(
title,
description,
buttons,
self._win.is_plug(),
img_path
)
)
示例5: on_exit
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_quit [as 别名]
def on_exit(self, event=None, data=None):
"""Action call when the main programs is closed."""
# cleanup temporary indicator icon
os.remove(self.tindicator)
# close the open dialogs
if self._help_dialog is not None:
self._help_dialog.destroy()
if self._preferences_dialog is not None:
self._preferences_dialog.destroy()
logging.info("Terminated")
self.alive.clear() # DM: why bother with Event() ???
try:
Gtk.main_quit()
except RuntimeError:
pass
示例6: quit
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_quit [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)
示例7: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_quit [as 别名]
def __init__(self):
Gtk.Window.__init__(self)
self.box = Gtk.Box()
self.add(self.box)
colours = ["red", "blue", "green", "orange"]
for c in colours:
button = KanoButton("hello", color=c)
self.box.pack_start(button, False, False, 0)
button.connect("button-release-event", self.spinner_test)
self.connect("delete-event", Gtk.main_quit)
self.show_all()
示例8: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_quit [as 别名]
def __init__(self, title="Application", width=None, height=None):
Gtk.Window.__init__(self, title=title)
self.set_decorated(False)
self.set_resizable(False)
screen = Gdk.Screen.get_default()
self._win_width = width
if width <= 1:
self._win_width = int(screen.get_width() * width)
self._win_height = height
if height <= 1:
self._win_height = int(screen.get_height() * height)
self.set_size_request(self._win_width, self._win_height)
self.set_position(Gtk.WindowPosition.CENTER)
self.connect('delete-event', Gtk.main_quit)
apply_common_to_screen()
self._overlay = Gtk.Overlay()
self.add(self._overlay)
self._blur = Gtk.EventBox()
self._blur.get_style_context().add_class('blur')
self._blurred = False
# TODO: Maybe handle the taskbar here to avoid even more code duplication?
示例9: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_quit [as 别名]
def __init__(self):
Gtk.Window.__init__(self)
self.combo_box = KanoComboBox()
self.add(self.combo_box)
self.combo_box.set_items(["item1", "item2", "item3", "item4", "item5", "item6", "item7", "item8"])
self.combo_box.set_selected_item_index(0)
self.connect("delete-event", Gtk.main_quit)
self.show_all()
示例10: standalone
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_quit [as 别名]
def standalone(self):
window = app.obj("tl_calc_win")
window.connect("delete-event", Gtk.main_quit)
app.builder.connect_signals(Handler())
window.show_all()
Gtk.main()
示例11: quit_app
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_quit [as 别名]
def quit_app(self, window, event):
print("Authorization failed")
Gtk.main_quit()
示例12: quit_app
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_quit [as 别名]
def quit_app(self, window, event):
self.config_save()
Gtk.main_quit()
示例13: watch_process
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_quit [as 别名]
def watch_process(self, io, condition, process_name):
if condition is GLib.IO_HUP:
self.progressbar.pulse()
self.n_files_to_copy -= 1
if self.n_files_to_copy == 0:
message_dialog = Gtk.MessageDialog(
self.main_window,
0,
Gtk.MessageType.ERROR,
Gtk.ButtonsType.OK,
_("Done!"),
width_request = 360
)
content_area = message_dialog.get_content_area()
content_area.set_property('margin-left', 10)
content_area.set_property('margin-right', 10)
content_area.set_property('margin-top', 10)
content_area.set_property('margin-bottom', 10)
action_area = message_dialog.get_action_area()
action_area.set_property('spacing', 10)
self.main_window.hide()
message_dialog.run()
message_dialog.destroy()
Gtk.main_quit()
return False
while Gtk.events_pending():
Gtk.main_iteration_do(False)
return True
示例14: cb_button_save
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_quit [as 别名]
def cb_button_save(self, button):
self.dosbox_config_save()
Gtk.main_quit()
示例15: do_quit
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import main_quit [as 别名]
def do_quit(self):
Gtk.main_quit()
# a{ss} = dictionary(dbus) of keys=s and values=s