Exemple #1
0
	def startAuthenticationProcess(self):
		self.settingsDialog.group_account.widget_authorize.button_authenticate.setEnabled(False)
		self.flow = dropbox.oauth.DropboxOAuth2FlowNoRedirect('sfacmqvdb9dn66r', 'hx8meda636xgsox')
		authorize_url = QUrl(self.flow.start())
		QDesktopServices.openUrl(authorize_url)
		try:
			code = raw_input("Enter the authorization code from the dropbox website:")
		except NameError:
			code = input("Enter the authorization code from the dropbox website:")
		if code:
			try:
				oauth2_result = self.flow.finish(code)
				self.access_token = oauth2_result.access_token
				self.client = dropbox.Dropbox(self.access_token)
				account = self.client.users_get_current_account()
				self.user_id = account.account_id
				self.display_name = account.name.display_name
			except dropbox.auth.AccessError:
				if "win" in sys.platform: #Workaround for crash on windows
					self.parentWidget.hide()
					self.settingsDialog.hide()
				QMessageBox.critical(self.settingsDialog, "Failed to authenticate", "Failed to authenticate with Dropbox. Wrong code?")
				if "win" in sys.platform:
					self.settingsDialog.show()
					self.parentWidget.show()
		self.saveSettings()
		self.updateUi()
Exemple #2
0
    def startAuthenticationProcess(self):
        self.settingsDialog.group_account.widget_authorize.button_authenticate.setEnabled(
            False)
        authorize_url = QUrl(
            self.client.auth_provider.get_auth_url(REDIRECT_URI))
        QDesktopServices.openUrl(authorize_url)
        try:
            code = raw_input(
                "Copy everything in the address bar after \"code=\", and paste it below:"
            )
        except NameError:
            code = input(
                "Copy everything in the address bar after \"code=\", and paste it below:"
            )
        if code:
            try:
                self.client.auth_provider.authenticate(code, REDIRECT_URI,
                                                       None)
            except:
                if "win" in sys.platform:  #Workaround for crash on windows
                    self.parentWidget.hide()
                    self.settingsDialog.hide()
                QMessageBox.critical(
                    self.settingsDialog, "Failed to authenticate",
                    "Failed to authenticate with OneDrive. Wrong code?")
                if "win" in sys.platform:
                    self.settingsDialog.show()
                    self.parentWidget.show()

        #Set display name
        self.displayName = self.client.drive.get().owner.user.display_name
        self.loggedIn = True

        self.saveSettings()
        self.updateUi()
Exemple #3
0
 def startAuthenticationProcess(self):
     self.settingsDialog.group_account.widget_authorize.button_authenticate.setEnabled(
         False)
     self.flow = dropbox.client.DropboxOAuth2FlowNoRedirect(
         'sfacmqvdb9dn66r', 'hx8meda636xgsox')
     authorize_url = QUrl(self.flow.start())
     QDesktopServices.openUrl(authorize_url)
     code = raw_input(
         "Enter the authorization code from the dropbox website:")
     if code:
         try:
             self.access_token, self.user_id = self.flow.finish(code)
             self.client = dropbox.client.DropboxClient(self.access_token)
             self.display_name = self.client.account_info()['display_name']
         except dropbox.rest.ErrorResponse:
             if "win" in sys.platform:  #Workaround for crash on windows
                 self.parentWidget.hide()
                 self.settingsDialog.hide()
             QMessageBox.critical(
                 self.settingsDialog, "Failed to authenticate",
                 "Failed to authenticate with Dropbox. Wrong code?")
             if "win" in sys.platform:
                 self.settingsDialog.show()
                 self.parentWidget.show()
     self.saveSettings()
     self.updateUi()
 def SearchFinished():
     data = json.loads(str(reply.readAll()))
     feed = data["feed"]
     try:
         print feed["entry"][0]["media$group"]["media$player"][0]["url"]
         youtube_url = feed["entry"][0]["media$group"]["media$player"][0]["url"]
         QDesktopServices.openUrl(QUrl.fromEncoded(str(youtube_url)))
     except Exception, e:
         print e
 def SearchFinished():
   data = json.loads(str(reply.readAll()))
   feed = data['feed']
   try:
     print feed['entry'][0]['media$group']['media$player'][0]['url']
     youtube_url = feed['entry'][0]['media$group']['media$player'][0]['url']
     QDesktopServices.openUrl(QUrl.fromEncoded(str(youtube_url)))
   except Exception, e:
     print e
	def startAuthenticationProcess(self):
		self.saveSettings()
		self.loadSettings()
		self.settingsDialog.group_account.button_authenticate.setEnabled(False)
		self.settingsDialog.group_account.label_code.setEnabled(True)
		self.settingsDialog.group_account.input_code.setEnabled(True)
		self.settingsDialog.group_account.button_code.setEnabled(True)
		auth_url = self.imgur.authorization_url('pin')
		QDesktopServices.openUrl(QUrl(auth_url))
		self.settingsDialog.group_account.button_code.connect("clicked()", self.pinEntered)
 def startAuthenticationProcess(self):
     self.settingsDialog.group_account.widget_authenticate.button_authenticate.setEnabled(False)
     self.settingsDialog.group_account.widget_authenticate.label_code.setEnabled(True)
     self.settingsDialog.group_account.widget_authenticate.input_code.setEnabled(True)
     self.settingsDialog.group_account.widget_authenticate.button_code.setEnabled(True)
     self.flow = dropbox.client.DropboxOAuth2FlowNoRedirect("sfacmqvdb9dn66r", "hx8meda636xgsox")
     authorize_url = QUrl(self.flow.start())
     QDesktopServices.openUrl(authorize_url)
     self.settingsDialog.group_account.widget_authenticate.button_code.connect(
         "clicked()", self.authorizationCodeEntered
     )
