python类main_quit()的实例源码

id_photo.py 文件源码 项目:id_photo 作者: aeifn 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def apply_settings(self, widget, data=None):
    # ???????? ????, ???? ?? ??????
    self.window.hide()
    if self.white_bg_check.get_active():
      self.data['properties']['white_bg'] = True
    else:
      self.data['properties']['white_bg'] = False
    if self.auto_levels_check.get_active():
      self.data['properties']['auto_levels'] = True
    else:
      self.data['properties']['auto_levels'] = False
    self.data['properties']['resolution'] = int(self.resolution_cb.get_active_text())
    config = open(self.path, 'wb')
    json.dump(self.data, config, indent=3)
    config.close()
    gtk.main_quit()

  # ??? ??????? ???????????? ?????????????? ?????????? ???????
flashplayer.py 文件源码 项目:flashplayer-pygtk 作者: nanpuyue 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def main_window(type, title, width, height):
    if type == 'toplevel':
        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
    elif type == 'popup':
        window = gtk.Window(gtk.WINDOW_POPUP)

    window.set_position(gtk.WIN_POS_CENTER)
    window.connect('destroy', lambda x: gtk.main_quit())
    window.set_size_request(width, height)
    window.set_resizable(True)

    if title == False:
        window.set_decorated(False)
    else:
        window.set_title(title)

    return window
grid.py 文件源码 项目:ns3-rdma 作者: bobzhuyb 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
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()
Web-Window.py 文件源码 项目:Web-Stalker 作者: Dylan-halls 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def __init__(self):
      super(PyApp, self).__init__()
      self.set_title("Web Stalker Browser")
      self.set_size_request(1000,600)
      self.set_position(gtk.WIN_POS_CENTER)
      vbox = gtk.VBox(False, 5)
      scw = gtk.ScrolledWindow(None, None)
      web = webkit.WebView()

      url = sys.argv[1]
      web.open(url)
      scw.add(web)
      vbox.add(scw)

      gobject.threads_init()
      self.add(vbox)
      self.connect("destroy", gtk.main_quit)
      self.show_all()
