mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-03-14 09:28:03 -06:00
Initial (automated) port to Python3.
This commit is contained in:
parent
4bdc2b2a6a
commit
b9ce127bc1
@ -1,4 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from builtins import str
|
||||||
name = 'TWBlue'
|
name = 'TWBlue'
|
||||||
snapshot = False
|
snapshot = False
|
||||||
if snapshot == False:
|
if snapshot == False:
|
||||||
@ -12,7 +13,7 @@ else:
|
|||||||
authors = [u"Manuel Cortéz", u"José Manuel Delicado"]
|
authors = [u"Manuel Cortéz", u"José Manuel Delicado"]
|
||||||
authorEmail = "manuel@manuelcortez.net"
|
authorEmail = "manuel@manuelcortez.net"
|
||||||
copyright = u"Copyright (C) 2013-2017, Manuel cortéz."
|
copyright = u"Copyright (C) 2013-2017, Manuel cortéz."
|
||||||
description = unicode(name+" is an app designed to use Twitter simply and efficiently while using minimal system resources. This app provides access to most Twitter features.")
|
description = str(name+" is an app designed to use Twitter simply and efficiently while using minimal system resources. This app provides access to most Twitter features.")
|
||||||
translators = [u"Manuel Cortéz (English)", u"Mohammed Al Shara, Hatoun Felemban (Arabic)", u"Francisco Torres (Catalan)", u"Manuel cortéz (Spanish)", u"Sukil Etxenike Arizaleta (Basque)", u"Jani Kinnunen (finnish)", u"Rémy Ruiz (French)", u"Juan Buño (Galician)", u"Steffen Schultz (German)", u"Zvonimir Stanečić (Croatian)", u"Robert Osztolykan (Hungarian)", u"Christian Leo Mameli (Italian)", u"Riku (Japanese)", u"Paweł Masarczyk (Polish)", u"Odenilton Júnior Santos (Portuguese)", u"Florian Ionașcu, Nicușor Untilă (Romanian)", u"Natalia Hedlund, Valeria Kuznetsova (Russian)", u"Aleksandar Đurić (Serbian)", u"Burak Yüksek (Turkish)"]
|
translators = [u"Manuel Cortéz (English)", u"Mohammed Al Shara, Hatoun Felemban (Arabic)", u"Francisco Torres (Catalan)", u"Manuel cortéz (Spanish)", u"Sukil Etxenike Arizaleta (Basque)", u"Jani Kinnunen (finnish)", u"Rémy Ruiz (French)", u"Juan Buño (Galician)", u"Steffen Schultz (German)", u"Zvonimir Stanečić (Croatian)", u"Robert Osztolykan (Hungarian)", u"Christian Leo Mameli (Italian)", u"Riku (Japanese)", u"Paweł Masarczyk (Polish)", u"Odenilton Júnior Santos (Portuguese)", u"Florian Ionașcu, Nicușor Untilă (Romanian)", u"Natalia Hedlund, Valeria Kuznetsova (Russian)", u"Aleksandar Đurić (Serbian)", u"Burak Yüksek (Turkish)"]
|
||||||
url = u"http://twblue.es"
|
url = u"http://twblue.es"
|
||||||
report_bugs_url = "http://twblue.es/bugs/api/soap/mantisconnect.php?wsdl"
|
report_bugs_url = "http://twblue.es/bugs/api/soap/mantisconnect.php?wsdl"
|
@ -1,7 +1,9 @@
|
|||||||
|
from future import standard_library
|
||||||
|
standard_library.install_aliases()
|
||||||
from audio_services import matches_url
|
from audio_services import matches_url
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import urllib
|
import urllib.request, urllib.parse, urllib.error
|
||||||
|
|
||||||
@matches_url('https://audioboom.com')
|
@matches_url('https://audioboom.com')
|
||||||
def convert_audioboom(url):
|
def convert_audioboom(url):
|
||||||
@ -13,14 +15,14 @@ def convert_audioboom(url):
|
|||||||
@matches_url ('https://soundcloud.com/')
|
@matches_url ('https://soundcloud.com/')
|
||||||
def convert_soundcloud (url):
|
def convert_soundcloud (url):
|
||||||
client_id = "df8113ca95c157b6c9731f54b105b473"
|
client_id = "df8113ca95c157b6c9731f54b105b473"
|
||||||
permalink = urllib.urlopen ('http://api.soundcloud.com/resolve.json?client_id=%s&url=%s' %(client_id, url))
|
permalink = urllib.request.urlopen ('http://api.soundcloud.com/resolve.json?client_id=%s&url=%s' %(client_id, url))
|
||||||
if permalink.getcode () == 404:
|
if permalink.getcode () == 404:
|
||||||
permalink.close ()
|
permalink.close ()
|
||||||
raise TypeError('%r is not a valid URL' % url)
|
raise TypeError('%r is not a valid URL' % url)
|
||||||
else:
|
else:
|
||||||
resolved_url = permalink.geturl ()
|
resolved_url = permalink.geturl ()
|
||||||
permalink.close ()
|
permalink.close ()
|
||||||
track_url = urllib.urlopen (resolved_url)
|
track_url = urllib.request.urlopen (resolved_url)
|
||||||
track_data = json.loads (track_url.read ())
|
track_data = json.loads (track_url.read ())
|
||||||
track_url.close ()
|
track_url.close ()
|
||||||
if track_data ['streamable']:
|
if track_data ['streamable']:
|
||||||
|
@ -51,7 +51,7 @@ def hist(keys):
|
|||||||
def find_problems(hist):
|
def find_problems(hist):
|
||||||
"Takes a histogram and returns a list of items occurring more than once."
|
"Takes a histogram and returns a list of items occurring more than once."
|
||||||
res=[]
|
res=[]
|
||||||
for k,v in hist.items():
|
for k,v in list(hist.items()):
|
||||||
if v>1:
|
if v>1:
|
||||||
res.append(k)
|
res.append(k)
|
||||||
return res
|
return res
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from builtins import object
|
||||||
import os
|
import os
|
||||||
import widgetUtils
|
import widgetUtils
|
||||||
import logging
|
import logging
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
from builtins import str
|
||||||
|
from builtins import range
|
||||||
|
from builtins import object
|
||||||
import time
|
import time
|
||||||
import platform
|
import platform
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
@ -389,7 +392,7 @@ class baseBufferController(bufferController):
|
|||||||
|
|
||||||
def remove_tweet(self, id):
|
def remove_tweet(self, id):
|
||||||
if type(self.session.db[self.name]) == dict: return
|
if type(self.session.db[self.name]) == dict: return
|
||||||
for i in xrange(0, len(self.session.db[self.name])):
|
for i in range(0, len(self.session.db[self.name])):
|
||||||
if self.session.db[self.name][i]["id"] == id:
|
if self.session.db[self.name][i]["id"] == id:
|
||||||
self.session.db[self.name].pop(i)
|
self.session.db[self.name].pop(i)
|
||||||
self.remove_item(i)
|
self.remove_item(i)
|
||||||
@ -606,7 +609,7 @@ class baseBufferController(bufferController):
|
|||||||
# fix this:
|
# fix this:
|
||||||
original_date = arrow.get(self.session.db[self.name][self.buffer.list.get_selected()]["created_at"], "ddd MMM D H:m:s Z YYYY", locale="en")
|
original_date = arrow.get(self.session.db[self.name][self.buffer.list.get_selected()]["created_at"], "ddd MMM D H:m:s Z YYYY", locale="en")
|
||||||
ts = original_date.humanize(locale=languageHandler.getLanguage())
|
ts = original_date.humanize(locale=languageHandler.getLanguage())
|
||||||
self.buffer.list.list.SetItem(self.buffer.list.get_selected(), 2, unicode(ts))
|
self.buffer.list.list.SetItem(self.buffer.list.get_selected(), 2, str(ts))
|
||||||
if self.session.settings['sound']['indicate_audio'] and utils.is_audio(tweet):
|
if self.session.settings['sound']['indicate_audio'] and utils.is_audio(tweet):
|
||||||
self.session.sound.play("audio.ogg")
|
self.session.sound.play("audio.ogg")
|
||||||
if self.session.settings['sound']['indicate_geo'] and utils.is_geocoded(tweet):
|
if self.session.settings['sound']['indicate_geo'] and utils.is_geocoded(tweet):
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from builtins import object
|
||||||
from wxUI.dialogs import filters
|
from wxUI.dialogs import filters
|
||||||
|
|
||||||
class filterController(object):
|
class filterController(object):
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from builtins import object
|
||||||
import widgetUtils
|
import widgetUtils
|
||||||
import output
|
import output
|
||||||
from wxUI.dialogs import lists
|
from wxUI.dialogs import lists
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
from builtins import str
|
||||||
|
from builtins import range
|
||||||
|
from builtins import object
|
||||||
import platform
|
import platform
|
||||||
system = platform.system()
|
system = platform.system()
|
||||||
import application
|
import application
|
||||||
@ -264,7 +267,7 @@ class Controller(object):
|
|||||||
self.start_buffers(session_.sessions[i])
|
self.start_buffers(session_.sessions[i])
|
||||||
self.set_buffer_positions(session_.sessions[i])
|
self.set_buffer_positions(session_.sessions[i])
|
||||||
if config.app["app-settings"]["play_ready_sound"] == True:
|
if config.app["app-settings"]["play_ready_sound"] == True:
|
||||||
session_.sessions[session_.sessions.keys()[0]].sound.play("ready.ogg")
|
session_.sessions[list(session_.sessions.keys())[0]].sound.play("ready.ogg")
|
||||||
if config.app["app-settings"]["speak_ready_msg"] == True:
|
if config.app["app-settings"]["speak_ready_msg"] == True:
|
||||||
output.speak(_(u"Ready"))
|
output.speak(_(u"Ready"))
|
||||||
self.started = True
|
self.started = True
|
||||||
@ -478,7 +481,7 @@ class Controller(object):
|
|||||||
output.speak(_(u"Empty buffer."), True)
|
output.speak(_(u"Empty buffer."), True)
|
||||||
return
|
return
|
||||||
start = page.buffer.list.get_selected()
|
start = page.buffer.list.get_selected()
|
||||||
for i in xrange(start,count):
|
for i in range(start,count):
|
||||||
page.buffer.list.select_item(i)
|
page.buffer.list.select_item(i)
|
||||||
if string.lower() in page.get_message().lower():
|
if string.lower() in page.get_message().lower():
|
||||||
return output.speak(page.get_message(), True)
|
return output.speak(page.get_message(), True)
|
||||||
@ -1595,7 +1598,7 @@ class Controller(object):
|
|||||||
output.speak(_(u"This tweet doesn't contain images"))
|
output.speak(_(u"This tweet doesn't contain images"))
|
||||||
return
|
return
|
||||||
if len(tweet["entities"]["media"]) > 1:
|
if len(tweet["entities"]["media"]) > 1:
|
||||||
image_list = [_(u"Picture {0}").format(i,) for i in xrange(0, len(tweet["entities"]["media"]))]
|
image_list = [_(u"Picture {0}").format(i,) for i in range(0, len(tweet["entities"]["media"]))]
|
||||||
dialog = dialogs.urlList.urlList(title=_(u"Select the picture"))
|
dialog = dialogs.urlList.urlList(title=_(u"Select the picture"))
|
||||||
if dialog.get_response() == widgetUtils.OK:
|
if dialog.get_response() == widgetUtils.OK:
|
||||||
img = tweet["entities"]["media"][dialog.get_item()]
|
img = tweet["entities"]["media"][dialog.get_item()]
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
from builtins import str
|
||||||
|
from builtins import range
|
||||||
|
from builtins import object
|
||||||
import re
|
import re
|
||||||
import platform
|
import platform
|
||||||
from . import attach
|
from . import attach
|
||||||
@ -172,14 +175,14 @@ class reply(tweet):
|
|||||||
|
|
||||||
def get_ids(self):
|
def get_ids(self):
|
||||||
excluded_ids = ""
|
excluded_ids = ""
|
||||||
for i in xrange(0, len(self.message.checkboxes)):
|
for i in range(0, len(self.message.checkboxes)):
|
||||||
if self.message.checkboxes[i].GetValue() == False:
|
if self.message.checkboxes[i].GetValue() == False:
|
||||||
excluded_ids = excluded_ids + "{0},".format(self.ids[i],)
|
excluded_ids = excluded_ids + "{0},".format(self.ids[i],)
|
||||||
return excluded_ids
|
return excluded_ids
|
||||||
|
|
||||||
def get_people(self):
|
def get_people(self):
|
||||||
people = ""
|
people = ""
|
||||||
for i in xrange(0, len(self.message.checkboxes)):
|
for i in range(0, len(self.message.checkboxes)):
|
||||||
if self.message.checkboxes[i].GetValue() == True:
|
if self.message.checkboxes[i].GetValue() == True:
|
||||||
people = people + "{0} ".format(self.message.checkboxes[i].GetLabel(),)
|
people = people + "{0} ".format(self.message.checkboxes[i].GetLabel(),)
|
||||||
return people
|
return people
|
||||||
@ -203,7 +206,7 @@ class viewTweet(basicTweet):
|
|||||||
if is_tweet == True:
|
if is_tweet == True:
|
||||||
image_description = []
|
image_description = []
|
||||||
text = ""
|
text = ""
|
||||||
for i in xrange(0, len(tweetList)):
|
for i in range(0, len(tweetList)):
|
||||||
# tweets with message keys are longer tweets, the message value is the full messaje taken from twishort.
|
# tweets with message keys are longer tweets, the message value is the full messaje taken from twishort.
|
||||||
if "message" in tweetList[i] and tweetList[i]["is_quote_status"] == False:
|
if "message" in tweetList[i] and tweetList[i]["is_quote_status"] == False:
|
||||||
value = "message"
|
value = "message"
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import division
|
||||||
|
from builtins import str
|
||||||
|
from past.utils import old_div
|
||||||
|
from builtins import object
|
||||||
import os
|
import os
|
||||||
import webbrowser
|
import webbrowser
|
||||||
import sound_lib
|
import sound_lib
|
||||||
@ -49,7 +53,7 @@ class globalSettingsController(object):
|
|||||||
id = self.codes.index(config.app["app-settings"]["language"])
|
id = self.codes.index(config.app["app-settings"]["language"])
|
||||||
self.kmfriendlies=[]
|
self.kmfriendlies=[]
|
||||||
self.kmnames=[]
|
self.kmnames=[]
|
||||||
for k,v in self.kmmap.items():
|
for k,v in list(self.kmmap.items()):
|
||||||
self.kmfriendlies.append(k)
|
self.kmfriendlies.append(k)
|
||||||
self.kmnames.append(v)
|
self.kmnames.append(v)
|
||||||
self.kmid=self.kmnames.index(config.app['app-settings']['load_keymap'])
|
self.kmid=self.kmnames.index(config.app['app-settings']['load_keymap'])
|
||||||
@ -235,7 +239,7 @@ class accountSettingsController(globalSettingsController):
|
|||||||
self.buffer.session.sound.output.set_device(self.buffer.session.sound.output.find_device_by_name(self.config["sound"]["output_device"]))
|
self.buffer.session.sound.output.set_device(self.buffer.session.sound.output.find_device_by_name(self.config["sound"]["output_device"]))
|
||||||
except:
|
except:
|
||||||
self.config["sound"]["output_device"] = "default"
|
self.config["sound"]["output_device"] = "default"
|
||||||
self.config["sound"]["volume"] = self.dialog.get_value("sound", "volumeCtrl")/100.0
|
self.config["sound"]["volume"] = old_div(self.dialog.get_value("sound", "volumeCtrl"),100.0)
|
||||||
self.config["sound"]["session_mute"] = self.dialog.get_value("sound", "session_mute")
|
self.config["sound"]["session_mute"] = self.dialog.get_value("sound", "session_mute")
|
||||||
self.config["sound"]["current_soundpack"] = self.dialog.sound.get("soundpack")
|
self.config["sound"]["current_soundpack"] = self.dialog.sound.get("soundpack")
|
||||||
self.config["sound"]["indicate_audio"] = self.dialog.get_value("sound", "indicate_audio")
|
self.config["sound"]["indicate_audio"] = self.dialog.get_value("sound", "indicate_audio")
|
||||||
@ -280,7 +284,7 @@ class accountSettingsController(globalSettingsController):
|
|||||||
all_buffers['events']=_(u"Events")
|
all_buffers['events']=_(u"Events")
|
||||||
list_buffers = []
|
list_buffers = []
|
||||||
hidden_buffers=[]
|
hidden_buffers=[]
|
||||||
for i in all_buffers.keys():
|
for i in list(all_buffers.keys()):
|
||||||
if i in self.config["general"]["buffer_order"]:
|
if i in self.config["general"]["buffer_order"]:
|
||||||
list_buffers.append((i, all_buffers[i], True))
|
list_buffers.append((i, all_buffers[i], True))
|
||||||
else:
|
else:
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from builtins import object
|
||||||
from wxUI.dialogs import trends
|
from wxUI.dialogs import trends
|
||||||
import widgetUtils
|
import widgetUtils
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from builtins import object
|
||||||
import wx
|
import wx
|
||||||
import webbrowser
|
import webbrowser
|
||||||
import widgetUtils
|
import widgetUtils
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from builtins import object
|
||||||
import re
|
import re
|
||||||
import widgetUtils
|
import widgetUtils
|
||||||
import output
|
import output
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
#
|
#
|
||||||
############################################################
|
############################################################
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
from builtins import str
|
||||||
|
from builtins import object
|
||||||
import widgetUtils
|
import widgetUtils
|
||||||
from . import wx_ui
|
from . import wx_ui
|
||||||
from . import wx_transfer_dialogs
|
from . import wx_transfer_dialogs
|
||||||
@ -132,7 +134,7 @@ class audioUploader(object):
|
|||||||
def _play(self):
|
def _play(self):
|
||||||
output.speak(_(u"Playing..."))
|
output.speak(_(u"Playing..."))
|
||||||
# try:
|
# try:
|
||||||
self.playing = sound_lib.stream.FileStream(file=unicode(self.file), flags=sound_lib.stream.BASS_UNICODE)
|
self.playing = sound_lib.stream.FileStream(file=str(self.file), flags=sound_lib.stream.BASS_UNICODE)
|
||||||
self.playing.play()
|
self.playing.play()
|
||||||
self.dialog.set("play", _(u"&Stop"))
|
self.dialog.set("play", _(u"&Stop"))
|
||||||
try:
|
try:
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
from __future__ import division
|
||||||
|
from builtins import object
|
||||||
|
from past.utils import old_div
|
||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
@ -21,7 +24,7 @@ class Upload(object):
|
|||||||
self.background_thread = None
|
self.background_thread = None
|
||||||
self.transfer_rate = 0
|
self.transfer_rate = 0
|
||||||
self.local_filename=os.path.basename(self.filename)
|
self.local_filename=os.path.basename(self.filename)
|
||||||
if isinstance(self.local_filename, unicode):
|
if isinstance(self.local_filename, str):
|
||||||
self.local_filename=self.local_filename.encode(sys.getfilesystemencoding())
|
self.local_filename=self.local_filename.encode(sys.getfilesystemencoding())
|
||||||
self.fin=open(self.filename, 'rb')
|
self.fin=open(self.filename, 'rb')
|
||||||
self.m = MultipartEncoder(fields={field:(self.local_filename, self.fin, "application/octet-stream")})
|
self.m = MultipartEncoder(fields={field:(self.local_filename, self.fin, "application/octet-stream")})
|
||||||
@ -44,11 +47,11 @@ class Upload(object):
|
|||||||
progress["percent"] = 0
|
progress["percent"] = 0
|
||||||
self.transfer_rate = 0
|
self.transfer_rate = 0
|
||||||
else:
|
else:
|
||||||
progress["percent"] = int((float(progress["current"]) / progress["total"]) * 100)
|
progress["percent"] = int((old_div(float(progress["current"]), progress["total"])) * 100)
|
||||||
self.transfer_rate = progress["current"] / self.elapsed_time()
|
self.transfer_rate = old_div(progress["current"], self.elapsed_time())
|
||||||
progress["speed"] = '%s/s' % convert_bytes(self.transfer_rate)
|
progress["speed"] = '%s/s' % convert_bytes(self.transfer_rate)
|
||||||
if self.transfer_rate:
|
if self.transfer_rate:
|
||||||
progress["eta"] = (progress["total"] - progress["current"]) / self.transfer_rate
|
progress["eta"] = old_div((progress["total"] - progress["current"]), self.transfer_rate)
|
||||||
else:
|
else:
|
||||||
progress["eta"] = 0
|
progress["eta"] = 0
|
||||||
pub.sendMessage("uploading", data=progress)
|
pub.sendMessage("uploading", data=progress)
|
||||||
|
@ -1,17 +1,20 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
from builtins import str
|
||||||
|
from past.utils import old_div
|
||||||
def convert_bytes(n):
|
def convert_bytes(n):
|
||||||
K, M, G, T, P = 1 << 10, 1 << 20, 1 << 30, 1 << 40, 1 << 50
|
K, M, G, T, P = 1 << 10, 1 << 20, 1 << 30, 1 << 40, 1 << 50
|
||||||
if n >= P:
|
if n >= P:
|
||||||
return '%.2fPb' % (float(n) / T)
|
return '%.2fPb' % (old_div(float(n), T))
|
||||||
elif n >= T:
|
elif n >= T:
|
||||||
return '%.2fTb' % (float(n) / T)
|
return '%.2fTb' % (old_div(float(n), T))
|
||||||
elif n >= G:
|
elif n >= G:
|
||||||
return '%.2fGb' % (float(n) / G)
|
return '%.2fGb' % (old_div(float(n), G))
|
||||||
elif n >= M:
|
elif n >= M:
|
||||||
return '%.2fMb' % (float(n) / M)
|
return '%.2fMb' % (old_div(float(n), M))
|
||||||
elif n >= K:
|
elif n >= K:
|
||||||
return '%.2fKb' % (float(n) / K)
|
return '%.2fKb' % (old_div(float(n), K))
|
||||||
else:
|
else:
|
||||||
return '%d' % n
|
return '%d' % n
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
from builtins import object
|
||||||
import platform
|
import platform
|
||||||
import widgetUtils
|
import widgetUtils
|
||||||
import os
|
import os
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
from builtins import next
|
||||||
|
from builtins import object
|
||||||
import logging
|
import logging
|
||||||
log = logging.getLogger("extra.SpellChecker.spellChecker")
|
log = logging.getLogger("extra.SpellChecker.spellChecker")
|
||||||
from . import wx_ui
|
from . import wx_ui
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
from builtins import object
|
||||||
import output
|
import output
|
||||||
from . import storage
|
from . import storage
|
||||||
from . import wx_menu
|
from . import wx_menu
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from builtins import object
|
||||||
from . import storage
|
from . import storage
|
||||||
import widgetUtils
|
import widgetUtils
|
||||||
from . import wx_manage
|
from . import wx_manage
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from builtins import object
|
||||||
from . import storage
|
from . import storage
|
||||||
import widgetUtils
|
import widgetUtils
|
||||||
from . import wx_settings
|
from . import wx_settings
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from builtins import object
|
||||||
import sqlite3, paths
|
import sqlite3, paths
|
||||||
|
|
||||||
class storage(object):
|
class storage(object):
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
""" original module taken and modified from https://github.com/ctoth/cloudOCR"""
|
""" original module taken and modified from https://github.com/ctoth/cloudOCR"""
|
||||||
|
from builtins import object
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
translatable_langs = [_(u"Detect automatically"), _(u"Danish"), _(u"Dutch"), _(u"English"), _(u"Finnish"), _(u"French"), _(u"German"), _(u"Hungarian"), _(u"Korean"), _(u"Italian"), _(u"Japanese"), _(u"Polish"), _(u"Portuguese"), _(u"Russian"), _(u"Spanish"), _(u"Turkish")]
|
translatable_langs = [_(u"Detect automatically"), _(u"Danish"), _(u"Dutch"), _(u"English"), _(u"Finnish"), _(u"French"), _(u"German"), _(u"Hungarian"), _(u"Korean"), _(u"Italian"), _(u"Japanese"), _(u"Polish"), _(u"Portuguese"), _(u"Russian"), _(u"Spanish"), _(u"Turkish")]
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from builtins import zip
|
||||||
from yandex_translate import YandexTranslate
|
from yandex_translate import YandexTranslate
|
||||||
|
|
||||||
def translate(text="", source="auto", target="en"):
|
def translate(text="", source="auto", target="en"):
|
||||||
@ -101,8 +102,8 @@ languages = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def available_languages():
|
def available_languages():
|
||||||
l = languages.keys()
|
l = list(languages.keys())
|
||||||
d = languages.values()
|
d = list(languages.values())
|
||||||
l.insert(0, '')
|
l.insert(0, '')
|
||||||
d.insert(0, _(u"autodetect"))
|
d.insert(0, _(u"autodetect"))
|
||||||
return sorted(zip(l, d))
|
return sorted(zip(l, d))
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from future import standard_library
|
||||||
|
standard_library.install_aliases()
|
||||||
from requests.packages import urllib3
|
from requests.packages import urllib3
|
||||||
from requests.packages.urllib3 import fields
|
from requests.packages.urllib3 import fields
|
||||||
import six
|
import six
|
||||||
import urllib
|
import urllib.request, urllib.parse, urllib.error
|
||||||
|
|
||||||
def fix():
|
def fix():
|
||||||
urllib3.disable_warnings()
|
urllib3.disable_warnings()
|
||||||
@ -19,6 +21,6 @@ def patched_format_header_param(name, value):
|
|||||||
return result
|
return result
|
||||||
if not six.PY3 and isinstance(value, six.text_type): # Python 2:
|
if not six.PY3 and isinstance(value, six.text_type): # Python 2:
|
||||||
value = value.encode('utf-8')
|
value = value.encode('utf-8')
|
||||||
value=urllib.quote(value, safe='')
|
value=urllib.parse.quote(value, safe='')
|
||||||
value = '%s=%s' % (name, value)
|
value = '%s=%s' % (name, value)
|
||||||
return value
|
return value
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#
|
#
|
||||||
############################################################
|
############################################################
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
from builtins import object
|
||||||
import keys
|
import keys
|
||||||
import wx
|
import wx
|
||||||
from . import wx_ui
|
from . import wx_ui
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
from future import standard_library
|
||||||
|
standard_library.install_aliases()
|
||||||
|
from builtins import chr
|
||||||
from .main import KeyboardHandler
|
from .main import KeyboardHandler
|
||||||
import threading
|
import threading
|
||||||
import thread
|
import _thread
|
||||||
import pyatspi
|
import pyatspi
|
||||||
def parse(s):
|
def parse(s):
|
||||||
"""parse a string like control+f into (modifier, key).
|
"""parse a string like control+f into (modifier, key).
|
||||||
@ -37,7 +40,7 @@ def handler(e):
|
|||||||
if (not e.is_text) and e.id >= 97 <= 126:
|
if (not e.is_text) and e.id >= 97 <= 126:
|
||||||
k = chr(e.id)
|
k = chr(e.id)
|
||||||
if (m,k) not in keys: return False
|
if (m,k) not in keys: return False
|
||||||
thread.start_new(keys[(m,k)], ())
|
_thread.start_new(keys[(m,k)], ())
|
||||||
return True #don't pass it on
|
return True #don't pass it on
|
||||||
class LinuxKeyboardHandler(KeyboardHandler):
|
class LinuxKeyboardHandler(KeyboardHandler):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from builtins import object
|
||||||
import platform
|
import platform
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
from builtins import str
|
||||||
from AppKit import *
|
from AppKit import *
|
||||||
from PyObjCTools import AppHelper
|
from PyObjCTools import AppHelper
|
||||||
from Carbon.CarbonEvt import RegisterEventHotKey, GetApplicationEventTarget
|
from Carbon.CarbonEvt import RegisterEventHotKey, GetApplicationEventTarget
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
from builtins import str
|
||||||
import win32api
|
import win32api
|
||||||
import win32con
|
import win32con
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
from builtins import chr
|
||||||
import functools
|
import functools
|
||||||
import wx
|
import wx
|
||||||
import platform
|
import platform
|
||||||
@ -84,7 +85,7 @@ class WXKeyboardHandler(keyboard_handler):
|
|||||||
|
|
||||||
def process_key (self, evt, id):
|
def process_key (self, evt, id):
|
||||||
evt.Skip()
|
evt.Skip()
|
||||||
key_ids = self.key_ids.keys()
|
key_ids = list(self.key_ids.keys())
|
||||||
for i in key_ids:
|
for i in key_ids:
|
||||||
if self.key_ids.get(i) == id:
|
if self.key_ids.get(i) == id:
|
||||||
self.handle_key(i)
|
self.handle_key(i)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from builtins import object
|
||||||
import application
|
import application
|
||||||
import platform
|
import platform
|
||||||
import exceptions
|
|
||||||
from ctypes import c_char_p
|
from ctypes import c_char_p
|
||||||
from libloader import load_library
|
from libloader import load_library
|
||||||
import paths
|
import paths
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
from builtins import object
|
||||||
import widgetUtils
|
import widgetUtils
|
||||||
import config
|
import config
|
||||||
from . import wx_ui
|
from . import wx_ui
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
import __builtin__
|
from future import standard_library
|
||||||
|
standard_library.install_aliases()
|
||||||
|
from builtins import zip
|
||||||
|
from builtins import str
|
||||||
|
import builtins
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import ctypes
|
import ctypes
|
||||||
@ -27,12 +31,12 @@ def localeNameToWindowsLCID(localeName):
|
|||||||
func_LocaleNameToLCID=getattr(ctypes.windll.kernel32,'LocaleNameToLCID',None)
|
func_LocaleNameToLCID=getattr(ctypes.windll.kernel32,'LocaleNameToLCID',None)
|
||||||
if func_LocaleNameToLCID is not None:
|
if func_LocaleNameToLCID is not None:
|
||||||
localeName=localeName.replace('_','-')
|
localeName=localeName.replace('_','-')
|
||||||
LCID=func_LocaleNameToLCID(unicode(localeName),0)
|
LCID=func_LocaleNameToLCID(str(localeName),0)
|
||||||
else: #Windows doesn't have this functionality, manually search Python's windows_locale dictionary for the LCID
|
else: #Windows doesn't have this functionality, manually search Python's windows_locale dictionary for the LCID
|
||||||
localeName=locale.normalize(localeName)
|
localeName=locale.normalize(localeName)
|
||||||
if '.' in localeName:
|
if '.' in localeName:
|
||||||
localeName=localeName.split('.')[0]
|
localeName=localeName.split('.')[0]
|
||||||
LCList=[x[0] for x in locale.windows_locale.iteritems() if x[1]==localeName]
|
LCList=[x[0] for x in locale.windows_locale.items() if x[1]==localeName]
|
||||||
if len(LCList)>0:
|
if len(LCList)>0:
|
||||||
LCID=LCList[0]
|
LCID=LCList[0]
|
||||||
else:
|
else:
|
||||||
@ -96,7 +100,7 @@ def getAvailableLanguages():
|
|||||||
# Translators: the label for the Windows default NVDA interface language.
|
# Translators: the label for the Windows default NVDA interface language.
|
||||||
d.append(_("User default"))
|
d.append(_("User default"))
|
||||||
#return a zipped up version of both the lists (a list with tuples of locale,label)
|
#return a zipped up version of both the lists (a list with tuples of locale,label)
|
||||||
return zip(l,d)
|
return list(zip(l,d))
|
||||||
|
|
||||||
def makePgettext(translations):
|
def makePgettext(translations):
|
||||||
"""Obtaina pgettext function for use with a gettext translations instance.
|
"""Obtaina pgettext function for use with a gettext translations instance.
|
||||||
@ -106,7 +110,7 @@ def makePgettext(translations):
|
|||||||
"""
|
"""
|
||||||
if isinstance(translations, gettext.GNUTranslations):
|
if isinstance(translations, gettext.GNUTranslations):
|
||||||
def pgettext(context, message):
|
def pgettext(context, message):
|
||||||
message = unicode(message)
|
message = str(message)
|
||||||
try:
|
try:
|
||||||
# Look up the message with its context.
|
# Look up the message with its context.
|
||||||
return translations._catalog[u"%s\x04%s" % (context, message)]
|
return translations._catalog[u"%s\x04%s" % (context, message)]
|
||||||
@ -114,7 +118,7 @@ def makePgettext(translations):
|
|||||||
return message
|
return message
|
||||||
else:
|
else:
|
||||||
def pgettext(context, message):
|
def pgettext(context, message):
|
||||||
return unicode(message)
|
return str(message)
|
||||||
return pgettext
|
return pgettext
|
||||||
|
|
||||||
def setLanguage(lang):
|
def setLanguage(lang):
|
||||||
@ -164,7 +168,7 @@ def setLanguage(lang):
|
|||||||
except IOError:
|
except IOError:
|
||||||
trans=gettext.translation("twblue",fallback=True)
|
trans=gettext.translation("twblue",fallback=True)
|
||||||
curLang="en"
|
curLang="en"
|
||||||
trans.install(unicode=True)
|
trans.install()
|
||||||
# Install our pgettext function.
|
# Install our pgettext function.
|
||||||
# __builtin__.__dict__["pgettext"] = makePgettext(trans)
|
# __builtin__.__dict__["pgettext"] = makePgettext(trans)
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from builtins import str
|
||||||
import ctypes
|
import ctypes
|
||||||
import collections
|
import collections
|
||||||
import platform
|
import platform
|
||||||
|
@ -9,7 +9,7 @@ ERROR_LOG_FILE = "error.log"
|
|||||||
MESSAGE_FORMAT = "%(asctime)s %(name)s %(levelname)s: %(message)s"
|
MESSAGE_FORMAT = "%(asctime)s %(name)s %(levelname)s: %(message)s"
|
||||||
DATE_FORMAT = u"%d/%m/%Y %H:%M:%S"
|
DATE_FORMAT = u"%d/%m/%Y %H:%M:%S"
|
||||||
|
|
||||||
formatter = logging.Formatter(MESSAGE_FORMAT.decode("utf-8"), datefmt=DATE_FORMAT)
|
formatter = logging.Formatter(MESSAGE_FORMAT, datefmt=DATE_FORMAT)
|
||||||
|
|
||||||
requests_log = logging.getLogger("requests")
|
requests_log = logging.getLogger("requests")
|
||||||
requests_log.setLevel(logging.WARNING)
|
requests_log.setLevel(logging.WARNING)
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#
|
#
|
||||||
############################################################
|
############################################################
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
from builtins import range
|
||||||
import requests
|
import requests
|
||||||
import keys
|
import keys
|
||||||
import logging
|
import logging
|
||||||
@ -42,7 +43,7 @@ def is_long(tweet):
|
|||||||
# see https://github.com/manuelcortez/TWBlue/issues/103
|
# see https://github.com/manuelcortez/TWBlue/issues/103
|
||||||
except TypeError:
|
except TypeError:
|
||||||
pass
|
pass
|
||||||
if long == False and "retweeted_status" in tweet:
|
if int == False and "retweeted_status" in tweet:
|
||||||
for url in range(0, len(tweet["retweeted_status"]["entities"]["urls"])):
|
for url in range(0, len(tweet["retweeted_status"]["entities"]["urls"])):
|
||||||
try:
|
try:
|
||||||
if tweet["retweeted_status"]["entities"]["urls"][url] != None and "twishort.com" in tweet["retweeted_status"]["entities"]["urls"][url]["expanded_url"]:
|
if tweet["retweeted_status"]["entities"]["urls"][url] != None and "twishort.com" in tweet["retweeted_status"]["entities"]["urls"][url]["expanded_url"]:
|
||||||
@ -51,7 +52,7 @@ def is_long(tweet):
|
|||||||
pass
|
pass
|
||||||
except TypeError:
|
except TypeError:
|
||||||
pass
|
pass
|
||||||
return long
|
return int
|
||||||
|
|
||||||
def get_full_text(uri):
|
def get_full_text(uri):
|
||||||
try:
|
try:
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from builtins import str
|
||||||
|
from builtins import range
|
||||||
|
from builtins import object
|
||||||
import wx
|
import wx
|
||||||
import platform
|
import platform
|
||||||
import logging
|
import logging
|
||||||
@ -27,7 +30,7 @@ class list(object):
|
|||||||
def create_list(self, parent):
|
def create_list(self, parent):
|
||||||
if self.system == "Windows":
|
if self.system == "Windows":
|
||||||
self.list = wx.ListCtrl(parent, -1, **self.listArguments)
|
self.list = wx.ListCtrl(parent, -1, **self.listArguments)
|
||||||
for i in xrange(0, len(self.columns)):
|
for i in range(0, len(self.columns)):
|
||||||
self.list.InsertColumn(i, u"%s" % (self.columns[i]))
|
self.list.InsertColumn(i, u"%s" % (self.columns[i]))
|
||||||
else:
|
else:
|
||||||
self.list = wx.ListBox(parent, -1, choices=[])
|
self.list = wx.ListBox(parent, -1, choices=[])
|
||||||
@ -37,9 +40,9 @@ class list(object):
|
|||||||
if self.system == "Windows":
|
if self.system == "Windows":
|
||||||
if reversed == False: items = self.list.GetItemCount()
|
if reversed == False: items = self.list.GetItemCount()
|
||||||
else: items = 0
|
else: items = 0
|
||||||
self.list.InsertItem(items, unicode(item[0]))
|
self.list.InsertItem(items, str(item[0]))
|
||||||
for i in xrange(1, len(self.columns)):
|
for i in range(1, len(self.columns)):
|
||||||
self.list.SetItem(items, i, unicode(item[i]))
|
self.list.SetItem(items, i, str(item[i]))
|
||||||
else:
|
else:
|
||||||
self.list.Append(" ".join(item))
|
self.list.Append(" ".join(item))
|
||||||
|
|
||||||
@ -85,5 +88,5 @@ class list(object):
|
|||||||
return item.GetText()
|
return item.GetText()
|
||||||
|
|
||||||
def set_text_column(self, indexId, column, text):
|
def set_text_column(self, indexId, column, text):
|
||||||
item = self.list.SetItem(indexId, column, unicode(text))
|
item = self.list.SetItem(indexId, column, str(text))
|
||||||
return item
|
return item
|
@ -1,4 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from future import standard_library
|
||||||
|
standard_library.install_aliases()
|
||||||
import logging
|
import logging
|
||||||
log = logging.getLogger("mysc.thread_utils")
|
log = logging.getLogger("mysc.thread_utils")
|
||||||
import threading
|
import threading
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from builtins import object
|
||||||
import dbus
|
import dbus
|
||||||
import application
|
import application
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from builtins import object
|
||||||
import wx
|
import wx
|
||||||
|
|
||||||
class notification(object):
|
class notification(object):
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from builtins import str
|
||||||
import platform
|
import platform
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
@ -15,7 +16,7 @@ log = logging.getLogger("paths")
|
|||||||
def merge_paths(func):
|
def merge_paths(func):
|
||||||
@wraps(func)
|
@wraps(func)
|
||||||
def merge_paths_wrapper(*a):
|
def merge_paths_wrapper(*a):
|
||||||
return unicode(os.path.join(func(), *a))
|
return str(os.path.join(func(), *a))
|
||||||
return merge_paths_wrapper
|
return merge_paths_wrapper
|
||||||
|
|
||||||
@merge_paths
|
@merge_paths
|
||||||
|
@ -1,20 +1,21 @@
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import _winreg
|
from builtins import str
|
||||||
|
import winreg
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from platform_utils import paths
|
from platform_utils import paths
|
||||||
|
|
||||||
RUN_REGKEY = ur"SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
|
RUN_REGKEY = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"
|
||||||
|
|
||||||
def is_installed(app_subkey):
|
def is_installed(app_subkey):
|
||||||
"""Checks if the currently running copy is installed or portable variant. Requires the name of the application subkey found under the uninstall section in Windows registry."""
|
"""Checks if the currently running copy is installed or portable variant. Requires the name of the application subkey found under the uninstall section in Windows registry."""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s" % app_subkey)
|
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s" % app_subkey)
|
||||||
inst_dir = _winreg.QueryValueEx(key,"InstallLocation")[0]
|
inst_dir = winreg.QueryValueEx(key,"InstallLocation")[0]
|
||||||
except WindowsError:
|
except WindowsError:
|
||||||
return False
|
return False
|
||||||
_winreg.CloseKey(key)
|
winreg.CloseKey(key)
|
||||||
try:
|
try:
|
||||||
return os.stat(inst_dir) == os.stat(paths.app_path())
|
return os.stat(inst_dir) == os.stat(paths.app_path())
|
||||||
except WindowsError:
|
except WindowsError:
|
||||||
@ -24,8 +25,8 @@ def getAutoStart(app_name):
|
|||||||
"""Queries if the automatic startup should be set for the application or not, depending on it's current state."""
|
"""Queries if the automatic startup should be set for the application or not, depending on it's current state."""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, RUN_REGKEY)
|
key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, RUN_REGKEY)
|
||||||
val = _winreg.QueryValueEx(key, unicode(app_name))[0]
|
val = winreg.QueryValueEx(key, str(app_name))[0]
|
||||||
return os.stat(val) == os.stat(sys.argv[0])
|
return os.stat(val) == os.stat(sys.argv[0])
|
||||||
except (WindowsError, OSError):
|
except (WindowsError, OSError):
|
||||||
return False
|
return False
|
||||||
@ -35,8 +36,8 @@ def setAutoStart(app_name, enable=True):
|
|||||||
print(paths.get_executable())
|
print(paths.get_executable())
|
||||||
if getAutoStart(app_name) == enable:
|
if getAutoStart(app_name) == enable:
|
||||||
return
|
return
|
||||||
key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, RUN_REGKEY, 0, _winreg.KEY_WRITE)
|
key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, RUN_REGKEY, 0, winreg.KEY_WRITE)
|
||||||
if enable:
|
if enable:
|
||||||
_winreg.SetValueEx(key, unicode(app_name), None, _winreg.REG_SZ, paths.get_executable())
|
winreg.SetValueEx(key, str(app_name), None, winreg.REG_SZ, paths.get_executable())
|
||||||
else:
|
else:
|
||||||
_winreg.DeleteValue(key, unicode(app_name))
|
winreg.DeleteValue(key, str(app_name))
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
# Avoids the use of the standard py2exe console.
|
# Avoids the use of the standard py2exe console.
|
||||||
# Just import this file and it should go away
|
# Just import this file and it should go away
|
||||||
|
|
||||||
|
from builtins import object
|
||||||
import sys
|
import sys
|
||||||
if hasattr(sys,"frozen"): # true only if we are running as a py2exe app
|
if hasattr(sys,"frozen"): # true only if we are running as a py2exe app
|
||||||
class Blackhole(object):
|
class Blackhole(object):
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from builtins import str
|
||||||
import inspect
|
import inspect
|
||||||
import platform
|
import platform
|
||||||
import os
|
import os
|
||||||
@ -88,7 +89,7 @@ def documents_path():
|
|||||||
def safe_filename(filename):
|
def safe_filename(filename):
|
||||||
"""Given a filename, returns a safe version with no characters that would not work on different platforms."""
|
"""Given a filename, returns a safe version with no characters that would not work on different platforms."""
|
||||||
SAFE_FILE_CHARS = "'-_.()[]{}!@#$%^&+=`~ "
|
SAFE_FILE_CHARS = "'-_.()[]{}!@#$%^&+=`~ "
|
||||||
filename = unicode(filename)
|
filename = str(filename)
|
||||||
new_filename = ''.join(c for c in filename if c in SAFE_FILE_CHARS or c.isalnum())
|
new_filename = ''.join(c for c in filename if c in SAFE_FILE_CHARS or c.isalnum())
|
||||||
#Windows doesn't like directory names ending in space, macs consider filenames beginning with a dot as hidden, and windows removes dots at the ends of filenames.
|
#Windows doesn't like directory names ending in space, macs consider filenames beginning with a dot as hidden, and windows removes dots at the ends of filenames.
|
||||||
return new_filename.strip(' .')
|
return new_filename.strip(' .')
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
import _winreg
|
from future import standard_library
|
||||||
|
standard_library.install_aliases()
|
||||||
|
import winreg
|
||||||
|
|
||||||
SHELL_REGKEY = ur"Directory\shell"
|
SHELL_REGKEY = ur"Directory\shell"
|
||||||
|
|
||||||
def context_menu_integrate(item_key_name, item_display_text, item_command):
|
def context_menu_integrate(item_key_name, item_display_text, item_command):
|
||||||
app_menu_key = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, SHELL_REGKEY, 0, _winreg.KEY_WRITE)
|
app_menu_key = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, SHELL_REGKEY, 0, winreg.KEY_WRITE)
|
||||||
menu_item_key = _winreg.CreateKey(app_menu_key, item_key_name)
|
menu_item_key = winreg.CreateKey(app_menu_key, item_key_name)
|
||||||
_winreg.SetValueEx(menu_item_key, None, None, _winreg.REG_SZ, item_display_text)
|
winreg.SetValueEx(menu_item_key, None, None, winreg.REG_SZ, item_display_text)
|
||||||
item_command_key = _winreg.CreateKey(menu_item_key, 'command')
|
item_command_key = winreg.CreateKey(menu_item_key, 'command')
|
||||||
_winreg.SetValueEx(item_command_key, None, None, _winreg.REG_SZ, item_command)
|
winreg.SetValueEx(item_command_key, None, None, winreg.REG_SZ, item_command)
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import BaseHTTPServer, application
|
from future import standard_library
|
||||||
|
standard_library.install_aliases()
|
||||||
|
import http.server, application
|
||||||
|
|
||||||
logged = False
|
logged = False
|
||||||
|
|
||||||
class handler(BaseHTTPServer.BaseHTTPRequestHandler):
|
class handler(http.server.BaseHTTPRequestHandler):
|
||||||
|
|
||||||
def do_GET(self):
|
def do_GET(self):
|
||||||
global logged
|
global logged
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# -*- coding: cp1252 -*-
|
# -*- coding: cp1252 -*-
|
||||||
#from config_utils import Configuration, ConfigurationResetException
|
#from config_utils import Configuration, ConfigurationResetException
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
from builtins import object
|
||||||
import config
|
import config
|
||||||
import paths
|
import paths
|
||||||
import os
|
import os
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
""" The main session object. Here are the twitter functions to interact with the "model" of TWBlue."""
|
""" The main session object. Here are the twitter functions to interact with the "model" of TWBlue."""
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
import urllib2
|
from future import standard_library
|
||||||
|
standard_library.install_aliases()
|
||||||
|
from builtins import str
|
||||||
|
from builtins import range
|
||||||
|
from builtins import object
|
||||||
|
import urllib.request, urllib.error, urllib.parse
|
||||||
import config
|
import config
|
||||||
import twitter
|
import twitter
|
||||||
from keys import keyring
|
from keys import keyring
|
||||||
@ -408,8 +413,8 @@ class Session(object):
|
|||||||
if not os.path.exists(shelfname):
|
if not os.path.exists(shelfname):
|
||||||
output.speak("Generating database, this might take a while.",True)
|
output.speak("Generating database, this might take a while.",True)
|
||||||
shelf=shelve.open(paths.config_path(shelfname),'c')
|
shelf=shelve.open(paths.config_path(shelfname),'c')
|
||||||
for key,value in self.db.items():
|
for key,value in list(self.db.items()):
|
||||||
if type(key) != str and type(key) != unicode:
|
if type(key) != str and type(key) != str:
|
||||||
output.speak("Uh oh, while shelving the database, a key of type " + str(type(key)) + " has been found. It will be converted to type str, but this will cause all sorts of problems on deshelve. Please bring this to the attention of the " + application.name + " developers immediately. More information about the error will be written to the error log.",True)
|
output.speak("Uh oh, while shelving the database, a key of type " + str(type(key)) + " has been found. It will be converted to type str, but this will cause all sorts of problems on deshelve. Please bring this to the attention of the " + application.name + " developers immediately. More information about the error will be written to the error log.",True)
|
||||||
log.error("Uh oh, " + str(key) + " is of type " + str(type(key)) + "!")
|
log.error("Uh oh, " + str(key) + " is of type " + str(type(key)) + "!")
|
||||||
# Convert unicode objects to UTF-8 strings before shelve these objects.
|
# Convert unicode objects to UTF-8 strings before shelve these objects.
|
||||||
@ -432,7 +437,7 @@ class Session(object):
|
|||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
shelf=shelve.open(paths.config_path(shelfname),'c')
|
shelf=shelve.open(paths.config_path(shelfname),'c')
|
||||||
for key,value in shelf.items():
|
for key,value in list(shelf.items()):
|
||||||
self.db[key]=value
|
self.db[key]=value
|
||||||
shelf.close()
|
shelf.close()
|
||||||
except:
|
except:
|
||||||
@ -471,8 +476,8 @@ class Session(object):
|
|||||||
|
|
||||||
def check_long_tweet(self, tweet):
|
def check_long_tweet(self, tweet):
|
||||||
long = twishort.is_long(tweet)
|
long = twishort.is_long(tweet)
|
||||||
if long != False and config.app["app-settings"]["handle_longtweets"]:
|
if int != False and config.app["app-settings"]["handle_longtweets"]:
|
||||||
tweet["message"] = twishort.get_full_text(long)
|
tweet["message"] = twishort.get_full_text(int)
|
||||||
if tweet["message"] == False: return False
|
if tweet["message"] == False: return False
|
||||||
tweet["twishort"] = True
|
tweet["twishort"] = True
|
||||||
for i in tweet["entities"]["user_mentions"]:
|
for i in tweet["entities"]["user_mentions"]:
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
from builtins import str
|
||||||
|
from builtins import object
|
||||||
import shutil
|
import shutil
|
||||||
import widgetUtils
|
import widgetUtils
|
||||||
import platform
|
import platform
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
# -*- coding: cp1252 -*-
|
# -*- coding: cp1252 -*-
|
||||||
import exceptions
|
|
||||||
|
|
||||||
class InvalidSessionError(exceptions.Exception): pass
|
class InvalidSessionError(Exception): pass
|
||||||
class NonExistentSessionError(exceptions.Exception): pass
|
class NonExistentSessionError(Exception): pass
|
||||||
class NotLoggedSessionError(exceptions.BaseException): pass
|
class NotLoggedSessionError(BaseException): pass
|
||||||
class NotConfiguredSessionError(exceptions.BaseException): pass
|
class NotConfiguredSessionError(BaseException): pass
|
||||||
class RequireCredentialsSessionError(exceptions.BaseException): pass
|
class RequireCredentialsSessionError(BaseException): pass
|
||||||
class AlreadyAuthorisedError(exceptions.BaseException): pass
|
class AlreadyAuthorisedError(BaseException): pass
|
@ -1,4 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from builtins import range
|
||||||
|
from builtins import object
|
||||||
import sys
|
import sys
|
||||||
import url_shortener
|
import url_shortener
|
||||||
import audio_services
|
import audio_services
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import BaseHTTPServer
|
from future import standard_library
|
||||||
|
standard_library.install_aliases()
|
||||||
|
import http.server
|
||||||
import application
|
import application
|
||||||
from urlparse import urlparse, parse_qs
|
from urllib.parse import urlparse, parse_qs
|
||||||
|
|
||||||
logged = False
|
logged = False
|
||||||
verifier = None
|
verifier = None
|
||||||
|
|
||||||
class handler(BaseHTTPServer.BaseHTTPRequestHandler):
|
class handler(http.server.BaseHTTPRequestHandler):
|
||||||
|
|
||||||
def do_GET(self):
|
def do_GET(self):
|
||||||
global logged
|
global logged
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from builtins import str
|
||||||
import config
|
import config
|
||||||
from requests.auth import HTTPProxyAuth
|
from requests.auth import HTTPProxyAuth
|
||||||
from twitter import utils
|
from twitter import utils
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
from future import standard_library
|
||||||
|
standard_library.install_aliases()
|
||||||
|
from builtins import str
|
||||||
|
from builtins import chr
|
||||||
|
from builtins import range
|
||||||
import platform
|
import platform
|
||||||
system = platform.system()
|
system = platform.system()
|
||||||
from . import utils
|
from . import utils
|
||||||
import re
|
import re
|
||||||
import htmlentitydefs
|
import html.entities
|
||||||
import time
|
import time
|
||||||
import output
|
import output
|
||||||
import languageHandler
|
import languageHandler
|
||||||
@ -22,10 +27,10 @@ def StripChars(s):
|
|||||||
If we match &blah; and it's not found, &blah; will be returned.
|
If we match &blah; and it's not found, &blah; will be returned.
|
||||||
if we match #\d+, unichr(digits) will be returned.
|
if we match #\d+, unichr(digits) will be returned.
|
||||||
Else, a unicode string will be returned."""
|
Else, a unicode string will be returned."""
|
||||||
if match.group(1).startswith('#'): return unichr(int(match.group(1)[1:]))
|
if match.group(1).startswith('#'): return chr(int(match.group(1)[1:]))
|
||||||
replacement = htmlentitydefs.entitydefs.get(match.group(1), "&%s;" % match.group(1))
|
replacement = html.entities.entitydefs.get(match.group(1), "&%s;" % match.group(1))
|
||||||
return replacement.decode('iso-8859-1')
|
return replacement.decode('iso-8859-1')
|
||||||
return unicode(entity_re.sub(matchFunc, s))
|
return str(entity_re.sub(matchFunc, s))
|
||||||
|
|
||||||
chars = "abcdefghijklmnopqrstuvwxyz"
|
chars = "abcdefghijklmnopqrstuvwxyz"
|
||||||
|
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
from future import standard_library
|
||||||
|
standard_library.install_aliases()
|
||||||
|
from builtins import object
|
||||||
import config
|
import config
|
||||||
import random
|
import random
|
||||||
import BaseHTTPServer
|
import http.server
|
||||||
import webbrowser
|
import webbrowser
|
||||||
from twython import Twython, TwythonError
|
from twython import Twython, TwythonError
|
||||||
from keys import keyring
|
from keys import keyring
|
||||||
@ -21,7 +24,7 @@ class twitter(object):
|
|||||||
def authorise(self, settings):
|
def authorise(self, settings):
|
||||||
authorisationHandler.logged = False
|
authorisationHandler.logged = False
|
||||||
port = random.randint(30000, 65535)
|
port = random.randint(30000, 65535)
|
||||||
httpd = BaseHTTPServer.HTTPServer(('127.0.0.1', port), authorisationHandler.handler)
|
httpd = http.server.HTTPServer(('127.0.0.1', port), authorisationHandler.handler)
|
||||||
twitter = Twython(keyring.get("api_key"), keyring.get("api_secret"), auth_endpoint='authorize')
|
twitter = Twython(keyring.get("api_key"), keyring.get("api_secret"), auth_endpoint='authorize')
|
||||||
auth = twitter.get_authentication_tokens("http://127.0.0.1:{0}".format(port,))
|
auth = twitter.get_authentication_tokens("http://127.0.0.1:{0}".format(port,))
|
||||||
webbrowser.open_new_tab(auth['auth_url'])
|
webbrowser.open_new_tab(auth['auth_url'])
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
from builtins import str
|
||||||
|
from builtins import range
|
||||||
import url_shortener, re
|
import url_shortener, re
|
||||||
import output
|
import output
|
||||||
from twython import TwythonError
|
from twython import TwythonError
|
||||||
|
@ -1,17 +1,20 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
from builtins import str
|
||||||
|
from past.utils import old_div
|
||||||
def convert_bytes(n):
|
def convert_bytes(n):
|
||||||
K, M, G, T, P = 1 << 10, 1 << 20, 1 << 30, 1 << 40, 1 << 50
|
K, M, G, T, P = 1 << 10, 1 << 20, 1 << 30, 1 << 40, 1 << 50
|
||||||
if n >= P:
|
if n >= P:
|
||||||
return '%.2fPb' % (float(n) / T)
|
return '%.2fPb' % (old_div(float(n), T))
|
||||||
elif n >= T:
|
elif n >= T:
|
||||||
return '%.2fTb' % (float(n) / T)
|
return '%.2fTb' % (old_div(float(n), T))
|
||||||
elif n >= G:
|
elif n >= G:
|
||||||
return '%.2fGb' % (float(n) / G)
|
return '%.2fGb' % (old_div(float(n), G))
|
||||||
elif n >= M:
|
elif n >= M:
|
||||||
return '%.2fMb' % (float(n) / M)
|
return '%.2fMb' % (old_div(float(n), M))
|
||||||
elif n >= K:
|
elif n >= K:
|
||||||
return '%.2fKb' % (float(n) / K)
|
return '%.2fKb' % (old_div(float(n), K))
|
||||||
else:
|
else:
|
||||||
return '%d' % n
|
return '%d' % n
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
from __future__ import division
|
||||||
|
from builtins import str
|
||||||
|
from past.utils import old_div
|
||||||
import wx
|
import wx
|
||||||
import application
|
import application
|
||||||
from . import utils
|
from . import utils
|
||||||
@ -25,7 +28,7 @@ def progress_callback(total_downloaded, total_size):
|
|||||||
if total_downloaded == total_size:
|
if total_downloaded == total_size:
|
||||||
progress_dialog.Destroy()
|
progress_dialog.Destroy()
|
||||||
else:
|
else:
|
||||||
progress_dialog.Update((total_downloaded*100)/total_size, _(u"Updating... %s of %s") % (str(utils.convert_bytes(total_downloaded)), str(utils.convert_bytes(total_size))))
|
progress_dialog.Update(old_div((total_downloaded*100),total_size), _(u"Updating... %s of %s") % (str(utils.convert_bytes(total_downloaded)), str(utils.convert_bytes(total_size))))
|
||||||
|
|
||||||
def update_finished():
|
def update_finished():
|
||||||
ms = wx.MessageDialog(None, _(u"The update has been downloaded and installed successfully. Press OK to continue."), _(u"Done!")).ShowModal()
|
ms = wx.MessageDialog(None, _(u"The update has been downloaded and installed successfully. Press OK to continue."), _(u"Done!")).ShowModal()
|
@ -1,5 +1,7 @@
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
import urllib
|
from future import standard_library
|
||||||
|
standard_library.install_aliases()
|
||||||
|
import urllib.request, urllib.parse, urllib.error
|
||||||
|
|
||||||
from .url_shortener import URLShortener
|
from .url_shortener import URLShortener
|
||||||
|
|
||||||
@ -11,7 +13,7 @@ class ClckruShortener (URLShortener):
|
|||||||
|
|
||||||
def _shorten (self, url):
|
def _shorten (self, url):
|
||||||
answer = url
|
answer = url
|
||||||
api = urllib.urlopen ("http://clck.ru/--?url=" + urllib.quote(url))
|
api = urllib.request.urlopen ("http://clck.ru/--?url=" + urllib.parse.quote(url))
|
||||||
if api.getcode() == 200:
|
if api.getcode() == 200:
|
||||||
answer = api.read()
|
answer = api.read()
|
||||||
api.close()
|
api.close()
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
import urllib
|
from future import standard_library
|
||||||
|
standard_library.install_aliases()
|
||||||
|
import urllib.request, urllib.parse, urllib.error
|
||||||
|
|
||||||
from .url_shortener import URLShortener
|
from .url_shortener import URLShortener
|
||||||
|
|
||||||
@ -10,7 +12,7 @@ class HKCShortener (URLShortener):
|
|||||||
|
|
||||||
def _shorten (self, url):
|
def _shorten (self, url):
|
||||||
answer = url
|
answer = url
|
||||||
api = urllib.urlopen ("http://hkc.im/yourls-api.php?action=shorturl&format=simple&url=" + urllib.quote(url))
|
api = urllib.request.urlopen ("http://hkc.im/yourls-api.php?action=shorturl&format=simple&url=" + urllib.parse.quote(url))
|
||||||
if api.getcode() == 200:
|
if api.getcode() == 200:
|
||||||
answer = api.read()
|
answer = api.read()
|
||||||
api.close()
|
api.close()
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
import urllib
|
from future import standard_library
|
||||||
|
standard_library.install_aliases()
|
||||||
|
import urllib.request, urllib.parse, urllib.error
|
||||||
|
|
||||||
from .url_shortener import URLShortener
|
from .url_shortener import URLShortener
|
||||||
|
|
||||||
@ -11,7 +13,7 @@ class IsgdShortener (URLShortener):
|
|||||||
|
|
||||||
def _shorten (self, url):
|
def _shorten (self, url):
|
||||||
answer = url
|
answer = url
|
||||||
api = urllib.urlopen ("http://is.gd/api.php?longurl=" + urllib.quote(url))
|
api = urllib.request.urlopen ("http://is.gd/api.php?longurl=" + urllib.parse.quote(url))
|
||||||
if api.getcode() == 200:
|
if api.getcode() == 200:
|
||||||
answer = api.read()
|
answer = api.read()
|
||||||
api.close()
|
api.close()
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
import urllib
|
from future import standard_library
|
||||||
|
standard_library.install_aliases()
|
||||||
|
import urllib.request, urllib.parse, urllib.error
|
||||||
|
|
||||||
from .url_shortener import URLShortener
|
from .url_shortener import URLShortener
|
||||||
|
|
||||||
@ -10,7 +12,7 @@ class OnjmeShortener (URLShortener):
|
|||||||
|
|
||||||
def _shorten (self, url):
|
def _shorten (self, url):
|
||||||
answer = url
|
answer = url
|
||||||
api = urllib.urlopen ("http://onj.me/yourls-api.php?action=shorturl&format=simple&url=" + urllib.quote(url))
|
api = urllib.request.urlopen ("http://onj.me/yourls-api.php?action=shorturl&format=simple&url=" + urllib.parse.quote(url))
|
||||||
if api.getcode() == 200:
|
if api.getcode() == 200:
|
||||||
answer = api.read()
|
answer = api.read()
|
||||||
api.close()
|
api.close()
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
import urllib
|
from future import standard_library
|
||||||
|
standard_library.install_aliases()
|
||||||
|
import urllib.request, urllib.parse, urllib.error
|
||||||
|
|
||||||
from .url_shortener import URLShortener
|
from .url_shortener import URLShortener
|
||||||
|
|
||||||
@ -10,7 +12,7 @@ class TinyArrowsShortener (URLShortener):
|
|||||||
|
|
||||||
def _shorten (self, url):
|
def _shorten (self, url):
|
||||||
answer = url
|
answer = url
|
||||||
answer = urllib.urlopen("http://tinyarro.ws/api-create.php?utfpure=1&url=%s" % urllib.quote(url)).read()
|
answer = urllib.request.urlopen("http://tinyarro.ws/api-create.php?utfpure=1&url=%s" % urllib.parse.quote(url)).read()
|
||||||
return answer.decode('UTF-8')
|
return answer.decode('UTF-8')
|
||||||
|
|
||||||
def created_url(self, url):
|
def created_url(self, url):
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
from future import standard_library
|
||||||
|
standard_library.install_aliases()
|
||||||
from .url_shortener import URLShortener
|
from .url_shortener import URLShortener
|
||||||
import urllib
|
import urllib.request, urllib.parse, urllib.error
|
||||||
class TinyurlShortener (URLShortener):
|
class TinyurlShortener (URLShortener):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.name = "TinyURL.com"
|
self.name = "TinyURL.com"
|
||||||
@ -9,7 +11,7 @@ class TinyurlShortener (URLShortener):
|
|||||||
def _shorten (self, url):
|
def _shorten (self, url):
|
||||||
|
|
||||||
answer = url
|
answer = url
|
||||||
api = urllib.urlopen ("http://tinyurl.com/api-create.php?url=" + urllib.quote(url))
|
api = urllib.request.urlopen ("http://tinyurl.com/api-create.php?url=" + urllib.parse.quote(url))
|
||||||
if api.getcode() == 200:
|
if api.getcode() == 200:
|
||||||
answer = api.read()
|
answer = api.read()
|
||||||
api.close()
|
api.close()
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
from httplib import HTTPConnection
|
from future import standard_library
|
||||||
from urlparse import urlparse
|
standard_library.install_aliases()
|
||||||
|
from builtins import object
|
||||||
|
from http.client import HTTPConnection
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
|
|
||||||
class URLShortener (object):
|
class URLShortener (object):
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
import urllib
|
from future import standard_library
|
||||||
|
standard_library.install_aliases()
|
||||||
|
import urllib.request, urllib.parse, urllib.error
|
||||||
|
|
||||||
from .url_shortener import URLShortener
|
from .url_shortener import URLShortener
|
||||||
|
|
||||||
@ -10,7 +12,7 @@ class XedccShortener (URLShortener):
|
|||||||
|
|
||||||
def _shorten (self, url):
|
def _shorten (self, url):
|
||||||
answer = url
|
answer = url
|
||||||
api = urllib.urlopen ("http://xed.cc/yourls-api.php?action=shorturl&format=simple&url=" + urllib.quote(url))
|
api = urllib.request.urlopen ("http://xed.cc/yourls-api.php?action=shorturl&format=simple&url=" + urllib.parse.quote(url))
|
||||||
if api.getcode() == 200:
|
if api.getcode() == 200:
|
||||||
answer = api.read()
|
answer = api.read()
|
||||||
api.close()
|
api.close()
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from builtins import range
|
||||||
|
from builtins import object
|
||||||
from gi.repository import Gtk, Gdk
|
from gi.repository import Gtk, Gdk
|
||||||
from gi.repository import GObject
|
from gi.repository import GObject
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from builtins import range
|
||||||
from . import baseDialog
|
from . import baseDialog
|
||||||
import wx
|
import wx
|
||||||
import logging as original_logger
|
import logging as original_logger
|
||||||
@ -214,7 +215,7 @@ class other_buffers(wx.Panel):
|
|||||||
output.speak(self.buffers.get_text_column(current, 2),True)
|
output.speak(self.buffers.get_text_column(current, 2),True)
|
||||||
def get_list(self):
|
def get_list(self):
|
||||||
buffers_list = []
|
buffers_list = []
|
||||||
for i in xrange(0, self.buffers.get_count()):
|
for i in range(0, self.buffers.get_count()):
|
||||||
if self.buffers.get_text_column(i, 2) == _(u"Show"):
|
if self.buffers.get_text_column(i, 2) == _(u"Show"):
|
||||||
buffers_list.append(self.buffers.get_text_column(i, 0))
|
buffers_list.append(self.buffers.get_text_column(i, 0))
|
||||||
return buffers_list
|
return buffers_list
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from builtins import str
|
||||||
import wx
|
import wx
|
||||||
import widgetUtils
|
import widgetUtils
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from builtins import range
|
||||||
import wx
|
import wx
|
||||||
import application
|
import application
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user