update files with conflicts

This commit is contained in:
Corentin
2019-07-22 17:28:59 +02:00
244 changed files with 62138 additions and 14005 deletions

View File

@@ -2,20 +2,21 @@
import datetime
name = 'TWBlue'
short_name='twblue'
snapshot = True
if snapshot == False:
version = "0.94"
version = "0.95"
update_url = 'https://twblue.es/updates/stable.php'
mirror_update_url = 'https://raw.githubusercontent.com/manuelcortez/TWBlue/next-gen/updates/stable.json'
else:
version = "14"
update_url = 'https://twblue.es/updates/snapshot.php'
mirror_update_url = 'https://raw.githubusercontent.com/manuelcortez/TWBlue/next-gen/updates/snapshots.json'
authors = [u"Manuel Cortéz", u"José Manuel Delicado"]
authors = ["Manuel Cortéz", "José Manuel Delicado"]
authorEmail = "manuel@manuelcortez.net"
copyright = u"Copyright (C) 2013-2018, 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.")
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)"]
copyright = "Copyright (C) 2013-2018, Manuel cortéz."
description = 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 = ["Manuel Cortéz (English)", "Mohammed Al Shara, Hatoun Felemban (Arabic)", "Francisco Torres (Catalan)", "Manuel cortéz (Spanish)", "Sukil Etxenike Arizaleta (Basque)", "Jani Kinnunen (finnish)", "Rémy Ruiz (French)", "Juan Buño (Galician)", "Steffen Schultz (German)", "Zvonimir Stanečić (Croatian)", "Robert Osztolykan (Hungarian)", "Christian Leo Mameli (Italian)", "Riku (Japanese)", "Paweł Masarczyk (Polish)", "Odenilton Júnior Santos (Portuguese)", "Florian Ionașcu, Nicușor Untilă (Romanian)", "Natalia Hedlund, Valeria Kuznetsova (Russian)", "Aleksandar Đurić (Serbian)", "Burak Yüksek (Turkish)"]
url = u"https://twblue.es"
report_bugs_url = "https://github.com/manuelcortez/twblue/issues"
supported_languages = []

View File

@@ -1,3 +1,4 @@
from __future__ import unicode_literals
from functools import wraps
def matches_url(url):

View File

@@ -1,3 +1,4 @@
from __future__ import unicode_literals
from audio_services import matches_url
import youtube_utils
import requests

View File

@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import youtube_dl
def get_video_url(url):
@@ -9,4 +10,4 @@ def get_video_url(url):
video = result['entries'][0]
else:
video = result
return video["url"]
return video["formats"][0]["url"]

View File

@@ -1,4 +1,5 @@
# -*- coding: cp1252 -*-
import os
import config_utils
import paths
import logging
@@ -16,7 +17,7 @@ changed_keymap = False
def setup ():
global app
log.debug("Loading global app settings...")
app = config_utils.load_config(paths.config_path(MAINFILE), paths.app_path(MAINSPEC))
app = config_utils.load_config(os.path.join(paths.config_path(), MAINFILE), os.path.join(paths.app_path(), MAINSPEC))
log.debug("Loading keymap...")
global keymap
if float(platform.version()[:2]) >= 10 and app["app-settings"]["load_keymap"] == "default.keymap":
@@ -24,4 +25,4 @@ def setup ():
app.write()
global changed_keymap
changed_keymap = True
keymap = config_utils.load_config(paths.config_path("keymap.keymap"), paths.app_path("keymaps/"+app['app-settings']['load_keymap']), copy=False)
keymap = config_utils.load_config(os.path.join(paths.config_path(), "keymap.keymap"), os.path.join(paths.app_path(), "keymaps/"+app['app-settings']['load_keymap']), copy=False)

View File

@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from builtins import object
import os
import widgetUtils
import logging

View File

@@ -4,4 +4,5 @@
Currently, the package contains the following modules:
* baseBuffers: Define a set of functions and structure to be expected in all buffers. New buffers should inherit its classes from one of the classes present here.
* twitterBuffers: All other code, specific to Twitter.
"""
"""
from __future__ import unicode_literals

View File

@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
""" Common logic to all buffers in TWBlue."""
from __future__ import unicode_literals
from builtins import object
import logging
import wx
import output

View File

