Python gtk.main_quit() Examples
The following are 30
code examples of 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
gtk
, or try the search function
.
Example #1
Source File: inputhook.py From python-prompt-toolkit with BSD 3-Clause "New" or "Revised" License | 6 votes |
def inputhook(context): """ When the eventloop of prompt-toolkit is idle, call this inputhook. This will run the GTK main loop until the file descriptor `context.fileno()` becomes ready. :param context: An `InputHookContext` instance. """ def _main_quit(*a, **kw): gtk.main_quit() return False gobject.io_add_watch(context.fileno(), gobject.IO_IN, _main_quit) gtk.main()
Example #2
Source File: grid.py From ntu-dsi-dcn with GNU General Public License v2.0 | 6 votes |
def run(self, graphic): window = gtk.Window() self.__window = window window.set_default_size(200, 200) vbox = gtk.VBox() window.add(vbox) render = GtkGraphicRenderer(graphic) self.__render = render vbox.pack_end(render, True, True, 0) hbox = gtk.HBox() vbox.pack_start(hbox, False, False, 0) smaller_zoom = gtk.Button("Zoom Out") smaller_zoom.connect("clicked", self.__set_smaller_cb) hbox.pack_start(smaller_zoom) bigger_zoom = gtk.Button("Zoom In") bigger_zoom.connect("clicked", self.__set_bigger_cb) hbox.pack_start(bigger_zoom) output_png = gtk.Button("Output Png") output_png.connect("clicked", self.__output_png_cb) hbox.pack_start(output_png) window.connect('destroy', gtk.main_quit) window.show_all() #gtk.bindings_activate(gtk.main_quit, 'q', 0) gtk.main()
Example #3
Source File: grid.py From IEEE-802.11ah-ns-3 with GNU General Public License v2.0 | 6 votes |
def run(self, graphic): window = gtk.Window() self.__window = window window.set_default_size(200, 200) vbox = gtk.VBox() window.add(vbox) render = GtkGraphicRenderer(graphic) self.__render = render vbox.pack_end(render, True, True, 0) hbox = gtk.HBox() vbox.pack_start(hbox, False, False, 0) smaller_zoom = gtk.Button("Zoom Out") smaller_zoom.connect("clicked", self.__set_smaller_cb) hbox.pack_start(smaller_zoom) bigger_zoom = gtk.Button("Zoom In") bigger_zoom.connect("clicked", self.__set_bigger_cb) hbox.pack_start(bigger_zoom) output_png = gtk.Button("Output Png") output_png.connect("clicked", self.__output_png_cb) hbox.pack_start(output_png) window.connect('destroy', gtk.main_quit) window.show_all() #gtk.bindings_activate(gtk.main_quit, 'q', 0) gtk.main()
Example #4
Source File: key_event_form.py From avocado-vt with GNU General Public License v2.0 | 6 votes |
def __init__(self): super(TestForm, self).__init__() self.set_title("Key test") self.set_size_request(200, 200) self.set_position(gtk.WIN_POS_CENTER) fixed = gtk.Fixed() entry = gtk.Entry() fixed.put(entry, 10, 10) entry.connect("key_press_event", self.on_key_press_event) self.connect("destroy", gtk.main_quit) self.add(fixed) self.show_all() # Clean the text file: input_file = open("/tmp/autotest-rv_input", "w") input_file.close()
Example #5
Source File: grid.py From 802.11ah-ns3 with GNU General Public License v2.0 | 6 votes |
def run(self, graphic): window = gtk.Window() self.__window = window window.set_default_size(200, 200) vbox = gtk.VBox() window.add(vbox) render = GtkGraphicRenderer(graphic) self.__render = render vbox.pack_end(render, True, True, 0) hbox = gtk.HBox() vbox.pack_start(hbox, False, False, 0) smaller_zoom = gtk.Button("Zoom Out") smaller_zoom.connect("clicked", self.__set_smaller_cb) hbox.pack_start(smaller_zoom) bigger_zoom = gtk.Button("Zoom In") bigger_zoom.connect("clicked", self.__set_bigger_cb) hbox.pack_start(bigger_zoom) output_png = gtk.Button("Output Png") output_png.connect("clicked", self.__output_png_cb) hbox.pack_start(output_png) window.connect('destroy', gtk.main_quit) window.show_all() #gtk.bindings_activate(gtk.main_quit, 'q', 0) gtk.main()
Example #6
Source File: gtkembed.py From Computable with MIT License | 6 votes |
def _hijack_gtk(self): """Hijack a few key functions in GTK for IPython integration. Modifies pyGTK's main and main_quit with a dummy so user code does not block IPython. This allows us to use %run to run arbitrary pygtk scripts from a long-lived IPython session, and when they attempt to start or stop Returns ------- The original functions that have been hijacked: - gtk.main - gtk.main_quit """ def dummy(*args, **kw): pass # save and trap main and main_quit from gtk orig_main, gtk.main = gtk.main, dummy orig_main_quit, gtk.main_quit = gtk.main_quit, dummy return orig_main, orig_main_quit
Example #7
Source File: grid.py From ns3-load-balance with GNU General Public License v2.0 | 6 votes |
def run(self, graphic): window = gtk.Window() self.__window = window window.set_default_size(200, 200) vbox = gtk.VBox() window.add(vbox) render = GtkGraphicRenderer(graphic) self.__render = render vbox.pack_end(render, True, True, 0) hbox = gtk.HBox() vbox.pack_start(hbox, False, False, 0) smaller_zoom = gtk.Button("Zoom Out") smaller_zoom.connect("clicked", self.__set_smaller_cb) hbox.pack_start(smaller_zoom) bigger_zoom = gtk.Button("Zoom In") bigger_zoom.connect("clicked", self.__set_bigger_cb) hbox.pack_start(bigger_zoom) output_png = gtk.Button("Output Png") output_png.connect("clicked", self.__output_png_cb) hbox.pack_start(output_png) window.connect('destroy', gtk.main_quit) window.show_all() #gtk.bindings_activate(gtk.main_quit, 'q', 0) gtk.main()
Example #8
Source File: grid.py From Tocino with GNU General Public License v2.0 | 6 votes |
def run(self, graphic): window = gtk.Window() self.__window = window window.set_default_size(200, 200) vbox = gtk.VBox() window.add(vbox) render = GtkGraphicRenderer(graphic) self.__render = render vbox.pack_end(render, True, True, 0) hbox = gtk.HBox() vbox.pack_start(hbox, False, False, 0) smaller_zoom = gtk.Button("Zoom Out") smaller_zoom.connect("clicked", self.__set_smaller_cb) hbox.pack_start(smaller_zoom) bigger_zoom = gtk.Button("Zoom In") bigger_zoom.connect("clicked", self.__set_bigger_cb) hbox.pack_start(bigger_zoom) output_png = gtk.Button("Output Png") output_png.connect("clicked", self.__output_png_cb) hbox.pack_start(output_png) window.connect('destroy', gtk.main_quit) window.show_all() #gtk.bindings_activate(gtk.main_quit, 'q', 0) gtk.main()
Example #9
Source File: grid.py From ns3-rdma with GNU General Public License v2.0 | 6 votes |
def run(self, graphic): window = gtk.Window() self.__window = window window.set_default_size(200, 200) vbox = gtk.VBox() window.add(vbox) render = GtkGraphicRenderer(graphic) self.__render = render vbox.pack_end(render, True, True, 0) hbox = gtk.HBox() vbox.pack_start(hbox, False, False, 0) smaller_zoom = gtk.Button("Zoom Out") smaller_zoom.connect("clicked", self.__set_smaller_cb) hbox.pack_start(smaller_zoom) bigger_zoom = gtk.Button("Zoom In") bigger_zoom.connect("clicked", self.__set_bigger_cb) hbox.pack_start(bigger_zoom) output_png = gtk.Button("Output Png") output_png.connect("clicked", self.__output_png_cb) hbox.pack_start(output_png) window.connect('destroy', gtk.main_quit) window.show_all() #gtk.bindings_activate(gtk.main_quit, 'q', 0) gtk.main()
Example #10
Source File: grid.py From ns3-ecn-sharp with GNU General Public License v2.0 | 6 votes |
def run(self, graphic): window = gtk.Window() self.__window = window window.set_default_size(200, 200) vbox = gtk.VBox() window.add(vbox) render = GtkGraphicRenderer(graphic) self.__render = render vbox.pack_end(render, True, True, 0) hbox = gtk.HBox() vbox.pack_start(hbox, False, False, 0) smaller_zoom = gtk.Button("Zoom Out") smaller_zoom.connect("clicked", self.__set_smaller_cb) hbox.pack_start(smaller_zoom) bigger_zoom = gtk.Button("Zoom In") bigger_zoom.connect("clicked", self.__set_bigger_cb) hbox.pack_start(bigger_zoom) output_png = gtk.Button("Output Png") output_png.connect("clicked", self.__output_png_cb) hbox.pack_start(output_png) window.connect('destroy', gtk.main_quit) window.show_all() #gtk.bindings_activate(gtk.main_quit, 'q', 0) gtk.main()
Example #11
Source File: recipe-577167.py From code with MIT License | 6 votes |
def on_request(view, frame, resource, request, response, resource_regexp, skip_regexp=None): """Check if requested resource matches the video resource_regexp regexp.""" url = request.get_uri() message = request.get_property("message") if not message: return method = message.get_property("method") if skip_regexp and skip_regexp.search(url): # cancel the request request.set_uri("about:blank") return debug("request: %s %s" % (method, url)) if resource_regexp and re.search(resource_regexp, url): debug("videofile match: %s" % url) print url gtk.main_quit()
Example #12
Source File: grid.py From CRE-NS3 with GNU General Public License v2.0 | 6 votes |
def run(self, graphic): window = gtk.Window() self.__window = window window.set_default_size(200, 200) vbox = gtk.VBox() window.add(vbox) render = GtkGraphicRenderer(graphic) self.__render = render vbox.pack_end(render, True, True, 0) hbox = gtk.HBox() vbox.pack_start(hbox, False, False, 0) smaller_zoom = gtk.Button("Zoom Out") smaller_zoom.connect("clicked", self.__set_smaller_cb) hbox.pack_start(smaller_zoom) bigger_zoom = gtk.Button("Zoom In") bigger_zoom.connect("clicked", self.__set_bigger_cb) hbox.pack_start(bigger_zoom) output_png = gtk.Button("Output Png") output_png.connect("clicked", self.__output_png_cb) hbox.pack_start(output_png) window.connect('destroy', gtk.main_quit) window.show_all() #gtk.bindings_activate(gtk.main_quit, 'q', 0) gtk.main()
Example #13
Source File: _gui_messages.py From gimp-plugin-export-layers with GNU General Public License v3.0 | 5 votes |
def _gui_excepthook_generic( exc_type, exc_value, exc_traceback, orig_sys_excepthook, title, app_name, parent, report_uri_list): callback_result = _gui_excepthook_additional_callback( exc_type, exc_value, exc_traceback) if callback_result: return orig_sys_excepthook(exc_type, exc_value, exc_traceback) if issubclass(exc_type, Exception): exception_message = "".join( traceback.format_exception(exc_type, exc_value, exc_traceback)) display_error_message( title=title, app_name=app_name, parent=parent, details=exception_message, report_uri_list=report_uri_list) # Make sure to quit the application since unhandled exceptions can # mess up the application state. if gtk.main_level() > 0: gtk.main_quit()
Example #14
Source File: main.py From gimp-plugin-export-layers with GNU General Public License v3.0 | 5 votes |
def _on_button_cancel_clicked(self, button): gtk.main_quit()
Example #15
Source File: core.py From ns3-ecn-sharp with GNU General Public License v2.0 | 5 votes |
def _quit(self, *dummy_args): if self._update_timeout_id is not None: gobject.source_remove(self._update_timeout_id) self._update_timeout_id = None self.simulation.quit = True self.simulation.go.set() self.simulation.join() gtk.main_quit()
Example #16
Source File: gtk-example-camera.py From SimpleCV2 with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self): super(app, self).__init__() self.set_position(gtk.WIN_POS_CENTER) self.set_title("Edge Threshold Adjuster") self.set_decorated(True) self.set_has_frame(False) self.set_resizable(False) self.set_default_size(self.window_width,self.window_height) self.connect("destroy", gtk.main_quit) vbox = gtk.VBox(spacing=4) #Setup the slider bar scale = gtk.HScale() scale.set_range(self.min_threshold, self.max_threshold) scale.set_size_request(500, 25) scale.set_value((self.max_threshold + self.min_threshold) / 2) scale.connect("value-changed", self.update_threshold) vbox.add(scale) #Setup the information label info = gtk.Label() info.set_label("Move the slider to adjust the edge detection threshold") vbox.add(info) #Add the image to the display new_image = self.process_image() converted_image = gtk.gdk.pixbuf_new_from_array(new_image, gtk.gdk.COLORSPACE_RGB, 8) image = gtk.Image() image.set_from_pixbuf(converted_image) image.show() vbox.add(image) gobject.timeout_add(self.refresh_rate, self.refresh) self.current_image = image self.add(vbox) self.show_all()
Example #17
Source File: goagent-gtk.py From arkc-client with GNU General Public License v2.0 | 5 votes |
def should_visible(): import ConfigParser ConfigParser.RawConfigParser.OPTCRE = re.compile(r'(?P<option>[^=\s][^=]*)\s*(?P<vi>[=])\s*(?P<value>.*)$') config = ConfigParser.ConfigParser() config.read(['proxy.ini', 'proxy.user.ini']) visible = config.has_option('listen', 'visible') and config.getint('listen', 'visible') return visible #gtk.main_quit = lambda: None #appindicator = None
Example #18
Source File: inspect.py From Emoji-Tools with GNU General Public License v3.0 | 5 votes |
def _delete_event(self, widget, event, data=None): gtk.main_quit() return False
Example #19
Source File: gladereactor.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def crash(self): gtk.main_quit()
Example #20
Source File: gtk2reactor.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def crash(self): import gtk # mainquit is deprecated in newer versions if hasattr(gtk, 'main_quit'): gtk.main_quit() else: gtk.mainquit()
Example #21
Source File: gtk2reactor.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def _our_mainquit(): # XXX: gtk.main_quit() (which is used for crash()) raises an exception if # gtk.main_level() == 0; however, all the tests freeze if we use this # function to stop the reactor. what gives? (I believe this may have been # a stupid mistake where I forgot to import gtk here... I will remove this # comment if the tests pass) import gtk if gtk.main_level(): gtk.main_quit()
Example #22
Source File: gladereactor.py From python-for-android with Apache License 2.0 | 5 votes |
def crash(self): gtk.main_quit()
Example #23
Source File: gtk2reactor.py From python-for-android with Apache License 2.0 | 5 votes |
def crash(self): selectreactor.SelectReactor.crash(self) import gtk # mainquit is deprecated in newer versions if gtk.main_level(): if hasattr(gtk, 'main_quit'): gtk.main_quit() else: gtk.mainquit()
Example #24
Source File: gtkbase.py From gui-o-matic with GNU Lesser General Public License v3.0 | 5 votes |
def _main_window_setup(self, _now=False): def create(self): wcfg = self.config['main_window'] window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.main_window = {'window': window} if wcfg.get('style', 'default') == 'default': self._main_window_default_style() else: raise NotImplementedError('We only have one style atm.') if wcfg.get('close_quits'): window.connect('delete-event', lambda w, e: gtk.main_quit()) else: window.connect('delete-event', lambda w, e: w.hide() or True) window.connect("destroy", lambda wid: gtk.main_quit()) window.set_title(self.config.get('app_name', 'gui-o-matic')) window.set_decorated(True) if wcfg.get('center', False): window.set_position(gtk.WIN_POS_CENTER) window.set_size_request( wcfg.get('width', 360), wcfg.get('height',360)) if wcfg.get('show'): window.show_all() if _now: create(self) else: gobject.idle_add(create, self)
Example #25
Source File: gtk2reactor.py From python-for-android with Apache License 2.0 | 5 votes |
def _our_mainquit(): # XXX: gtk.main_quit() (which is used for crash()) raises an exception if # gtk.main_level() == 0; however, all the tests freeze if we use this # function to stop the reactor. what gives? (I believe this may have been # a stupid mistake where I forgot to import gtk here... I will remove this # comment if the tests pass) import gtk if gtk.main_level(): gtk.main_quit()
Example #26
Source File: bluezchat.py From python-for-android with Apache License 2.0 | 5 votes |
def quit_button_clicked(self, widget): gtk.main_quit()
Example #27
Source File: core.py From CRE-NS3 with GNU General Public License v2.0 | 5 votes |
def _quit(self, *dummy_args): if self._update_timeout_id is not None: gobject.source_remove(self._update_timeout_id) self._update_timeout_id = None self.simulation.quit = True self.simulation.go.set() self.simulation.join() gtk.main_quit()
Example #28
Source File: terminator.py From NINJA-PingU with GNU General Public License v3.0 | 5 votes |
def deregister_window(self, window): """de-register a window widget""" dbg('Terminator::deregister_window: de-registering %s:%s' % (id(window), type(window))) if window in self.windows: self.windows.remove(window) else: err('%s is not in registered window list' % window) if len(self.windows) == 0: # We have no windows left, we should exit dbg('no windows remain, quitting') gtk.main_quit()
Example #29
Source File: xdot.py From openxenmanager with GNU General Public License v2.0 | 5 votes |
def on_key_press_event(self, widget, event): if event.keyval == gtk.keysyms.Left: self.x -= self.POS_INCREMENT/self.zoom_ratio self.queue_draw() return True if event.keyval == gtk.keysyms.Right: self.x += self.POS_INCREMENT/self.zoom_ratio self.queue_draw() return True if event.keyval == gtk.keysyms.Up: self.y -= self.POS_INCREMENT/self.zoom_ratio self.queue_draw() return True if event.keyval == gtk.keysyms.Down: self.y += self.POS_INCREMENT/self.zoom_ratio self.queue_draw() return True if event.keyval == gtk.keysyms.Page_Up: self.zoom_image(self.zoom_ratio * self.ZOOM_INCREMENT) self.queue_draw() return True if event.keyval == gtk.keysyms.Page_Down: self.zoom_image(self.zoom_ratio / self.ZOOM_INCREMENT) self.queue_draw() return True if event.keyval == gtk.keysyms.Escape: self.drag_action.abort() self.drag_action = NullAction(self) return True if event.keyval == gtk.keysyms.r: self.reload() return True if event.keyval == gtk.keysyms.q: gtk.main_quit() return True return False
Example #30
Source File: gui-gtk.py From filmkodi with Apache License 2.0 | 5 votes |
def destroy(widget, data=None): gtk.main_quit()