Made code indentation to comply with PEP8

This commit is contained in:
Manuel Cortez 2021-06-16 16:18:41 -05:00
parent 2aaa4eced3
commit 39e1fb017c
145 changed files with 9577 additions and 9584 deletions

View File

@ -553,7 +553,7 @@ class baseBufferController(baseBuffers.buffer):
url=urls_list.get_string() url=urls_list.get_string()
if hasattr(urls_list, "destroy"): urls_list.destroy() if hasattr(urls_list, "destroy"): urls_list.destroy()
if url != '': if url != '':
# try: # try:
sound.URLPlayer.play(url, self.session.settings["sound"]["volume"]) sound.URLPlayer.play(url, self.session.settings["sound"]["volume"])
# except: # except:
# log.error("Exception while executing audio method.") # log.error("Exception while executing audio method.")

View File

@ -13,8 +13,8 @@ actions = reverse_sort.reverse_sort([ ("audio", _(u"Audio tweet.")),
("favourite", _(u"Tweet liked.")), ("favourite", _(u"Tweet liked.")),
("favourites_timeline_updated", _(u"Likes buffer updated.")), ("favourites_timeline_updated", _(u"Likes buffer updated.")),
("geo", _(u"Geotweet.")), ("geo", _(u"Geotweet.")),
("image", _("Tweet contains one or more images")), ("image", _("Tweet contains one or more images")),
("limit", _(u"Boundary reached.")), ("limit", _(u"Boundary reached.")),
("list_tweet", _(u"List updated.")), ("list_tweet", _(u"List updated.")),
("max_length", _(u"Too many characters.")), ("max_length", _(u"Too many characters.")),
("mention_received", _(u"Mention received.")), ("mention_received", _(u"Mention received.")),

View File

@ -4,7 +4,7 @@ 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).
Unknown modifiers will return ValueError.""" Unknown modifiers will return ValueError."""
m = 0 m = 0
lst = s.split('+') lst = s.split('+')
if not len(lst): return (0, s) if not len(lst): return (0, s)
@ -13,7 +13,7 @@ Unknown modifiers will return ValueError."""
"shift": 1<<pyatspi.MODIFIER_SHIFT, "shift": 1<<pyatspi.MODIFIER_SHIFT,
"control": 1<<pyatspi.MODIFIER_CONTROL, "control": 1<<pyatspi.MODIFIER_CONTROL,
"alt": 1<<pyatspi.MODIFIER_ALT, "alt": 1<<pyatspi.MODIFIER_ALT,
"win":1<<pyatspi.MODIFIER_META3, "win":1<<pyatspi.MODIFIER_META3,
} }
for item in lst: for item in lst:
if item in d: if item in d:
@ -45,8 +45,8 @@ class LinuxKeyboardHandler(KeyboardHandler):
t.start() t.start()
def register_key(self, key, function): def register_key(self, key, function):
"""key will be a string, such as control+shift+f. """key will be a string, such as control+shift+f.
We need to convert that, using parse_key, We need to convert that, using parse_key,
into modifier and key to put into our dictionary.""" into modifier and key to put into our dictionary."""
#register key so we know if we have it on event receive. #register key so we know if we have it on event receive.
t = parse(key) t = parse(key)
keys[t] = function keys[t] = function

View File

@ -1,60 +1,60 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
actions = { actions = {
"up": _(u"Go up in the current buffer"), "up": _(u"Go up in the current buffer"),
"down": _(u"Go down in the current buffer"), "down": _(u"Go down in the current buffer"),
"left": _(u"Go to the previous buffer"), "left": _(u"Go to the previous buffer"),
"right": _(u"Go to the next buffer"), "right": _(u"Go to the next buffer"),
"next_account": _(u"Focus the next session"), "next_account": _(u"Focus the next session"),
"previous_account": _(u"Focus the previous session"), "previous_account": _(u"Focus the previous session"),
"show_hide": _(u"Show or hide the GUI"), "show_hide": _(u"Show or hide the GUI"),
"post_tweet": _(u"New tweet"), "post_tweet": _(u"New tweet"),
"post_reply": _(u"Reply"), "post_reply": _(u"Reply"),
"post_retweet": _(u"Retweet"), "post_retweet": _(u"Retweet"),
"send_dm": _(u"Send direct message"), "send_dm": _(u"Send direct message"),
"add_to_favourites": _(u"Like a tweet"), "add_to_favourites": _(u"Like a tweet"),
"toggle_like": _(u"Like/unlike a tweet"), "toggle_like": _(u"Like/unlike a tweet"),
"remove_from_favourites": _(u"Unlike a tweet"), "remove_from_favourites": _(u"Unlike a tweet"),
"follow": _(u"Open the user actions dialogue"), "follow": _(u"Open the user actions dialogue"),
"user_details": _(u"See user details"), "user_details": _(u"See user details"),
"view_item": _(u"Show tweet"), "view_item": _(u"Show tweet"),
"exit": _(u"Quit"), "exit": _(u"Quit"),
"open_timeline": _(u"Open user timeline"), "open_timeline": _(u"Open user timeline"),
"remove_buffer": _(u"Destroy buffer"), "remove_buffer": _(u"Destroy buffer"),
"interact": _(u"Interact with the currently focused tweet."), "interact": _(u"Interact with the currently focused tweet."),
"url": _(u"Open URL"), "url": _(u"Open URL"),
"open_in_browser": _(u"View in Twitter"), "open_in_browser": _(u"View in Twitter"),
"volume_up": _(u"Increase volume by 5%"), "volume_up": _(u"Increase volume by 5%"),
"volume_down": _(u"Decrease volume by 5%"), "volume_down": _(u"Decrease volume by 5%"),
"go_home": _(u"Jump to the first element of a buffer"), "go_home": _(u"Jump to the first element of a buffer"),
"go_end": _(u"Jump to the last element of the current buffer"), "go_end": _(u"Jump to the last element of the current buffer"),
"go_page_up": _(u"Jump 20 elements up in the current buffer"), "go_page_up": _(u"Jump 20 elements up in the current buffer"),
"go_page_down": _(u"Jump 20 elements down in the current buffer"), "go_page_down": _(u"Jump 20 elements down in the current buffer"),
"update_profile": _(u"Edit profile"), "update_profile": _(u"Edit profile"),
"delete": _(u"Delete a tweet or direct message"), "delete": _(u"Delete a tweet or direct message"),
"clear_buffer": _(u"Empty the current buffer"), "clear_buffer": _(u"Empty the current buffer"),
"repeat_item": _(u"Repeat last item"), "repeat_item": _(u"Repeat last item"),
"copy_to_clipboard": _(u"Copy to clipboard"), "copy_to_clipboard": _(u"Copy to clipboard"),
"add_to_list": _(u"Add to list"), "add_to_list": _(u"Add to list"),
"remove_from_list": _(u"Remove from list"), "remove_from_list": _(u"Remove from list"),
"toggle_buffer_mute": _(u"Mute/unmute the active buffer"), "toggle_buffer_mute": _(u"Mute/unmute the active buffer"),
"toggle_session_mute": _(u"Mute/unmute the current session"), "toggle_session_mute": _(u"Mute/unmute the current session"),
"toggle_autoread": _(u"toggle the automatic reading of incoming tweets in the active buffer"), "toggle_autoread": _(u"toggle the automatic reading of incoming tweets in the active buffer"),
"search": _(u"Search on twitter"), "search": _(u"Search on twitter"),
"find": _(u"Find a string in the currently focused buffer"), "find": _(u"Find a string in the currently focused buffer"),
"edit_keystrokes": _(u"Show the keystroke editor"), "edit_keystrokes": _(u"Show the keystroke editor"),
"view_user_lists": _(u"Show lists for a specified user"), "view_user_lists": _(u"Show lists for a specified user"),
"get_more_items": _(u"load previous items"), "get_more_items": _(u"load previous items"),
"reverse_geocode": _(u"Get geolocation"), "reverse_geocode": _(u"Get geolocation"),
"view_reverse_geocode": _(u"Display the tweet's geolocation in a dialog"), "view_reverse_geocode": _(u"Display the tweet's geolocation in a dialog"),
"get_trending_topics": _(u"Create a trending topics buffer"), "get_trending_topics": _(u"Create a trending topics buffer"),
"open_conversation": _(u"View conversation"), "open_conversation": _(u"View conversation"),
"check_for_updates": _(u"Check and download updates"), "check_for_updates": _(u"Check and download updates"),
"lists_manager": _(u"Opens the list manager, which allows you to create, edit, delete and open lists in buffers."), "lists_manager": _(u"Opens the list manager, which allows you to create, edit, delete and open lists in buffers."),
"configuration": _(u"Opens the global settings dialogue"), "configuration": _(u"Opens the global settings dialogue"),
"list_manager": _(u"Opens the list manager"), "list_manager": _(u"Opens the list manager"),
"accountConfiguration": _(u"Opens the account settings dialogue"), "accountConfiguration": _(u"Opens the account settings dialogue"),
"audio": _(u"Try to play an audio file"), "audio": _(u"Try to play an audio file"),
"update_buffer": _(u"Updates the buffer and retrieves possible lost items there."), "update_buffer": _(u"Updates the buffer and retrieves possible lost items there."),
"ocr_image": _(u"Extracts the text from a picture and displays the result in a dialog."), "ocr_image": _(u"Extracts the text from a picture and displays the result in a dialog."),
} }

View File

@ -195,7 +195,7 @@ def langToWindowsLocale(lang):
languages = {"en": "eng", languages = {"en": "eng",
"ar": "ara", "ar": "ara",
"ca": "cat", "ca": "cat",
"de": "deu", "de": "deu",
"es": "esp", "es": "esp",
"fi": "fin", "fi": "fin",
"fr": "fre_FRA", "fr": "fre_FRA",

View File

@ -17,10 +17,10 @@ class list(object):
# self.set_size() # self.set_size()
def set_windows_size(self, column, characters_max): def set_windows_size(self, column, characters_max):
# it = wx.ListItem() # it = wx.ListItem()
# dc = wx.WindowDC(self.list) # dc = wx.WindowDC(self.list)
# dc.SetFont(it.GetFont()) # dc.SetFont(it.GetFont())
# (x, y) = dc.GetTextExtent("r"*characters_max) # (x, y) = dc.GetTextExtent("r"*characters_max)
self.list.SetColumnWidth(column, characters_max*2) self.list.SetColumnWidth(column, characters_max*2)
def set_size(self): def set_size(self):

View File

@ -20,8 +20,8 @@ def setup ():
global speaker global speaker
logging.debug("Initializing output subsystem.") logging.debug("Initializing output subsystem.")
try: try:
# speaker = speech.Speaker(speech.outputs.Sapi5()) # speaker = speech.Speaker(speech.outputs.Sapi5())
# else: # else:
speaker = outputs.auto.Auto() speaker = outputs.auto.Auto()
except: except:
return logging.exception("Output: Error during initialization.") return logging.exception("Output: Error during initialization.")

View File

@ -23,7 +23,7 @@ def config_path():
elif mode == "installed": elif mode == "installed":
path = os.path.join(data_path(), "config") path = os.path.join(data_path(), "config")
if not os.path.exists(path): if not os.path.exists(path):
# log.debug("%s path does not exist, creating..." % (path,)) # log.debug("%s path does not exist, creating..." % (path,))
os.mkdir(path) os.mkdir(path)
return path return path
@ -35,7 +35,7 @@ def logs_path():
elif mode == "installed": elif mode == "installed":
path = os.path.join(data_path(), "logs") path = os.path.join(data_path(), "logs")
if not os.path.exists(path): if not os.path.exists(path):
# log.debug("%s path does not exist, creating..." % (path,)) # log.debug("%s path does not exist, creating..." % (path,))
os.mkdir(path) os.mkdir(path)
return path return path
@ -62,6 +62,6 @@ def com_path():
elif mode == "installed": elif mode == "installed":
path = os.path.join(data_path(), "com_cache") path = os.path.join(data_path(), "com_cache")
if not os.path.exists(path): if not os.path.exists(path):
# log.debug("%s path does not exist, creating..." % (path,)) # log.debug("%s path does not exist, creating..." % (path,))
os.mkdir(path) os.mkdir(path)
return path return path

View File

@ -16,13 +16,13 @@ def setup():
manager = sessionManager() manager = sessionManager()
class sessionManager(object): class sessionManager(object):
# def __init__(self): # def __init__(self):
# FILE = "sessions.conf" # FILE = "sessions.conf"
# SPEC = "app-configuration.defaults" # SPEC = "app-configuration.defaults"
# try: # try:
# self.main = Configuration(paths.config_path(FILE), paths.app_path(SPEC)) # self.main = Configuration(paths.config_path(FILE), paths.app_path(SPEC))
# except ConfigurationResetException: # except ConfigurationResetException:
# pass # pass
def get_current_session(self): def get_current_session(self):
if self.is_valid(config.app["sessions"]["current_session"]): if self.is_valid(config.app["sessions"]["current_session"]):

View File

@ -1,11 +1,4 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
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

View File

@ -44,7 +44,7 @@ build_exe_options = dict(
replace_paths = [("*", "")], replace_paths = [("*", "")],
include_files=["icon.ico", "conf.defaults", "app-configuration.defaults", "keymaps", "locales", "sounds", "documentation", ("keys/lib", "keys/lib"), find_sound_lib_datafiles(), find_accessible_output2_datafiles()]+get_architecture_files(), include_files=["icon.ico", "conf.defaults", "app-configuration.defaults", "keymaps", "locales", "sounds", "documentation", ("keys/lib", "keys/lib"), find_sound_lib_datafiles(), find_accessible_output2_datafiles()]+get_architecture_files(),
packages=["wxUI"], packages=["wxUI"],
) )
executables = [ executables = [
Executable('main.py', base=base, targetName="twblue") Executable('main.py', base=base, targetName="twblue")

View File

@ -39,7 +39,7 @@ def recode_audio(filename, quality=4.5):
if system == "Windows": subprocess.call(r'"%s" -q %r "%s"' % (os.path.join(paths.app_path(), 'oggenc2.exe'), quality, filename)) if system == "Windows": subprocess.call(r'"%s" -q %r "%s"' % (os.path.join(paths.app_path(), 'oggenc2.exe'), quality, filename))
def recording(filename): def recording(filename):
# try: # try:
val = sound_lib.recording.WaveRecording(filename=filename) val = sound_lib.recording.WaveRecording(filename=filename)
# except sound_lib.main.BassError: # except sound_lib.main.BassError:
# sound_lib.input.Input() # sound_lib.input.Input()

View File

@ -116,7 +116,7 @@ def make_executable(path):
os.chmod(path, st.st_mode | stat.S_IEXEC) os.chmod(path, st.st_mode | stat.S_IEXEC)
def call_callback(callback, *args, **kwargs): def call_callback(callback, *args, **kwargs):
# try: # try:
callback(*args, **kwargs) callback(*args, **kwargs)
# except: # except:
# logger.exception("Failed calling callback %r with args %r and kwargs %r" % (callback, args, kwargs)) # logger.exception("Failed calling callback %r with args %r and kwargs %r" % (callback, args, kwargs))

View File

@ -103,8 +103,8 @@ class tweet(textLimited):
selectId = wx.ID_ANY selectId = wx.ID_ANY
self.Bind(wx.EVT_MENU, self.onSelect, id=selectId) self.Bind(wx.EVT_MENU, self.onSelect, id=selectId)
self.accel_tbl = wx.AcceleratorTable([ self.accel_tbl = wx.AcceleratorTable([
(wx.ACCEL_CTRL, ord('A'), selectId), (wx.ACCEL_CTRL, ord('A'), selectId),
]) ])
self.SetAcceleratorTable(self.accel_tbl) self.SetAcceleratorTable(self.accel_tbl)
self.panel.SetSizer(self.mainBox) self.panel.SetSizer(self.mainBox)
@ -162,8 +162,8 @@ class retweet(tweet):
selectId = wx.ID_ANY selectId = wx.ID_ANY
self.Bind(wx.EVT_MENU, self.onSelect, id=selectId) self.Bind(wx.EVT_MENU, self.onSelect, id=selectId)
self.accel_tbl = wx.AcceleratorTable([ self.accel_tbl = wx.AcceleratorTable([
(wx.ACCEL_CTRL, ord('A'), selectId), (wx.ACCEL_CTRL, ord('A'), selectId),
]) ])
self.SetAcceleratorTable(self.accel_tbl) self.SetAcceleratorTable(self.accel_tbl)
self.panel.SetSizer(self.mainBox) self.panel.SetSizer(self.mainBox)
@ -284,8 +284,8 @@ class reply(textLimited):
selectId = wx.ID_ANY selectId = wx.ID_ANY
self.Bind(wx.EVT_MENU, self.onSelect, id=selectId) self.Bind(wx.EVT_MENU, self.onSelect, id=selectId)
self.accel_tbl = wx.AcceleratorTable([ self.accel_tbl = wx.AcceleratorTable([
(wx.ACCEL_CTRL, ord('A'), selectId), (wx.ACCEL_CTRL, ord('A'), selectId),
]) ])
self.SetAcceleratorTable(self.accel_tbl) self.SetAcceleratorTable(self.accel_tbl)
self.panel.SetSizer(self.mainBox) self.panel.SetSizer(self.mainBox)
@ -371,8 +371,8 @@ class viewTweet(widgetUtils.BaseDialog):
selectId = wx.ID_ANY selectId = wx.ID_ANY
self.Bind(wx.EVT_MENU, self.onSelect, id=selectId) self.Bind(wx.EVT_MENU, self.onSelect, id=selectId)
self.accel_tbl = wx.AcceleratorTable([ self.accel_tbl = wx.AcceleratorTable([
(wx.ACCEL_CTRL, ord('A'), selectId), (wx.ACCEL_CTRL, ord('A'), selectId),
]) ])
self.SetAcceleratorTable(self.accel_tbl) self.SetAcceleratorTable(self.accel_tbl)
panel.SetSizer(mainBox) panel.SetSizer(mainBox)
self.SetClientSize(mainBox.CalcMin()) self.SetClientSize(mainBox.CalcMin())
@ -444,8 +444,8 @@ class viewNonTweet(widgetUtils.BaseDialog):
selectId = wx.ID_ANY selectId = wx.ID_ANY
self.Bind(wx.EVT_MENU, self.onSelect, id=selectId) self.Bind(wx.EVT_MENU, self.onSelect, id=selectId)
self.accel_tbl = wx.AcceleratorTable([ self.accel_tbl = wx.AcceleratorTable([
(wx.ACCEL_CTRL, ord('A'), selectId), (wx.ACCEL_CTRL, ord('A'), selectId),
]) ])
self.SetAcceleratorTable(self.accel_tbl) self.SetAcceleratorTable(self.accel_tbl)
panel.SetSizer(mainBox) panel.SetSizer(mainBox)
self.SetClientSize(mainBox.CalcMin()) self.SetClientSize(mainBox.CalcMin())

View File

@ -88,23 +88,23 @@ class mainFrame(wx.Frame):
menuBar.Append(help, _(u"&Help")) menuBar.Append(help, _(u"&Help"))
self.accel_tbl = wx.AcceleratorTable([ self.accel_tbl = wx.AcceleratorTable([
(wx.ACCEL_CTRL, ord('N'), self.compose.GetId()), (wx.ACCEL_CTRL, ord('N'), self.compose.GetId()),
(wx.ACCEL_CTRL, ord('R'), self.reply.GetId()), (wx.ACCEL_CTRL, ord('R'), self.reply.GetId()),
(wx.ACCEL_CTRL|wx.ACCEL_SHIFT, ord('R'), self.retweet.GetId()), (wx.ACCEL_CTRL|wx.ACCEL_SHIFT, ord('R'), self.retweet.GetId()),
(wx.ACCEL_CTRL, ord('F'), self.fav.GetId()), (wx.ACCEL_CTRL, ord('F'), self.fav.GetId()),
(wx.ACCEL_CTRL|wx.ACCEL_SHIFT, ord('F'), self.unfav.GetId()), (wx.ACCEL_CTRL|wx.ACCEL_SHIFT, ord('F'), self.unfav.GetId()),
(wx.ACCEL_CTRL|wx.ACCEL_SHIFT, ord('V'), self.view.GetId()), (wx.ACCEL_CTRL|wx.ACCEL_SHIFT, ord('V'), self.view.GetId()),
(wx.ACCEL_CTRL, ord('D'), self.dm.GetId()), (wx.ACCEL_CTRL, ord('D'), self.dm.GetId()),
(wx.ACCEL_CTRL, ord('Q'), self.close.GetId()), (wx.ACCEL_CTRL, ord('Q'), self.close.GetId()),
(wx.ACCEL_CTRL, ord('S'), self.follow.GetId()), (wx.ACCEL_CTRL, ord('S'), self.follow.GetId()),
(wx.ACCEL_CTRL, ord('I'), self.timeline.GetId()), (wx.ACCEL_CTRL, ord('I'), self.timeline.GetId()),
(wx.ACCEL_CTRL|wx.ACCEL_SHIFT, ord('I'), self.deleteTl.GetId()), (wx.ACCEL_CTRL|wx.ACCEL_SHIFT, ord('I'), self.deleteTl.GetId()),
(wx.ACCEL_CTRL, ord('M'), self.show_hide.GetId()), (wx.ACCEL_CTRL, ord('M'), self.show_hide.GetId()),
(wx.ACCEL_CTRL, wx.WXK_LEFT, self.seekLeft.GetId()), (wx.ACCEL_CTRL, wx.WXK_LEFT, self.seekLeft.GetId()),
(wx.ACCEL_CTRL, ord('P'), self.updateProfile.GetId()), (wx.ACCEL_CTRL, ord('P'), self.updateProfile.GetId()),
(wx.ACCEL_CTRL, wx.WXK_RIGHT, self.seekRight.GetId()), (wx.ACCEL_CTRL, wx.WXK_RIGHT, self.seekRight.GetId()),
(wx.ACCEL_CTRL, ord(' '), self.seekLeft.GetId()), (wx.ACCEL_CTRL, ord(' '), self.seekLeft.GetId()),
]) ])
self.SetAcceleratorTable(self.accel_tbl) self.SetAcceleratorTable(self.accel_tbl)