Python gi.repository.Gtk.main_quit() Examples
The following are 30
code examples of gi.repository.Gtk.main_quit().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
gi.repository.Gtk
, or try the search function
.
Example #1
Source File: message.py From epoptes with GNU General Public License v3.0 | 6 votes |
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()
Example #2
Source File: budgiesysmonitor.py From indicator-sysmonitor with GNU General Public License v3.0 | 6 votes |
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
Example #3
Source File: asktext.py From textext with BSD 3-Clause "New" or "Revised" License | 6 votes |
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
Example #4
Source File: app.py From volctl with GNU General Public License v2.0 | 6 votes |
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)
Example #5
Source File: ConnectToNetwork.py From kano-settings with GNU General Public License v2.0 | 6 votes |
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 ) )
Example #6
Source File: theme_picker.py From wpgtk with GNU General Public License v2.0 | 5 votes |
def run(args): win = mainWindow(args) win.connect('delete-event', Gtk.main_quit) win.show_all() Gtk.main()
Example #7
Source File: windows.py From deskcon-desktop with GNU General Public License v3.0 | 5 votes |
def on_cancel_button_clicked(self, widget): self.accepted = False Gtk.main_quit()
Example #8
Source File: sms.py From deskcon-desktop with GNU General Public License v3.0 | 5 votes |
def on_cancelbutton_clicked(self, widget): Gtk.main_quit()
Example #9
Source File: sms.py From deskcon-desktop with GNU General Public License v3.0 | 5 votes |
def on_errordialog_close(self, widget): Gtk.main_quit()
Example #10
Source File: main_ui.py From innstereo with GNU General Public License v2.0 | 5 votes |
def on_menuitem_quit_activate(self, widget): """ Triggered when the main window is closed from the menu. Terminates the Gtk main loop. """ Gtk.main_quit()
Example #11
Source File: handler.py From WattmanGTK with GNU General Public License v2.0 | 5 votes |
def onDestroy(self, *args): # On pressing close button Gtk.main_quit()
Example #12
Source File: trayicon.py From networkmgr with BSD 3-Clause "New" or "Revised" License | 5 votes |
def stop_manager(self, widget): Gtk.main_quit()
Example #13
Source File: windows.py From deskcon-desktop with GNU General Public License v3.0 | 5 votes |
def start(self): self.connect("destroy", Gtk.main_quit) self.set_position(Gtk.WindowPosition.CENTER) self.show_all() GObject.threads_init() Gtk.main() return self.accepted
Example #14
Source File: mpl_with_glade3_sgskip.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
def on_window1_destroy(self, widget): Gtk.main_quit()
Example #15
Source File: single_widget_window.py From RAFCON with Eclipse Public License 1.0 | 5 votes |
def register_view(self, view): """Called when the View was registered Can be used e.g. to connect signals. Here, the destroy signal is connected to close the application """ super(SingleWidgetWindowController, self).register_view(view) self.shortcut_manager = ShortcutManager(self.view['main_window']) self.register_actions(self.shortcut_manager) view['main_window'].connect('destroy', Gtk.main_quit) # view.get_top_widget().connect('destroy', Gtk.main_quit)
Example #16
Source File: buttons.py From kano-toolset with GNU General Public License v2.0 | 5 votes |
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()
Example #17
Source File: start.py From RAFCON with Eclipse Public License 1.0 | 5 votes |
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()
Example #18
Source File: windows.py From deskcon-desktop with GNU General Public License v3.0 | 5 votes |
def on_yes_button_clicked(self, widget): self.accepted = True Gtk.main_quit()
Example #19
Source File: sms.py From deskcon-desktop with GNU General Public License v3.0 | 5 votes |
def send_sms(recver, msg, ip, port, errordialog): HOST, PORT = ip, int(port) uuid = configmanager.uuid hostname = socket.gethostname() jsonobj = {'uuid': uuid, 'name': hostname, 'type': "sms", 'data': {'number': recver, 'message': msg}} data = json.dumps(jsonobj) # Initialize context ctx = SSL.Context(SSL.TLSv1_METHOD) ctx.set_options(SSL.OP_NO_SSLv2|SSL.OP_NO_SSLv3) #TLS1 and up ctx.set_verify(SSL.VERIFY_PEER, verify_cb) #Demand a certificate ctx.use_privatekey_file(configmanager.privatekeypath) ctx.use_certificate_file(configmanager.certificatepath) ctx.load_verify_locations(configmanager.cafilepath) sslclientsocket = SSL.Connection(ctx, socket.socket(socket.AF_INET, socket.SOCK_STREAM)) succ = False try: sslclientsocket.connect((HOST, PORT)) sslclientsocket.sendall(data) sslclientsocket.recv(2) succ = True except Exception as e: errnum = e[0] print "Error " + str(e[0]) if (errnum == -5): errordialog.format_secondary_text("The Device is not reachable. Maybe it's not on your Network") else: errordialog.format_secondary_text("Errornumber "+str(errnum)) errordialog.run() errordialog.hide() finally: if (succ): sslclientsocket.shutdown() sslclientsocket.close() Gtk.main_quit()
Example #20
Source File: settingswindow.py From deskcon-desktop with GNU General Public License v3.0 | 5 votes |
def on_errordialog_close(self, widget): Gtk.main_quit()
Example #21
Source File: settingswindow.py From deskcon-desktop with GNU General Public License v3.0 | 5 votes |
def on_okbutton_clicked(self, widget): datadict = {} datadict['downloaddir'] = self.downloadfilechooserbutton.get_filename() datadict['bindip'] = self.ipentry.get_text() datadict['port'] = int(self.portentry.get_text()) datadict['secure_port'] = int(self.secportentry.get_text()) datadict['debug'] = False datadict['auto_open_urls'] = self.autourlswitch.get_active() datadict['auto_store_clipboard'] = self.autoclipboardswitch.get_active() datadict['auto_accept_files'] = self.autofileswitch.get_active() configmanager.write_config(datadict) restart_server() Gtk.main_quit()
Example #22
Source File: settingswindow.py From deskcon-desktop with GNU General Public License v3.0 | 5 votes |
def on_closebutton_clicked(self, widget): Gtk.main_quit()
Example #23
Source File: fingerprints.py From deskcon-desktop with GNU General Public License v3.0 | 5 votes |
def on_cancel_button_clicked(self, widget): self.accepted = False Gtk.main_quit()
Example #24
Source File: fingerprints.py From deskcon-desktop with GNU General Public License v3.0 | 5 votes |
def on_yes_button_clicked(self, widget): self.accepted = True Gtk.main_quit()
Example #25
Source File: fingerprints.py From deskcon-desktop with GNU General Public License v3.0 | 5 votes |
def start(self): self.connect("destroy", Gtk.main_quit) self.set_position(Gtk.WindowPosition.CENTER) self.show_all() GObject.threads_init() Gtk.main() return self.accepted
Example #26
Source File: notificationmanager.py From deskcon-desktop with GNU General Public License v3.0 | 5 votes |
def open_folder(self, ac_name, args, a): Gtk.main_quit() self.callback("")
Example #27
Source File: notificationmanager.py From deskcon-desktop with GNU General Public License v3.0 | 5 votes |
def open_file(self, ac_name, filename, a): Gtk.main_quit() self.callback(a)
Example #28
Source File: notificationmanager.py From deskcon-desktop with GNU General Public License v3.0 | 5 votes |
def input_timeout(self): GObject.threads_init() timeout = FILE_TIMEOUT while self.waiting_for_user_input: time.sleep(1) timeout = timeout - 1 if timeout == 0: self.file_notification.close() self.waiting_for_user_input = False buildNotification("File", "Filetranfser was canceled after 60 seconds") Gtk.main_quit() break
Example #29
Source File: notificationmanager.py From deskcon-desktop with GNU General Public License v3.0 | 5 votes |
def cancel(self, ac_name, args, a): self.waiting_for_user_input = False self.accepted = False Gtk.main_quit()
Example #30
Source File: notificationmanager.py From deskcon-desktop with GNU General Public License v3.0 | 5 votes |
def accept(self, ac_name, args, a): self.waiting_for_user_input = False self.accepted = True Gtk.main_quit()