@@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from builtins import str
from builtins import range
import time
import platform
if platform.system() == "Windows":
@@ -67,7 +70,7 @@ class baseBufferController(baseBuffers.buffer):
""" Get buffer name from a set of different techniques."""
# firstly let's take the easier buffers.
basic_buffers = dict(home_timeline=_(u"Home"), mentions=_(u"Mentions"), direct_messages=_(u"Direct messages"), sent_direct_messages=_(u"Sent direct messages"), sent_tweets=_(u"Sent tweets"), favourites=_(u"Likes"), followers=_(u"Followers"), friends=_(u"Friends"), blocked=_(u"Blocked users"), muted=_(u"Muted users"))
if self.name in basic_buffers.keys():
if self.name in list(basic_buffers.keys()):
return basic_buffers[self.name]
# Check user timelines
elif hasattr(self, "username"):
@@ -266,7 +269,7 @@ class baseBufferController(baseBuffers.buffer):
def remove_tweet(self, id):
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:
self.session.db[self.name].pop(i)
self.remove_item(i)

View File

@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from builtins import object
import time
import widgetUtils
import application
@@ -51,7 +53,7 @@ class filterManager(object):
def insert_filters(self, filters):
self.dialog.filters.clear()
for f in filters.keys():
for f in list(filters.keys()):
filterName = f
buffer = filters[f]["in_buffer"]
if filters[f]["if_word_exists"] == "True" and filters[f]["word"] != "":

View File

@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from builtins import object
import widgetUtils
import output
from wxUI.dialogs import lists

View File

@@ -1,5 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from builtins import str
from builtins import range
from builtins import object
import platform
system = platform.system()
import application
@@ -268,7 +271,7 @@ class Controller(object):
self.start_buffers(sessions.sessions[i])
self.set_buffer_positions(sessions.sessions[i])
if config.app["app-settings"]["play_ready_sound"] == True:
sessions.sessions[sessions.sessions.keys()[0]].sound.play("ready.ogg")
sessions.sessions[list(sessions.sessions.keys())[0]].sound.play("ready.ogg")
if config.app["app-settings"]["speak_ready_msg"] == True:
output.speak(_(u"Ready"))
self.started = True
@@ -465,7 +468,7 @@ class Controller(object):
output.speak(_(u"Empty buffer."), True)
return
start = page.buffer.list.get_selected()
for i in xrange(start, count):
for i in range(start, count):
if string.lower() in page.buffer.list.get_text_column(i, 1).lower():
page.buffer.list.select_item(i)
return output.speak(page.get_message(), True)
@@ -969,8 +972,8 @@ class Controller(object):
x = tweet["coordinates"]["coordinates"][0]
y = tweet["coordinates"]["coordinates"][1]
address = geocoder.reverse_geocode(y, x, language = languageHandler.curLang)
if event == None: output.speak(address[0].__str__().decode("utf-8"))
else: self.view.show_address(address[0].__str__().decode("utf-8"))
if event == None: output.speak(address[0].__str__())
else: self.view.show_address(address[0].__str__())
else:
output.speak(_(u"There are no coordinates in this tweet"))
except GeocoderError:
@@ -1580,7 +1583,7 @@ class Controller(object):
elif "quoted_status" in tweet and "media" in tweet["quoted_status"]["entities"]:
[media_list.append(i) for i in tweet["quoted_status"]["entities"]["media"] if i not in media_list]
if len(media_list) > 1:
image_list = [_(u"Picture {0}").format(i,) for i in xrange(0, len(media_list))]
image_list = [_(u"Picture {0}").format(i,) for i in range(0, len(media_list))]
dialog = dialogs.urlList.urlList(title=_(u"Select the picture"))
if dialog.get_response() == widgetUtils.OK:
img = media_list[dialog.get_item()]

View File

