コード例 #1
0
	def on_switch1_changed(self,widget,data):
		if self.switch1.get_active():
			if os.path.exists(comun.TOKEN_FILE):
				os.remove(comun.TOKEN_FILE)
		else:
			googlecalendar = GoogleCalendar(token_file = comun.TOKEN_FILE)
			if googlecalendar.do_refresh_authorization() is None:
				authorize_url = googlecalendar.get_authorize_url()
				ld = LoginDialog(authorize_url)
				ld.run()
				googlecalendar.get_authorization(ld.code)
				ld.destroy()				
				if googlecalendar.do_refresh_authorization() is None:
					md = Gtk.MessageDialog(	parent = self,
											flags = Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
											type = Gtk.MessageType.ERROR,
											buttons = Gtk.ButtonsType.OK_CANCEL,
											message_format = _('You have to authorize Calendar-Indicator to use it, do you want to authorize?'))
					if md.run() == Gtk.ResponseType.CANCEL:
						exit(3)				
				else:
					if googlecalendar.do_refresh_authorization() is None:
						exit(3)
			self.switch1.set_active(True)
			self.store.clear()
			for calendar in googlecalendar.get_calendars().values():
				self.store.append([calendar['summary'],tohex(random.randint(0, 16777215)),tohex(random.randint(0, 16777215)),calendar['id'],True,calendar['summary']])
コード例 #2
0
ファイル: base.py プロジェクト: BackupTheBerlios/codehack-svn
def run():
    # Set default icon
    _set_default_icon()
    
    # Show Login dialog
    l = LoginDialog(logged_in)
    l.widget.show_all()
    l.setStatus('Ready')
    reactor.run()
コード例 #3
0
ファイル: preferences_dialog.py プロジェクト: atareao/utext
 def on_drive_activate(self, widget, active):
     print(self.switch52.get_active(), active)
     if self.switch52.get_active():
         ds = DriveService(comun.TOKEN_FILE_DRIVE)
         authorize_url = ds.get_authorize_url()
         ld = LoginDialog(1024, 600, authorize_url, isgoogle=True)
         ld.run()
         temp_oauth_token = ld.code
         uid = ld.uid
         ld.destroy()
         if temp_oauth_token is not None:
             print(ds.get_authorization(temp_oauth_token))
         if not os.path.exists(comun.TOKEN_FILE_DRIVE):
             self.switch52.set_active(False)
     else:
         if os.path.exists(comun.TOKEN_FILE_DRIVE):
             os.remove(comun.TOKEN_FILE_DRIVE)
コード例 #4
0
	def on_switch1_changed(self,widget,data):
		if self.switch1.get_active():
			if os.path.exists(comun.TOKEN_FILE):
				os.remove(comun.TOKEN_FILE)
		else:
			gta = GTAService(token_file = comun.TOKEN_FILE)
			if gta.do_refresh_authorization() is None:
				authorize_url = gta.get_authorize_url()
				ld = LoginDialog(authorize_url)
				ld.run()
				gta.get_authorization(ld.code)
				ld.destroy()				
				if gta.do_refresh_authorization() is None:
					md = Gtk.MessageDialog(	parent = self,
											flags = Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
											type = Gtk.MessageType.ERROR,
											buttons = Gtk.ButtonsType.OK_CANCEL,
											message_format = _('You have to authorize Google-Task-Indicator to use it, do you want to authorize?'))
					if md.run() == Gtk.ResponseType.CANCEL:
						exit(3)				
				else:
					if gta.do_refresh_authorization() is None:
						exit(3)
			self.switch1.set_active(True)
			self.liststore.clear()
			self.liststore.append([_('All'),None])
			for tasklist in gta.get_tasklists().values():
				self.liststore.append([tasklist['title'],tasklist['id']])
			self.entry2.set_active(0)	
