本文整理汇总了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()