tintwizard.py 文件源码 项目:tintwizard 作者: vanadey 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def quit(self, widget, event=None):
        """Asks if user would like to save file before quitting, then quits the program."""
        if self.toSave:
            if self.oneConfigFile:
                response = gtk.RESPONSE_YES
            else:
                dialog = gtk.Dialog("Save config?", self, gtk.DIALOG_MODAL, (gtk.STOCK_YES, gtk.RESPONSE_YES, gtk.STOCK_NO, gtk.RESPONSE_NO, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
                dialog.get_content_area().add(gtk.Label("Save config before quitting?"))
                dialog.get_content_area().set_size_request(300, 100)
                dialog.show_all()
                response = dialog.run()
                dialog.destroy()

            if response == gtk.RESPONSE_CANCEL:
                return True                         # Return True to stop it quitting when we hit "Cancel"
            elif response == gtk.RESPONSE_NO:
                gtk.main_quit()
            elif response == gtk.RESPONSE_YES:
                self.save()
                gtk.main_quit()
        else:
            gtk.main_quit()
gtkfeedline.py 文件源码 项目:pyttrss 作者: balanceofcowards 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def __init__(self, ttrss):
        self.ttrss = ttrss
        self.menu = gtk.Menu()
        quitter = gtk.ImageMenuItem(gtk.STOCK_QUIT)
        quitter.set_always_show_image(True)
        self.menu.append(quitter)
        quitter.show()
        quitter.connect("activate", gtk.main_quit)
        self.viewer = ArticleViewer()
        self.viewer.on_hide = self.update_articles
        self.status_icon = gtk.StatusIcon()
        self.status_icon.set_from_icon_name("mail-read")
        self.update_headlines()
        self.to = gtk.timeout_add(1000 * 60, self.update_headlines)
        self.status_icon.connect("activate", self.toggle_viewer)
        self.status_icon.connect("popup-menu", self.show_menu)
interface.py 文件源码 项目:projet_IA 作者: dogmotion 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def lienInAmelia():

     import gtk  
     import webkit  
     import gobject

     gobject.threads_init()  
     window = gtk.Window()
     window.set_default_size(1100, 680)
     window.connect("destroy", lambda a: gtk.main_quit()) 
     browser = webkit.WebView()  
     browser.open("http://alfred-ia.org/essaye-moi/")  
     window.add(browser)  
     window.show_all()  
     gtk.main()
view.py 文件源码 项目:robik 作者: RecunchoMaker 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def leave_app(self,widget=None,data=None):
        self.controller.camara_off()
        self.done = True
        self.win.destroy()
        gtk.main_quit()
view.py 文件源码 项目:robik 作者: RecunchoMaker 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def quit(self):
        self.done = True
        self.win.destroy()
        gtk.main_quit()
inspect.py 文件源码 项目:otRebuilder 作者: Pal3love 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def _delete_event(self, widget, event, data=None):
        gtk.main_quit()
        return False
id_photo.py 文件源码 项目:id_photo 作者: aeifn 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def compose_or_print(self, widget, data=None):
    # ???????? ????, ???? ?? ??????
    self.window.hide()
    gimp.context_push()
    # ????????? ?????? ?????????? UNDO
    self.image.undo_group_start()
    # ?????? ???????
    self.image.scale(self.mm_in_px(shelf['format']['width'], shelf['format']['resolution']), self.mm_in_px(shelf['format']['height'], shelf['format']['resolution']))
    if self.oval_check.get_active():
      self.oval(self.image, self.drawable)
    if self.gray_check.get_active():
      self.to_grayscale(self.image, self.drawable)
    if self.border_check.get_active():
      self.gray_frame(self.image)
    if self.angle_right_circular_radio.get_active():
      self.angle(self.image, self.drawable, 'right_circular')
    elif self.angle_left_circular_radio.get_active():
      self.angle(self.image, self.drawable, 'left_circular')
    elif self.angle_right_direct_radio.get_active():
      self.angle(self.image, self.drawable, 'right_direct')
    elif self.angle_left_direct_radio.get_active():
      self.angle(self.image, self.drawable, 'left_direct')
    copys = self.copys_spin.get_value_as_int()
    paper = self.paper_cb.get_active_text()
    if data == 'print_it':
      print_photo = True
    else:
      print_photo = False
    self.print_functon(self.image, self.drawable, paper, copys, print_photo)
    # ????????? ???????????? ?? ???????
    gimp.displays_flush()
    # ????????? ?????? ?????????? UNDO
    self.image.undo_group_end()
    gimp.context_pop()
    gtk.main_quit()

  # ??? ??????? ???????????? ?????????????? ????????
id_photo.py 文件源码 项目:id_photo 作者: aeifn 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def destroy(self, widget, data=None):
    gtk.main_quit()

#########################################################
#-------- ??? ? ?????? ?????, ? ??? ??????? ??????? ----#
#########################################################
recipe-334779.py 文件源码 项目:code 作者: ActiveState 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def quit(self, *args):
            self.win32ext.remove_notify_icon()
            gtk.main_quit()
flashplayer.py 文件源码 项目:flashplayer-pygtk 作者: nanpuyue 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def create_webview():
    webview = webkit.WebView()
    webview.connect('close-web-view', lambda x: gtk.main_quit())
    webview.connect("navigation-policy-decision-requested", script_action)
    settings = webview.get_settings()
    settings.set_property('enable_plugins', True)
    settings.set_property('enable-scripts', True)
    return webview
flashplayer.py 文件源码 项目:flashplayer-pygtk 作者: nanpuyue 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def save_screenshot(window, output):
    width, height = window.get_size()
    pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, width, height)
    screenshot = pixbuf.get_from_drawable(window.window, window.get_colormap(), 0, 0, 0, 0, width, height)
    screenshot.save(output, 'png')
    gtk.main_quit()
x11_xrdp.py 文件源码 项目:pub1ic_POC 作者: i1ikey0u 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def destroy(self, widget, data=None):
        if self.xww:
            os.system("kill {}".format(self.xww.pid + 1))
        gtk.main_quit()
play_holdem.py 文件源码 项目:learning-texas-holdem 作者: gjgregory 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def destroy(self, widget, data=None):
        gtk.main_quit()
gtk2reactor.py 文件源码 项目:hostapd-mana 作者: adde88 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
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()
gtk2reactor.py 文件源码 项目:hostapd-mana 作者: adde88 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def crash(self):
        import gtk
        # mainquit is deprecated in newer versions
        if hasattr(gtk, 'main_quit'):
            gtk.main_quit()
        else:
            gtk.mainquit()
gladereactor.py 文件源码 项目:hostapd-mana 作者: adde88 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def crash(self):
        gtk.main_quit()
core.py 文件源码 项目:ns3-rdma 作者: bobzhuyb 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
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()
GtkSpellCheckerDialog.py 文件源码 项目:Taigabot 作者: FrozenPigs 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def _test():
    from enchant.checker import SpellChecker
    text = "This is sme text with a fw speling errors in it. Here are a fw more to tst it ut."
    printf(["BEFORE:", text])
    chk_dlg = GtkSpellCheckerDialog()
    chk_dlg.show()
    chk_dlg.connect('delete_event', gtk.main_quit)

    chkr = SpellChecker("en_US",text)

    chk_dlg.setSpellChecker(chkr)
    chk_dlg.updateUI()
    gtk.main()
gtk_tray.py 文件源码 项目:Intranet-Penetration 作者: yuxiaokui 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def on_quit(self, widget, data=None):
        module_init.stop_all()
        os._exit(0)
        gtk.main_quit()
gtk_tray.py 文件源码 项目:MKFQ 作者: maojingios 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def on_quit(self, widget, data=None):
        module_init.stop_all()
        os._exit(0)
        gtk.main_quit()
inputhookgtk.py 文件源码 项目:leetcode 作者: thomasyimgit 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def _main_quit(*args, **kwargs):
    gtk.main_quit()
    return False
gtk.py 文件源码 项目:leetcode 作者: thomasyimgit 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
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()
Synchronous_execution.py 文件源码 项目:tools 作者: denglouping 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def destroy(self, widget, data=None):
        print "destroy"
        gtk.main_quit()
micropi.py 文件源码 项目:Micro-Pi 作者: Bottersnike 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def destroy(self, *args):
        if (not self.getModified()) or self.ask("There are unsaved files.\nContinue?"):
            self.active = False
            self.window.hide()
            kill = True
            for i in OPENWINDOWS:
                if i.active:
                    kill = False
            OPENWINDOWS.remove(self)
            if kill:
                gtk.main_quit()
            return False
        return True
micropi.py 文件源码 项目:Micro-Pi 作者: Bottersnike 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def destroy(self, *args):
        if not self.indep:
            self.window.hide()
            self.shown = False
            return True
        else:
            self.window.destroy()
            gtk.main_quit()
lodgeit.py 文件源码 项目:yt 作者: yt-project 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def copy_url(url):
    """Copy the url into the clipboard."""
    # try windows first
    try:
        import win32clipboard
    except ImportError:
        # then give pbcopy a try.  do that before gtk because
        # gtk might be installed on os x but nobody is interested
        # in the X11 clipboard there.
        from subprocess import Popen, PIPE
        try:
            client = Popen(['pbcopy'], stdin=PIPE)
        except OSError:
            try:
                import pygtk
                pygtk.require('2.0')
                import gtk
                import gobject
            except ImportError:
                return
            gtk.clipboard_get(gtk.gdk.SELECTION_CLIPBOARD).set_text(url)
            gobject.idle_add(gtk.main_quit)
            gtk.main()
        else:
            client.stdin.write(url)
            client.stdin.close()
            client.wait()
    else:
        win32clipboard.OpenClipboard()
        win32clipboard.EmptyClipboard()
        win32clipboard.SetClipboardText(url)
        win32clipboard.CloseClipboard()


问题


面经


文章

微信
公众号

扫码关注公众号