class Widget(QtGui.QWidget, ScreenWidget): title = ki18n("Bug Reporting Tool") desc = ki18n("Credentials Screen") def __init__(self, *args): QtGui.QWidget.__init__(self,None) self.ui = Ui_bugWidget() self.ui.setupUi(self) QObject.connect(self.ui.logoutButton, SIGNAL("clicked()"), self.logout) self.bugzilla = Bugz(BUGZILLA_URL) cj = CookiePot().make_lwp_cookiejar(self.bugzilla.cookiejar.filename, #'bugs.pardus.org.tr') 'landfill.bugzilla.org') self.bugzilla.cookiejar = cj self.bugzilla.opener = build_opener(HTTPCookieProcessor(cj)) self.is_logged_in = False def logout(self): self.bugzilla.authenticated = False self.bugzilla.opener.open(LOGOUT_URL).read() self.shown() def shown(self): if self.bugzilla.try_auth(): self.is_logged_in = True self.ui.logoutButton.setVisible(True) self.ui.logoutText.setVisible(True) self.ui.username.setEnabled(False) self.ui.password.setEnabled(False) else: self.is_logged_in = False self.ui.logoutButton.setVisible(False) self.ui.logoutText.setVisible(False) self.ui.username.setEnabled(True) self.ui.password.setEnabled(True) pass def execute(self): if not self.is_logged_in: if len(self.ui.password.text()) == 0 or\ len(self.ui.username.text()) == 0: return False else: self.bugzilla.user = self.ui.username.text() self.bugzilla.password = self.ui.password.text() try: self.bugzilla.auth() except RuntimeError: print 'Invalid user/pass pair!' return False self.shared['bugzilla'] = self.bugzilla return True @property def shared(self): return self.parent().parent().parent().shared_data
class Widget(QtGui.QWidget, ScreenWidget): title = ki18n("Bug Reporting Tool") desc = ki18n("Credentials Screen") def __init__(self, *args): QtGui.QWidget.__init__(self, None) self.ui = Ui_bugWidget() self.ui.setupUi(self) QObject.connect(self.ui.logoutButton, SIGNAL("clicked()"), self.logout) self.bugzilla = Bugz(BUGZILLA_URL) cj = CookiePot().make_lwp_cookiejar( self.bugzilla.cookiejar.filename, #'bugs.pardus.org.tr') 'landfill.bugzilla.org') self.bugzilla.cookiejar = cj self.bugzilla.opener = build_opener(HTTPCookieProcessor(cj)) self.is_logged_in = False def logout(self): self.bugzilla.authenticated = False self.bugzilla.opener.open(LOGOUT_URL).read() self.shown() def shown(self): if self.bugzilla.try_auth(): self.is_logged_in = True self.ui.logoutButton.setVisible(True) self.ui.logoutText.setVisible(True) self.ui.username.setEnabled(False) self.ui.password.setEnabled(False) else: self.is_logged_in = False self.ui.logoutButton.setVisible(False) self.ui.logoutText.setVisible(False) self.ui.username.setEnabled(True) self.ui.password.setEnabled(True) pass def execute(self): if not self.is_logged_in: if len(self.ui.password.text()) == 0 or\ len(self.ui.username.text()) == 0: return False else: self.bugzilla.user = self.ui.username.text() self.bugzilla.password = self.ui.password.text() try: self.bugzilla.auth() except RuntimeError: print 'Invalid user/pass pair!' return False self.shared['bugzilla'] = self.bugzilla return True @property def shared(self): return self.parent().parent().parent().shared_data
def __init__(self, *args): QtGui.QWidget.__init__(self, None) self.ui = Ui_bugWidget() self.ui.setupUi(self) QObject.connect(self.ui.logoutButton, SIGNAL("clicked()"), self.logout) self.bugzilla = Bugz(BUGZILLA_URL) cj = CookiePot().make_lwp_cookiejar( self.bugzilla.cookiejar.filename, #'bugs.pardus.org.tr') 'landfill.bugzilla.org') self.bugzilla.cookiejar = cj self.bugzilla.opener = build_opener(HTTPCookieProcessor(cj)) self.is_logged_in = False
def __init__(self, *args): QtGui.QWidget.__init__(self,None) self.ui = Ui_bugWidget() self.ui.setupUi(self) QObject.connect(self.ui.logoutButton, SIGNAL("clicked()"), self.logout) self.bugzilla = Bugz(BUGZILLA_URL) cj = CookiePot().make_lwp_cookiejar(self.bugzilla.cookiejar.filename, #'bugs.pardus.org.tr') 'landfill.bugzilla.org') self.bugzilla.cookiejar = cj self.bugzilla.opener = build_opener(HTTPCookieProcessor(cj)) self.is_logged_in = False