@@ -1,5 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from builtins import str
from builtins import range
from builtins import object
import re
import platform
from . import attach
@@ -173,14 +177,14 @@ class reply(tweet):
def get_ids(self):
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:
excluded_ids = excluded_ids + "{0},".format(self.ids[i],)
return excluded_ids
def get_people(self):
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:
people = people + "{0} ".format(self.message.checkboxes[i].GetLabel(),)
return people
@@ -205,7 +209,7 @@ class viewTweet(basicTweet):
self.title = _(u"Tweet")
image_description = []
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.
if "message" in tweetList[i] and tweetList[i]["is_quote_status"] == False:
value = "message"
@@ -231,7 +235,7 @@ class viewTweet(basicTweet):
rt_count = str(tweet["retweet_count"])
favs_count = str(tweet["favorite_count"])
# Gets the client from where this tweet was made.
source = str(re.sub(r"(?s)<.*?>", "", tweet["source"].encode("utf-8")))
source = re.sub(r"(?s)<.*?>", "", tweet["source"])
original_date = arrow.get(tweet["created_at"], "ddd MMM DD H:m:s Z YYYY", locale="en")
date = original_date.replace(seconds=utc_offset).format(_(u"MMM D, YYYY. H:m"), locale=languageHandler.getLanguage())
if text == "":
@@ -255,7 +259,7 @@ class viewTweet(basicTweet):
for z in tweet["retweeted_status"]["extended_entities"]["media"]:
if "ext_alt_text" in z and z["ext_alt_text"] != None:
image_description.append(z["ext_alt_text"])
self.message = message.viewTweet(text, rt_count, favs_count, source.decode("utf-8"), date)
self.message = message.viewTweet(text, rt_count, favs_count, source, date)
self.message.set_title(len(text))
[self.message.set_image_description(i) for i in image_description]
else:

View File

@@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from builtins import str
from builtins import object
import os
import webbrowser
import sound_lib
@@ -49,7 +52,7 @@ class globalSettingsController(object):
id = self.codes.index(config.app["app-settings"]["language"])
self.kmfriendlies=[]
self.kmnames=[]
for k,v in self.kmmap.items():
for k,v in list(self.kmmap.items()):
self.kmfriendlies.append(k)
self.kmnames.append(v)
self.kmid=self.kmnames.index(config.app['app-settings']['load_keymap'])
@@ -291,7 +294,7 @@ class accountSettingsController(globalSettingsController):
all_buffers['muted']=_(u"Muted users")
list_buffers = []
hidden_buffers=[]
all_buffers_keys = all_buffers.keys()
all_buffers_keys = list(all_buffers.keys())
# Check buffers shown first.
for i in self.config["general"]["buffer_order"]:
if i in all_buffers_keys:

View File

@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from builtins import object
from wxUI.dialogs import trends
import widgetUtils

View File

@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from builtins import object
import wx
import webbrowser
import widgetUtils

View File

@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from builtins import object
import re
import widgetUtils
import output

View File

@@ -17,6 +17,9 @@
#
############################################################
from __future__ import absolute_import
from __future__ import unicode_literals
from builtins import str
from builtins import object
import widgetUtils
from . import wx_ui
from . import wx_transfer_dialogs
@@ -132,7 +135,7 @@ class audioUploader(object):
def _play(self):
output.speak(_(u"Playing..."))
# 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.dialog.set("play", _(u"&Stop"))
try:

View File

