當前位置: 首頁>>代碼示例>>Python>>正文


Python Session.remove方法代碼示例

本文整理匯總了Python中Session.Session.remove方法的典型用法代碼示例。如果您正苦於以下問題:Python Session.remove方法的具體用法?Python Session.remove怎麽用?Python Session.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Session.Session的用法示例。


在下文中一共展示了Session.remove方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: AuthDialog

# 需要導入模塊: from Session import Session [as 別名]
# 或者: from Session.Session import remove [as 別名]

#.........這裏部分代碼省略.........
        self.__tbState__ = gtk.Entry()
        self.__tbState__.set_editable(False)
        
        self.__btAuthentication__ = gtk.Button()
        self.__btAuthentication__.connect("activate", self.__loginEvent__)
        self.__btAuthentication__.connect("clicked", self.__loginEvent__)
        
        self.__btRevoke__ = gtk.Button(label=self.__trans__("Revoke"))
        self.__btRevoke__.connect("activate", self.__revokeEvent__)
        self.__btRevoke__.connect("clicked", self.__revokeEvent__)
        
        tData = gtk.Table(rows=3, columns=2)
        
        tData.attach(gtk.Label(self.__trans__("Username")), 0, 1, 0, 1, xoptions=0, yoptions=0, xpadding=1, ypadding=1)
        tData.attach(self.__tbUserName__, 1, 2, 0, 1, xoptions=gtk.EXPAND | gtk.FILL, yoptions=0, xpadding=1, ypadding=1)
        
        tData.attach(gtk.Label(self.__trans__("State")), 0, 1, 1, 2, xoptions=0, yoptions=0, xpadding=1, ypadding=1)
        tData.attach(self.__tbState__, 1, 2, 1, 2, xoptions=gtk.EXPAND | gtk.FILL, yoptions=0, xpadding=1, ypadding=1)
        
        self.__imgLogin__ = gtk.Image()
        self.__imgLogin__.set_from_file(os.path.join(__ICONS_FOLDER__, "picasaweblogo.gif"))
        
        hbButton = gtk.HBox()
        # hbButton.pack_start(self.__imgLogin__, False, False)
        self.__btAuthentication__.set_image(self.__imgLogin__)
        hbButton.pack_start(self.__btAuthentication__, False, False)
        hbButton.pack_start(self.__btRevoke__, False, False)
        hAlign = gtk.Alignment(xalign=1, yalign=0.5)
        hAlign.add(hbButton)
        
        
        tData.attach(hAlign, 1, 2, 2, 3, xoptions=gtk.EXPAND | gtk.FILL, yoptions=gtk.FILL, xpadding=0, ypadding=0)
        
        vBox = gtk.VBox()
        vBox.pack_start(tData, True, True)
        
        self.get_child().pack_start(vBox, True, True)
        vBox.show_all()

    def __initData__(self, gtkLock=False):
        """
        @summary: Set data to dialog.
        """
        if (self.__session__.isLogged()):
            self.__tbState__.set_text(self.__trans__("Authenticated"))
            self.__tbUserName__.set_text(self.__session__.getUsername())
        else:
            self.__tbState__.set_text(self.__trans__("No Authenticated"))
            self.__tbUserName__.set_text("")
    
    def __loginEvent__(self, b):
        """
        @summary: Process login event.
        @param b: Action associated with event.
        """
        doLogin = True
        if (self.__session__.isLogged()):
            doLogin = FactoryControls.getConfirmMessage(self.__trans__("You are signed up Google\nDo you like change current user of Google?"),
                                                          title=self.__trans__("Google Sign In"), parent=self, gtkLock=False,
                                                          returnBoolean=True)
        self.__session__.login(parent=self, forceLogin=doLogin)
    
    def __revokeEvent__(self, b):
        """
        @summary: Process to revoke or remove previous login
        @param b: Action associated with event. 
        """
        if (FactoryControls.getConfirmMessage(self.__trans__("Do you like remove stored user of Google?"),
                                              title=self.__trans__("Google remove"), parent=self, gtkLock=False,
                                              returnBoolean=True)):
            self.__session__.remove()
            self.__initData__()
        
    
    def __closeEvent__(self, w, res):
        """
        @summary: Handle response about plugins dialog.
        @param w: GtkDialog associated.
        @param res: Response associated with the event.  
        """
        if (res == gtk.RESPONSE_OK):
            if (self.__callback__ != None):
                self.__callback__()
           
        w.hide() 

    def setCallback(self, callback):
        """
        @summary: Set callback to execute when confirm configuracion.
        @param callback: Function reference. 
        @note: callback model: callback (dialog: gtk.Dialog)        
        """
        self.__callback__ = callback

    def run(self):
        """
        @summary: Show option  dialog.
        """
        self.__initData__()
        super(AuthDialog, self).run()
開發者ID:babytux,項目名稱:PyCamimg,代碼行數:104,代碼來源:AuthDialog.py


注:本文中的Session.Session.remove方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。