コード例 #5
0
ファイル: preferences_dialog.py プロジェクト: atareao/utext
 def on_dropbox_activate(self, widget, active):
     print(self.switch51.get_active(), active)
     if self.switch51.get_active():
         ds = DropboxService(comun.TOKEN_FILE)
         oauth_token, oauth_token_secret = ds.get_request_token()
         authorize_url = ds.get_authorize_url(
             oauth_token, oauth_token_secret)
         ld = LoginDialog(1024, 600, authorize_url, isgoogle=False)
         ld.run()
         oauth_token = ld.code
         uid = ld.uid
         ld.destroy()
         if oauth_token is not None:
             print(oauth_token, uid)
             ans = ds.get_access_token(oauth_token, oauth_token_secret)
             print(ans)
             print(ds.get_account_info())
         if not os.path.exists(comun.TOKEN_FILE):
             self.switch51.set_active(False)
     else:
         if os.path.exists(comun.TOKEN_FILE):
             os.remove(comun.TOKEN_FILE)
コード例 #6
0
ファイル: gerrit_notify.py プロジェクト: myhrman/gerritnotify
def main():
    config = parse_config()

    signal.signal(signal.SIGINT, signal.SIG_DFL)
    indicator = appindicator.Indicator.new(APPINDICATOR_ID, 'gerrit.png', appindicator.IndicatorCategory.SYSTEM_SERVICES)
    indicator.set_status(appindicator.IndicatorStatus.ACTIVE)
    
    menu = gtk.Menu()
    menu.config = config
    menu.indicator = indicator
    menu.update_timer = None

    build_menu(menu)
    indicator.set_menu(menu)

    win = LoginDialog(
            title="Login to gerrit",
            username=USERNAME,
            callback=handle_login)
    win.show_all()

    gtk.main()
コード例 #7
0
 def _getUserAndPassword(self, user, password):
     """ Получаем логин и пароль через соответствующий диалог """
     d = LoginDialog(user, password, self)
     if d.exec_() == QDialog.Accepted:
         settings.setUser(d.login())
         if d.storePassword():
             settings.setPassword(d.password())
         return (True, d.login(), d.password())
     else:
         return (False, '', '')
コード例 #8
0
ファイル: preferences.py プロジェクト: nivir/Picapy
 def on_entry1_activate(self, widget, status):
     pi = Picasa(token_file=comun.TOKEN_FILE)
     if self.entry1.get_active():
         if pi.do_refresh_authorization() is None:
             authorize_url = pi.get_authorize_url()
             ld = LoginDialog(authorize_url)
             ld.run()
             pi.get_authorization(ld.code)
             ld.destroy()
     else:
         pi.revoke_authorization()
     self.entry1.set_active(pi.do_refresh_authorization() is not None)
コード例 #9
0
 def on_switch1_changed(self, widget, data):
     if self.switch1.get_active():
         if os.path.exists(comun.TOKEN_FILE):
             os.remove(comun.TOKEN_FILE)
     else:
         googlecalendar = GoogleCalendar(token_file=comun.TOKEN_FILE)
         if googlecalendar.do_refresh_authorization() is None:
             authorize_url = googlecalendar.get_authorize_url()
             ld = LoginDialog(authorize_url)
             ld.run()
             googlecalendar.get_authorization(ld.code)
             ld.destroy()
             if googlecalendar.do_refresh_authorization() is None:
                 md = Gtk.MessageDialog(
                     parent=self,
                     flags=Gtk.DialogFlags.MODAL
                     | Gtk.DialogFlags.DESTROY_WITH_PARENT,
                     type=Gtk.MessageType.ERROR,
                     buttons=Gtk.ButtonsType.OK_CANCEL,
                     message_format=
                     _('You have to authorize Calendar-Indicator to use it, do you want to authorize?'
                       ))
                 if md.run() == Gtk.ResponseType.CANCEL:
                     exit(3)
             else:
                 if googlecalendar.do_refresh_authorization() is None:
                     exit(3)
         self.switch1.set_active(True)
         self.store.clear()
         for calendar in googlecalendar.get_calendars().values():
             self.store.append([
                 calendar['summary'],
                 tohex(random.randint(0, 16777215)),
                 tohex(random.randint(0, 16777215)), calendar['id'], True,
                 calendar['summary']
             ])