Exemple #8
0
 def updateReply(self, reply):
     version = loads(reply.readAll().data().decode('utf-8'))["version"]
     if version != self.version:
         x = QDialog()
         x.setAttribute(Qt.WA_DeleteOnClose)
         _x = QMessageBox.question(
             x, "{} v{} by {}".format(self.name, self.version, self.author),
             "Noua versiune v{} la linksteam a fost gasita, dai update acum?"
             .format(version), QMessageBox.Yes, QMessageBox.No)
         if _x == QMessageBox.Yes:
             QDesktopServices.openUrl(QUrl(self.repourl))
Exemple #9
0
 def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID):
     try:
         url = ""
         if atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CLIENT:
             if menuItemID == 1:  # Nickname (TSViewer)
                 url = "http://www.tsviewer.com/index.php?page=search&action=ausgabe_user&nickname=%%CLIENT_NAME_PERCENT_ENCODED%%"
             elif menuItemID == 2:  # Nickname (GameTracker)
                 url = "http://www.gametracker.com/search/?search_by=online_offline_player&query=%%CLIENT_NAME_PERCENT_ENCODED%%"
             elif menuItemID == 3:  # Nickname (TS3Index)
                 url = "http://ts3index.com/?page=searchclient&nickname=%%CLIENT_NAME_PERCENT_ENCODED%%"
             elif menuItemID == 4:  # Nickname (Google)
                 url = "https://www.google.com/search?q=%%CLIENT_NAME_PERCENT_ENCODED%%"
             elif menuItemID == 5:  # Profil (GameTracker)
                 url = "http://www.gametracker.com/search/?search_by=profile_username&query=%%CLIENT_NAME_PERCENT_ENCODED%%"
             elif menuItemID == 6:  # UID (TS3Index)
                 url = "http://ts3index.com/?page=searchclient&uid=%%CLIENT_UNIQUE_ID%%"
             elif menuItemID == 7:  # UID (Google)
                 url = "https://www.google.com/search?q=%%CLIENT_UNIQUE_ID%%"
             elif menuItemID == 8:  # Besitzer (TSViewer)
                 url = "http://www.tsviewer.com/index.php?page=search&action=ausgabe&suchbereich=ansprechpartner&suchinhalt=%%CLIENT_NAME_PERCENT_ENCODED%%"
             elif menuItemID == 9:  # Badges (TS3Index)
                 url = "https://ts3index.com/?page=searchclient&badges=%%CLIENT_BADGES%%"
             else:
                 return
             # payload = {'username':'******', 'password':'******'}
             # nickname_encoded = urlencode(nickname, quote_via=quote_plus)
             # nickname_encoded = nickname_encoded.replace("+", "%2B").replace("/", "%2F").replace("=", "%3D")
             if "%%CLIENT_NAME_PERCENT_ENCODED%%" in url:
                 (err, nickname) = ts3lib.getClientVariable(
                     schid, selectedItemID,
                     ts3defines.ClientProperties.CLIENT_NICKNAME)
                 url = url.replace("%%CLIENT_NAME_PERCENT_ENCODED%%",
                                   quote_plus(nickname))
             if "%%CLIENT_UNIQUE_ID%%" in url:
                 (err, uid) = ts3lib.getClientVariable(
                     schid, selectedItemID,
                     ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
                 url = url.replace("%%CLIENT_UNIQUE_ID%%", quote_plus(uid))
             if "%%CLIENT_BADGES%%" in url:
                 (err, badges) = ts3lib.getClientVariable(
                     schid, selectedItemID,
                     ts3defines.ClientPropertiesRare.CLIENT_BADGES)
                 url = url.replace("%%CLIENT_BADGES%%", badges)
         else:
             return
         if PluginHost.cfg.getboolean("general", "verbose"):
             ts3lib.printMessageToCurrentTab(
                 "Opening URL: \"{}\"".format(url))
         QDesktopServices.openUrl(QUrl(url))
     except:
         ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR,
                           "pyTSon", 0)