@@ -1,5 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from builtins import object
from past.utils import old_div
import sys
import threading
import time
@@ -21,7 +25,7 @@ class Upload(object):
self.background_thread = None
self.transfer_rate = 0
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.fin=open(self.filename, 'rb')
self.m = MultipartEncoder(fields={field:(self.local_filename, self.fin, "application/octet-stream")})
@@ -45,10 +49,10 @@ class Upload(object):
self.transfer_rate = 0
else:
progress["percent"] = int((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)
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:
progress["eta"] = 0
pub.sendMessage("uploading", data=progress)

View File

@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from builtins import str
def convert_bytes(n):
K, M, G, T, P = 1 << 10, 1 << 20, 1 << 30, 1 << 40, 1 << 50
if n >= P:

View File

@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import wx
from .utils import *
import widgetUtils

View File

@@ -16,6 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
############################################################
from __future__ import unicode_literals
import wx
import widgetUtils
import output

View File

@@ -1,2 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
from .soundsTutorial import soundsTutorial

View File

@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from gi.repository import Gtk
import widgetUtils

View File

@@ -1,3 +1,4 @@
from __future__ import unicode_literals
#Reverse sort, by Bill Dengler <codeofdusk@gmail.com> for use in TWBlue http://twblue.es
def invert_tuples(t):
"Invert a list of tuples, so that the 0th element becomes the -1th, and the -1th becomes the 0th."

View File

@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from builtins import object
import platform
import widgetUtils
import os

View File

@@ -1,5 +1,6 @@
#-*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
#-*- coding: utf-8 -*-
from . import reverse_sort
import application

View File

@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import wx
import widgetUtils

View File

@@ -1,4 +1,5 @@
from __future__ import absolute_import
from __future__ import unicode_literals
from . import spellchecker
import platform
if platform.system() == "Windows":

View File

@@ -1,5 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from builtins import next
from builtins import object
import os
import logging
from . import wx_ui

View File

@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from enchant.tokenize import Filter

View File

@@ -16,6 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
############################################################
from __future__ import unicode_literals
import wx
import application

View File

@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
# -*- coding: utf-8 -*-
from . import completion, settings

View File

@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from builtins import object
import output
from . import storage
from . import wx_menu

View File

@@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
# -*- coding: utf-8 -*-
from builtins import object
from . import storage
import widgetUtils
from . import wx_manage

View File

@@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
# -*- coding: utf-8 -*-
from builtins import object
from . import storage
import widgetUtils
from . import wx_settings

View File

@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from builtins import object
import sqlite3, paths
class storage(object):

View File

@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import wx
import widgetUtils
from multiplatform_widgets import widgets

View File

@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import wx
class menu(wx.Menu):

View File

@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import wx
import widgetUtils
import application

View File

@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
""" original module taken and modified from https://github.com/ctoth/cloudOCR"""
from __future__ import unicode_literals
from builtins import object
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")]

View File

@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
# -*- coding: utf-8 -*-
from . import OCRSpace

View File

@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from . import translator
import platform
if platform.system() == "Windows":

View File

@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from builtins import zip
from yandex_translate import YandexTranslate
def translate(text="", target="en"):

View File

@@ -17,6 +17,7 @@
#
############################################################
from __future__ import absolute_import
from __future__ import unicode_literals
# -*- coding: utf-8 -*-
############################################################
# Copyright (c) 2013, 2014 Manuel Eduardo Cortéz Vallejo <manuel@manuelcortez.net>

View File

@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
""" This module contains some bugfixes for packages used in TWBlue."""
from __future__ import absolute_import
from __future__ import unicode_literals
import sys
from . import fix_arrow # A few new locales for Three languages in arrow.
from . import fix_libloader # Regenerates comcache properly.

View File

@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from arrow import locales
from arrow.locales import Locale

View File

@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import win32com
import paths

View File

@@ -1,3 +1,4 @@
from __future__ import unicode_literals
from requests import certs, utils, adapters
import paths
import config

View File

@@ -1,8 +1,11 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from future import standard_library
standard_library.install_aliases()
from requests.packages import urllib3
from requests.packages.urllib3 import fields
import six
import urllib
import urllib.request, urllib.parse, urllib.error
def fix():
urllib3.disable_warnings()
@@ -19,6 +22,6 @@ def patched_format_header_param(name, value):
return result
if not six.PY3 and isinstance(value, six.text_type): # Python 2:
value = value.encode('utf-8')
value=urllib.quote(value, safe='')
value=urllib.parse.quote(value, safe='')
value = '%s=%s' % (name, value)
return value

View File

@@ -1,3 +1,4 @@
from __future__ import unicode_literals
import win32com.client
def fix():
if win32com.client.gencache.is_readonly == True:

View File

@@ -16,6 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
############################################################
from __future__ import unicode_literals
categories = ["General"]
reproducibilities = ["always", "sometimes", "random", "have not tried", "unable to duplicate"]
severities = ["block", "crash", "major", "minor", "tweak", "text", "trivial", "feature"]

View File

@@ -16,6 +16,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
############################################################
from __future__ import unicode_literals
from builtins import object
import keys
import wx
import wx_ui

View File

@@ -16,6 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
############################################################
from __future__ import unicode_literals
import wx
import widgetUtils
import application

View File

@@ -1,3 +1,3 @@
from main import KeyboardHandler, KeyboardHandlerError
#from wx_handler import WXKeyboardHandler
__all__ = ["KeyboardHandler", "KeyboardHandlerError", "WXKeyboardHandler", "WXPanelKeyboardHandler"]
from __future__ import absolute_import
from .main import KeyboardHandler, KeyboardHandlerError
__all__ = ["KeyboardHandler", "KeyboardHandlerError", ]

View File

@@ -1,7 +1,8 @@
from __future__ import absolute_import
import platform
if platform.system() == 'Linux':
from linux import LinuxKeyboardHandler as GlobalKeyboardHandler
elif platform.system() == 'Windows':
from wx_handler import WXKeyboardHandler as GlobalKeyboardHandler
elif platform.system() == 'Darwin':
from osx import OSXKeyboardHandler as GlobalKeyboardHandler
from .linux import LinuxKeyboardHandler as GlobalKeyboardHandler
else:
from .wx_handler import WXKeyboardHandler as GlobalKeyboardHandler
#elif platform.system() == 'Darwin':
#from osx import OSXKeyboardHandler as GlobalKeyboardHandler

View File

@@ -0,0 +1,128 @@
keys = {
'accept': 30,
'add': 107,
'apps': 93,
'attn': 246,
'back': 8,
'browser_back': 166,
'browser_forward': 167,
'cancel': 3,
'capital': 20,
'clear': 12,
'control': 17,
'convert': 28,
'crsel': 247,
'decimal': 110,
'delete': 46,
'divide': 111,
'down': 40,
'end': 35,
'ereof': 249,
'escape': 27,
'execute': 43,
'exsel': 248,
'f1': 112,
'f10': 121,
'f11': 122,
'f12': 123,
'f13': 124,
'f14': 125,
'f15': 126,
'f16': 127,
'f17': 128,
'f18': 129,
'f19': 130,
'f2': 113,
'f20': 131,
'f21': 132,
'f22': 133,
'f23': 134,
'f24': 135,
'f3': 114,
'f4': 115,
'f5': 116,
'f6': 117,
'f7': 118,
'f8': 119,
'f9': 120,
'final': 24,
'hangeul': 21,
'hangul': 21,
'hanja': 25,
'help': 47,
'home': 36,
'insert': 45,
'junja': 23,
'kana': 21,
'kanji': 25,
'lbutton': 1,
'lcontrol': 162,
'left': 37,
'lmenu': 164,
'lshift': 160,
'lwin': 91,
'mbutton': 4,
'media_next_track': 176,
'media_play_pause': 179,
'media_prev_track': 177,
'menu': 18,
'modechange': 31,
'multiply': 106,
'next': 34,
'noname': 252,
'nonconvert': 29,
'numlock': 144,
'numpad0': 96,
'numpad1': 97,
'numpad2': 98,
'numpad3': 99,
'numpad4': 100,
'numpad5': 101,
'numpad6': 102,
'numpad7': 103,
'numpad8': 104,
'numpad9': 105,
'oem_clear': 254,
'pa1': 253,
'pagedown': 34,
'pageup': 33,
'pause': 19,
'play': 250,
'print': 42,
'prior': 33,
'processkey': 229,
'rbutton': 2,
'rcontrol': 163,
'return': 13,
'right': 39,
'rmenu': 165,
'rshift': 161,
'rwin': 92,
'scroll': 145,
'select': 41,
'separator': 108,
'shift': 16,
'snapshot': 44,
'space': 32,
'subtract': 109,
'tab': 9,
'up': 38,
'volume_down': 174,
'volume_mute': 173,
'volume_up': 175,
'xbutton1': 5,
'xbutton2': 6,
'zoom': 251,
'/': 191,
';': 218,
'[': 219,
'\\': 220,
']': 221,
'\'': 222,
'=': 187,
'-': 189,
';': 186,
}
modifiers = {'alt': 1, 'control': 2, 'shift': 4, 'win': 8}

View File

@@ -18,17 +18,17 @@ class KeyboardHandler(object):
def register_key (self, key, function):
if key in self.active_keys:
raise KeyboardHandlerError, "Key %s is already registered to a function" % key
raise KeyboardHandlerError("Key %s is already registered to a function" % key)
if not callable(function):
raise TypeError, "Must provide a callable to be invoked upon keypress"
raise TypeError("Must provide a callable to be invoked upon keypress")
self.active_keys[key] = function
def unregister_key (self, key, function):
try:
if self.active_keys[key] != function:
raise KeyboardHandlerError, "key %s is not registered to that function" % key
raise KeyboardHandlerError("key %s is not registered to that function" % key)
except KeyError:
raise KeyboardHandlerError, "Key %s not currently registered"
raise KeyboardHandlerError("Key %s not currently registered" % key)
del(self.active_keys[key])
def unregister_all_keys(self):

View File

@@ -1,11 +1,14 @@
from __future__ import absolute_import
import functools
import logging
logger = logging.getLogger("keyboard_handler")
import wx
import platform
from main import KeyboardHandler
from .main import KeyboardHandler, KeyboardHandlerError
from . import key_constants
__all__ = ['WXKeyboardHandler', 'WXControlKeyboardHandler']
def call_after(func):
def wrapper(*args, **kwargs):
wx.CallAfter(func, *args, **kwargs)
@@ -34,6 +37,7 @@ class BaseWXKeyboardHandler(KeyboardHandler):
return (mods, keystroke[-1])
def keycode_from_key(self, key):
result = None
if key in self.replacement_mods:
result = self.replacement_mods[key]
elif key in self.replacement_keys:
@@ -42,33 +46,40 @@ class BaseWXKeyboardHandler(KeyboardHandler):
result -= 277
elif len(key) == 1:
result = ord(key.upper())
print "result: ", result
if result is None:
raise KeyboardHandlerError("Could not translate key %r into a valid keycode." % key)
return result
class WXKeyboardHandler(BaseWXKeyboardHandler):
#try:
if platform.system() == "Windows":
from windows import WindowsKeyboardHandler as keyboard_handler
elif platform.system() == "Linux":
from linux import LinuxKeyboardHandler as keyboard_handler
elif platform.system() == "Darwin":
from osx import OSXKeyboardHandler as keyboard_handler
class WXKeyboardHandler(keyboard_handler):
def __init__ (self, parent, *args, **kwargs):
super(WXKeyboardHandler, self).__init__(*args, **kwargs)
self.parent = parent
self.key_ids = {}
self.replacement_keys = key_constants.keys
self.replacement_mods = key_constants.modifiers
@call_after
def register_key(self, key, function):
super(WXKeyboardHandler, self).register_key(key, function)
key_id = wx.NewId()
parsed = self.parse_key(key)
self.parent.RegisterHotKey(key_id, *parsed)
res = self.parent.RegisterHotKey(key_id, *parsed)
if not res:
logger.warn("Failed to register hotkey: %s for function %r", key, function)
self.parent.Bind(wx.EVT_HOTKEY, lambda evt: self.process_key(evt, key_id), id=key_id)
self.key_ids[key] = key_id
return res
def parse_key (self, keystroke, separator="+"):
keystroke = str(keystroke) #We don't want unicode
keystroke = [self.keycode_from_key(i) for i in keystroke.split(separator)]
mods = 0
for i in keystroke[:-1]:
mods = mods | i #or everything together
return (mods, keystroke[-1])
@call_after
def unregister_key (self, key, function):

View File

@@ -1,8 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from builtins import object
import os
import application
import platform
import exceptions
from ctypes import c_char_p
from libloader import load_library
import paths
@@ -13,9 +14,9 @@ import paths
# lib = load_library("snapshot_api_keys64", x64_path=paths.app_path("keys/lib"))
#else:
if platform.architecture()[0][:2] == "32":
lib = load_library("stable_api_keys32", x86_path=paths.app_path("keys/lib"))
lib = load_library("stable_api_keys32", x86_path=os.path.join(paths.app_path(), "keys", "lib"))
else:
lib = load_library("stable_api_keys64", x64_path=paths.app_path("keys/lib"))
lib = load_library("stable_api_keys64", x64_path=os.path.join(paths.app_path(), "keys", "lib"))
# import linuxKeys
# lib = linuxKeys

View File

@@ -1,3 +1,4 @@
from __future__ import unicode_literals
def get_api_key():
return "8pDLbyOW3saYnvSZ4uLFg\0"

View File

@@ -1,2 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
from .keystrokeEditor import KeystrokeEditor

View File

@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
actions = {
"up": _(u"Go up in the current buffer"),
"down": _(u"Go down in the current buffer"),

View File

@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from builtins import object
import widgetUtils
import config
from . import wx_ui

View File

@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import wx
from multiplatform_widgets import widgets
from wxUI.dialogs import baseDialog

View File

@@ -1,16 +1,17 @@
import __builtin__
from __future__ import unicode_literals
from future import standard_library
standard_library.install_aliases()
from builtins import zip
from builtins import str
import builtins
import os
import sys
import ctypes
import locale
# add mapping for Serbian (latin) language
locale.windows_locale[9242]='sr_RS'
import gettext
import paths
import platform
# A fix for the mac locales
#if platform.system() == 'Darwin':
import application
#a few Windows locale constants
LOCALE_SLANGUAGE=0x2
@@ -29,12 +30,12 @@ def localeNameToWindowsLCID(localeName):
func_LocaleNameToLCID=getattr(ctypes.windll.kernel32,'LocaleNameToLCID',None)
if func_LocaleNameToLCID is not None:
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
localeName=locale.normalize(localeName)
if '.' in localeName:
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:
LCID=LCList[0]
else:
@@ -72,7 +73,6 @@ def getLanguageDescription(language):
"ne":pgettext("languageName","Nepali"),
"sr":pgettext("languageName","Serbian (Latin)"),
"ja":pgettext("languageName","Japanese"),
"ro":pgettext("languageName","Romanian"),
}.get(language,None)
return desc
@@ -82,7 +82,7 @@ def getAvailableLanguages():
"""
#Make a list of all the locales found in NVDA's locale dir
l=[x for x in os.listdir(paths.locale_path()) if not x.startswith('.')]
l=[x for x in l if os.path.isfile(paths.locale_path('%s/LC_MESSAGES/twblue.mo' % x))]
l=[x for x in l if os.path.isfile(os.path.join(paths.locale_path(), '%s/LC_MESSAGES/%s.po' % (x, application.short_name)))]
#Make sure that en (english) is in the list as it may not have any locale files, but is default
if 'en' not in l:
l.append('en')
@@ -98,7 +98,7 @@ def getAvailableLanguages():
# Translators: the label for the Windows default NVDA interface language.
d.append(_("User default"))
#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):
"""Obtaina pgettext function for use with a gettext translations instance.
@@ -108,15 +108,15 @@ def makePgettext(translations):
"""
if isinstance(translations, gettext.GNUTranslations):
def pgettext(context, message):
message = unicode(message)
message = str(message)
try:
# Look up the message with its context.
return translations._catalog[u"%s\x04%s" % (context, message)]
return translations._catalog["%s\x04%s" % (context, message)]
except KeyError:
return message
else:
def pgettext(context, message):
return unicode(message)
return str(message)
return pgettext
def setLanguage(lang):
@@ -132,7 +132,7 @@ def setLanguage(lang):
localeName = Foundation.NSLocale.currentLocale().identifier()
elif system == "Linux":
localeName = locale.getdefaultlocale()[0]
trans=gettext.translation('twblue', localedir=paths.locale_path(), languages=[localeName])
trans=gettext.translation(application.short_name, localedir=paths.locale_path(), languages=[localeName])
curLang=localeName
# else:
# localeName=locale.getdefaultlocale()[0]
@@ -140,7 +140,7 @@ def setLanguage(lang):
# curLang=localeName
else:
trans=gettext.translation("twblue", localedir=paths.locale_path(), languages=[lang])
trans=gettext.translation(application.short_name, localedir=paths.locale_path(), languages=[lang])
curLang=lang
localeChanged=False
#Try setting Python's locale to lang
@@ -164,9 +164,12 @@ def setLanguage(lang):
LCID=localeNameToWindowsLCID(lang)
ctypes.windll.kernel32.SetThreadLocale(LCID)
except IOError:
trans=gettext.translation("twblue",fallback=True)
trans=gettext.translation(application.short_name, fallback=True)
curLang="en"
trans.install(unicode=True)
if sys.version[0] == "3":
trans.install()
else:
trans.install(unicode=True)
# Install our pgettext function.
# __builtin__.__dict__["pgettext"] = makePgettext(trans)
@@ -192,8 +195,7 @@ def langToWindowsLocale(lang):
languages = {"en": "eng",
"ar": "ara",
"ca": "cat",
"da": "dan",
"de": "deu",
"de": "deu",
"es": "esp",
"fi": "fin",
"fr": "fre_FRA",
@@ -205,7 +207,6 @@ def langToWindowsLocale(lang):
"ja": "jpn",
"pl": "plk",
"pt": "ptb",
"ro": "rom",
"ru": "rus",
"tr": "trk",
"sr": "eng",

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More