コード例 #10
0
ファイル: driveapi.py プロジェクト: atareao/utext
        for afile in ds.get_files():
            pprint(afile)
        pprint(ds.get_file('0B3WiYW6nOxJDdVNRNERlcmRwanM'))
        pprint(ds.update_file('0B3WiYW6nOxJDdVNRNERlcmRwanM','20130512.md', 'jejejjejej'))
        '''
        afilee = codecs.open('/home/lorenzo/CloudStation/Articulos/201305/20130512.md', 'r', 'utf-8')
        data = afilee.read()
        afilee.close()
        pprint(ds.put_file('otra_prueba', data))
        '''
        ans = ds.put_file(
            'esto_es_una_prueba', 'Esto es una prueba de funcionamiento')
        pprint(ans)
    else:
        print('======================= 1 =============================')
        authorize_url = ds.get_authorize_url()
        ld = LoginDialog(1024, 600, authorize_url, isgoogle=True)
        ld.run()
        temp_oauth_token = ld.code
        uid = ld.uid
        ld.destroy()
        if temp_oauth_token is not None:
            print(ds.get_authorization(temp_oauth_token))

    '''
    print(ds.get_account_info())
    print(ds.get_file('data'))
    print(ds.put_file('/home/atareao/Escritorio/data'))
    '''
    exit(0)
コード例 #11
0
import sys
from PyQt5.Qt import *
from logindialog import LoginDialog
from mainwindow import MainWindow

import helper


if __name__ == '__main__':
    app = QApplication(sys.argv)
    helper.dbConnect()

    loginDialog = LoginDialog()

    isAuth = False
    result = -1
    while not isAuth:
        result = loginDialog.exec_()
        if result == LoginDialog.Success or LoginDialog.Rejected:
            isAuth = True
        else:
            isAuth = False

    if result == LoginDialog.Success:
        w = MainWindow()
        w.show()
        app.exec_()

    sys.exit(-1)

コード例 #12
0
                                         data,
                                         params,
                                         first=False)
        return None


if __name__ == '__main__':
    import random
    import time
    nonce = random.randint(1000000, 10000000)
    timestamp = time.time()
    print(time.time())
    print(nonce)

    uo = UbuntuOne('token')
    authorize_url = uo.get_authorize_url()
    print(authorize_url)
    ld = LoginDialog(authorize_url)
    ld.run()
    #pi.get_authorization(ld.code)
    ld.destroy()

    uo.arq(
        'POST',
        'https://one.ubuntu.com/oauth/request/',
        None,
        data=
        "realm='', oauth_version='1.0', oauth_nonce='%s', oauth_timestamp='%s', oauth_consumer_key='ubuntuone', oauth_signature_method='PLAINTEXT', oauth_signature='hammertime'"
        % (nonce, timestamp))
    exit(0)
コード例 #13
0
ファイル: mainwindow.py プロジェクト: oswaldasmith/tas
 def login(self):
     dialog = LoginDialog()
     dialog.show()
コード例 #14
0
ファイル: main.py プロジェクト: bmweller/CrossPlatformQt
import sys
from PySide.QtGui import QApplication
from logindialog import LoginDialog
from mainwindow import MainWindow
import helper

if __name__ == "__main__":
    a = QApplication(sys.argv)
    helper.dbConnect()

    loginDialog = LoginDialog()

    isAuth = False
    result = -1
    while not isAuth:
        result = loginDialog.exec_()
        if result == LoginDialog.Success or result == LoginDialog.Rejected:
            isAuth = True
        else:
            isAuth = False

    if result == LoginDialog.Success:
        w = MainWindow()
        w.show()
        a.exec_()

    sys.exit(-1)
コード例 #15
0
ファイル: mainwindow.py プロジェクト: oswaldasmith/tas
 def login(self):
     dialog = LoginDialog()
     dialog.show()
コード例 #16
0
ファイル: tas.py プロジェクト: oswaldasmith/tas
__author__ = 'Oswald A Smith'
__title__ = 'tas'
__version__ = '1.0'
__license__ = 'MIT'
__copyright__ = '2014 Oswald A Smith'


import sys
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from logindialog import LoginDialog
from mainwindow import MainWindow





if __name__ == '__main__':
    app = QApplication(sys.argv)
    login_dialog = LoginDialog()
    login_dialog.show()

    main_window = MainWindow()
    main_window.show()
    app.exec_()