Exemple #10
0
 def __init__(self):
     if isfile(self.bin):
         self.yatqa = QProcess()
         self.yatqa.setProgram(self.bin)
     else:
         msgBox(
             "Cannot find YatQA!\nPlease make sure it's installed at\n\n\"{}\""
             .format(self.bin))
         QDesktopServices.openUrl(QUrl("http://yat.qa/"))
     if PluginHost.cfg.getboolean("general", "verbose"):
         ts3lib.printMessageToCurrentTab(
             "{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded."
             .format(timestamp(), self.name, self.author))
Exemple #11
0
	def startAuthenticationProcess(self):
		self.saveSettings()
		self.loadSettings()
		auth_url = self.imgur.authorization_url('pin')
		QDesktopServices.openUrl(QUrl(auth_url))
		pin = raw_input("Enter PIN from imgur website:")
		if pin:
			try:
				self.access_token, self.refresh_token = self.imgur.exchange_pin(pin)
			except KeyError as e:
				QMessageBox.critical(self.settingsDialog, "Imgur key error", "Failed to exchange pin. " + e.message)
		self.access_token, self.username = self.imgur.refresh_access_token()
		self.saveSettings()
		self.updateUi()
Exemple #12
0
 def startAuthenticationProcess(self):
     self.saveSettings()
     self.loadSettings()
     auth_url = self.imgur.authorization_url('pin')
     QDesktopServices.openUrl(QUrl(auth_url))
     pin = raw_input("Enter PIN from imgur website:")
     if pin:
         try:
             self.access_token, self.refresh_token = self.imgur.exchange_pin(
                 pin)
         except KeyError as e:
             QMessageBox.critical(self.settingsDialog, "Imgur key error",
                                  "Failed to exchange pin. " + e.message)
     self.access_token, self.username = self.imgur.refresh_access_token()
     self.saveSettings()
     self.updateUi()
Exemple #13
0
 def startAuthenticationProcess(self):
     self.settingsDialog.group_account.widget_authorize.button_authenticate.setEnabled(
         False)
     self.flow = client.OAuth2WebServerFlow(
         client_id=self.clientID,
         client_secret=self.clientSecret,
         scope=SCOPES,
         redirect_uri="urn:ietf:wg:oauth:2.0:oob")
     authorize_url = QUrl(self.flow.step1_get_authorize_url())
     QDesktopServices.openUrl(authorize_url)
     try:
         code = raw_input(
             "Enter the authorization code from the Google Drive website:")
     except NameError:
         code = input(
             "Enter the authorization code from the Google Drive website:")
     if code:
         try:
             oauth2_result = self.flow.step2_exchange(code)
             self.accessToken = oauth2_result.access_token
             self.refreshToken = oauth2_result.refresh_token
             self.driveService = build('drive',
                                       'v3',
                                       http=oauth2_result.authorize(Http()))
             account = self.driveService.about().get(
                 fields="user").execute()
             self.displayName = account["user"]["displayName"]
         except client.Error:
             if "win" in sys.platform:  #Workaround for crash on windows
                 self.parentWidget.hide()
                 self.settingsDialog.hide()
             QMessageBox.critical(
                 self.settingsDialog, "Failed to authenticate",
                 "Failed to authenticate with Google Drive. Wrong code?")
             if "win" in sys.platform:
                 self.settingsDialog.show()
                 self.parentWidget.show()
     self.saveSettings()
     self.updateUi()
 def Homepage(self):
   QDesktopServices.openUrl(self.HOMEPAGE_URL)
Exemple #15
0
 def on_downloaddirButton_clicked(self):
     QDesktopServices.openUrl(QUrl(self.downloaddir))
Exemple #16
0
 def on_downloaddirButton_clicked(self):
     QDesktopServices.openUrl(QUrl(self.downloaddir))