diff --git a/src/controller/buffers/twitter/base.py b/src/controller/buffers/twitter/base.py index 7ebea416..0cd7cf4a 100644 --- a/src/controller/buffers/twitter/base.py +++ b/src/controller/buffers/twitter/base.py @@ -1,13 +1,8 @@ # -*- coding: utf-8 -*- import time -import platform -if platform.system() == "Windows": - import wx - from wxUI import buffers, dialogs, commonMessageDialogs, menus - from controller import user -elif platform.system() == "Linux": - from gi.repository import Gtk - from gtkUI import buffers, dialogs, commonMessageDialogs +import wx +from wxUI import buffers, dialogs, commonMessageDialogs, menus +from controller import user from controller import messages import widgetUtils import arrow @@ -309,9 +304,6 @@ class BaseBuffer(base.Buffer): self.buffer.list.insert_item(True, *tweet) if self.name in self.session.settings["other_buffers"]["autoread_buffers"] and self.name not in self.session.settings["other_buffers"]["muted_buffers"] and self.session.settings["sound"]["session_mute"] == False: output.speak(" ".join(tweet[:2]), speech=self.session.settings["reporting"]["speech_reporting"], braille=self.session.settings["reporting"]["braille_reporting"]) - #Improve performance on Windows -# if platform.system() == "Windows": -# call_threaded(utils.is_audio,item) def bind_events(self): log.debug("Binding events...") @@ -322,7 +314,6 @@ class BaseBuffer(base.Buffer): widgetUtils.connect_event(self.buffer, widgetUtils.BUTTON_PRESSED, self.share_item, self.buffer.retweet) widgetUtils.connect_event(self.buffer, widgetUtils.BUTTON_PRESSED, self.send_message, self.buffer.dm) widgetUtils.connect_event(self.buffer, widgetUtils.BUTTON_PRESSED, self.reply, self.buffer.reply) - # Replace for the correct way in other platforms. widgetUtils.connect_event(self.buffer.list.list, wx.EVT_LIST_ITEM_RIGHT_CLICK, self.show_menu) widgetUtils.connect_event(self.buffer.list.list, wx.EVT_LIST_KEY_DOWN, self.show_menu_by_key) @@ -480,11 +471,10 @@ class BaseBuffer(base.Buffer): def onFocus(self, *args, **kwargs): tweet = self.get_tweet() - if platform.system() == "Windows" and self.session.settings["general"]["relative_times"] == True: - # fix this: - original_date = arrow.get(self.session.db[self.name][self.buffer.list.get_selected()].created_at, locale="en") - ts = original_date.humanize(locale=languageHandler.getLanguage()) - self.buffer.list.list.SetItem(self.buffer.list.get_selected(), 2, ts) + # fix this: + original_date = arrow.get(self.session.db[self.name][self.buffer.list.get_selected()].created_at, locale="en") + ts = original_date.humanize(locale=languageHandler.getLanguage()) + self.buffer.list.list.SetItem(self.buffer.list.get_selected(), 2, ts) if self.session.settings['sound']['indicate_audio'] and utils.is_audio(tweet): self.session.sound.play("audio.ogg") if self.session.settings['sound']['indicate_geo'] and utils.is_geocoded(tweet): diff --git a/src/controller/buffers/twitter/directMessages.py b/src/controller/buffers/twitter/directMessages.py index 776521d0..fe7a1581 100644 --- a/src/controller/buffers/twitter/directMessages.py +++ b/src/controller/buffers/twitter/directMessages.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -import platform import widgetUtils import arrow import webbrowser @@ -99,7 +98,7 @@ class DirectMessagesBuffer(base.BaseBuffer): def onFocus(self, *args, **kwargs): tweet = self.get_tweet() - if platform.system() == "Windows" and self.session.settings["general"]["relative_times"] == True: + if self.session.settings["general"]["relative_times"] == True: # fix this: original_date = arrow.get(int(tweet.created_timestamp)) ts = original_date.humanize(locale=languageHandler.getLanguage()) diff --git a/src/controller/buffers/twitter/list.py b/src/controller/buffers/twitter/list.py index a1153e6a..1f76134d 100644 --- a/src/controller/buffers/twitter/list.py +++ b/src/controller/buffers/twitter/list.py @@ -1,10 +1,5 @@ # -*- coding: utf-8 -*- -import platform -if platform.system() == "Windows": - from wxUI import dialogs, commonMessageDialogs -elif platform.system() == "Linux": - from gi.repository import Gtk - from gtkUI import dialogs, commonMessageDialogs +from wxUI import dialogs, commonMessageDialogs import widgetUtils import logging from tweepy.cursor import Cursor diff --git a/src/controller/buffers/twitter/people.py b/src/controller/buffers/twitter/people.py index de928cbc..1ab1f833 100644 --- a/src/controller/buffers/twitter/people.py +++ b/src/controller/buffers/twitter/people.py @@ -1,12 +1,7 @@ # -*- coding: utf-8 -*- import time -import platform -if platform.system() == "Windows": - from wxUI import commonMessageDialogs, menus - from controller import user -elif platform.system() == "Linux": - from gi.repository import Gtk - from gtkUI import dialogs, commonMessageDialogs +from wxUI import commonMessageDialogs, menus +from controller import user from controller import messages import widgetUtils import webbrowser diff --git a/src/controller/buffers/twitter/search.py b/src/controller/buffers/twitter/search.py index 9ef948ad..270e54ff 100644 --- a/src/controller/buffers/twitter/search.py +++ b/src/controller/buffers/twitter/search.py @@ -1,12 +1,7 @@ # -*- coding: utf-8 -*- import time -import platform import locale -if platform.system() == "Windows": - from wxUI import commonMessageDialogs -elif platform.system() == "Linux": - from gi.repository import Gtk - from gtkUI import commonMessageDialogs +from wxUI import commonMessageDialogs import widgetUtils import logging from tweepy.errors import TweepyException diff --git a/src/controller/buffers/twitter/trends.py b/src/controller/buffers/twitter/trends.py index 39809df1..cb5ae83a 100644 --- a/src/controller/buffers/twitter/trends.py +++ b/src/controller/buffers/twitter/trends.py @@ -1,13 +1,8 @@ # -*- coding: utf-8 -*- import time -import platform -if platform.system() == "Windows": - import wx - from wxUI import buffers, commonMessageDialogs, menus - from controller import user, messages -elif platform.system() == "Linux": - from gi.repository import Gtk - from gtkUI import buffers, commonMessageDialogs +import wx +from wxUI import buffers, commonMessageDialogs, menus +from controller import user, messages from controller import messages import widgetUtils import output diff --git a/src/controller/mainController.py b/src/controller/mainController.py index f31fde71..4e750712 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -1,26 +1,21 @@ # -*- coding: utf-8 -*- -import platform -system = platform.system() import application import wx import requests -from audio_services import youtube_utils import arrow -if system == "Windows": - from update import updater - from wxUI import (view, dialogs, commonMessageDialogs, sysTrayIcon) - from . import settings - from extra import SoundsTutorial, ocr - import keystrokeEditor - from keyboard_handler.wx_handler import WXKeyboardHandler - from . import userActionsController - from . import trendingTopics - from . import user - from . import listsController - from . import filterController - from . import userSelector -elif system == "Linux": - from gtkUI import (view, commonMessageDialogs) +from audio_services import youtube_utils +from update import updater +from wxUI import (view, dialogs, commonMessageDialogs, sysTrayIcon) +from . import settings +from extra import SoundsTutorial, ocr +import keystrokeEditor +from keyboard_handler.wx_handler import WXKeyboardHandler +from . import userActionsController +from . import trendingTopics +from . import user +from . import listsController +from . import filterController +from . import userSelector from sessions.twitter import utils, compose from sessionmanager import manager, sessionManager from controller import buffers @@ -136,18 +131,17 @@ class Controller(object): pub.subscribe(self.create_buffer, "createBuffer") pub.subscribe(self.toggle_share_settings, "toggleShare") pub.subscribe(self.restart_streaming, "restartStreaming") - if system == "Windows": - pub.subscribe(self.invisible_shorcuts_changed, "invisible-shorcuts-changed") - widgetUtils.connect_event(self.view, widgetUtils.MENU, self.show_hide, menuitem=self.view.show_hide) - widgetUtils.connect_event(self.view, widgetUtils.MENU, self.search, menuitem=self.view.menuitem_search) - widgetUtils.connect_event(self.view, widgetUtils.MENU, self.list_manager, menuitem=self.view.lists) - widgetUtils.connect_event(self.view, widgetUtils.MENU, self.get_trending_topics, menuitem=self.view.trends) - widgetUtils.connect_event(self.view, widgetUtils.MENU, self.filter, menuitem=self.view.filter) - widgetUtils.connect_event(self.view, widgetUtils.MENU, self.manage_filters, menuitem=self.view.manage_filters) - widgetUtils.connect_event(self.view, widgetUtils.MENU, self.find, menuitem=self.view.find) - widgetUtils.connect_event(self.view, widgetUtils.MENU, self.accountConfiguration, menuitem=self.view.account_settings) - widgetUtils.connect_event(self.view, widgetUtils.MENU, self.configuration, menuitem=self.view.prefs) - widgetUtils.connect_event(self.view, widgetUtils.MENU, self.ocr_image, menuitem=self.view.ocr) + pub.subscribe(self.invisible_shorcuts_changed, "invisible-shorcuts-changed") + widgetUtils.connect_event(self.view, widgetUtils.MENU, self.show_hide, menuitem=self.view.show_hide) + widgetUtils.connect_event(self.view, widgetUtils.MENU, self.search, menuitem=self.view.menuitem_search) + widgetUtils.connect_event(self.view, widgetUtils.MENU, self.list_manager, menuitem=self.view.lists) + widgetUtils.connect_event(self.view, widgetUtils.MENU, self.get_trending_topics, menuitem=self.view.trends) + widgetUtils.connect_event(self.view, widgetUtils.MENU, self.filter, menuitem=self.view.filter) + widgetUtils.connect_event(self.view, widgetUtils.MENU, self.manage_filters, menuitem=self.view.manage_filters) + widgetUtils.connect_event(self.view, widgetUtils.MENU, self.find, menuitem=self.view.find) + widgetUtils.connect_event(self.view, widgetUtils.MENU, self.accountConfiguration, menuitem=self.view.account_settings) + widgetUtils.connect_event(self.view, widgetUtils.MENU, self.configuration, menuitem=self.view.prefs) + widgetUtils.connect_event(self.view, widgetUtils.MENU, self.ocr_image, menuitem=self.view.ocr) widgetUtils.connect_event(self.view, widgetUtils.MENU, self.learn_sounds, menuitem=self.view.sounds_tutorial) widgetUtils.connect_event(self.view, widgetUtils.MENU, self.exit, menuitem=self.view.close) widgetUtils.connect_event(self.view, widgetUtils.CLOSE_EVENT, self.exit) @@ -231,12 +225,10 @@ class Controller(object): self.current_account = "" self.view.prepare() self.bind_other_events() - if system == "Windows": - self.set_systray_icon() + self.set_systray_icon() def check_invisible_at_startup(self): - # Visibility check. It does only work for windows. - if system != "Windows": return + # Visibility check. if config.app["app-settings"]["hide_gui"] == True: self.show_hide() self.view.Show() @@ -641,11 +633,10 @@ class Controller(object): sessions.sessions[item].sound.cleaner.cancel() log.debug("Saving database for " + sessions.sessions[item].session_id) sessions.sessions[item].save_persistent_data() - if system == "Windows": - self.systrayIcon.RemoveIcon() - pidpath = os.path.join(os.getenv("temp"), "{}.pid".format(application.name)) - if os.path.exists(pidpath): - os.remove(pidpath) + self.systrayIcon.RemoveIcon() + pidpath = os.path.join(os.getenv("temp"), "{}.pid".format(application.name)) + if os.path.exists(pidpath): + os.remove(pidpath) if hasattr(self, "streams_checker_function"): log.debug("Stopping stream checker...") self.streams_checker_function.cancel() diff --git a/src/extra/SoundsTutorial/__init__.py b/src/extra/SoundsTutorial/__init__.py index 622e037d..233a583a 100644 --- a/src/extra/SoundsTutorial/__init__.py +++ b/src/extra/SoundsTutorial/__init__.py @@ -1,3 +1 @@ -from __future__ import absolute_import -from __future__ import unicode_literals from .soundsTutorial import soundsTutorial diff --git a/src/extra/SoundsTutorial/gtk_ui.py b/src/extra/SoundsTutorial/gtk_ui.py deleted file mode 100644 index a5ffab02..00000000 --- a/src/extra/SoundsTutorial/gtk_ui.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals -from gi.repository import Gtk -import widgetUtils - -class soundsTutorialDialog(Gtk.Dialog): - def __init__(self, actions): - super(soundsTutorialDialog, self).__init__("Sounds tutorial", None, 0, (Gtk.STOCK_CANCEL, widgetUtils.CANCEL)) - box = self.get_content_area() - label = Gtk.Label("Press enter for listen the sound") - self.list = widgetUtils.list("Action") - self.populate_actions(actions) - lBox = Gtk.Box(spacing=6) - lBox.add(label) - lBox.add(self.list.list) - box.add(lBox) - self.play = Gtk.Button("Play") - box.add(self.play) - self.show_all() - - def populate_actions(self, actions): - for i in actions: - self.list.insert_item(i) - - def get_selected(self): - return self.list.get_selected() diff --git a/src/extra/SoundsTutorial/reverse_sort.py b/src/extra/SoundsTutorial/reverse_sort.py index 27711174..c6269a8d 100644 --- a/src/extra/SoundsTutorial/reverse_sort.py +++ b/src/extra/SoundsTutorial/reverse_sort.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals #Reverse sort, by Bill Dengler 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." diff --git a/src/extra/SoundsTutorial/soundsTutorial.py b/src/extra/SoundsTutorial/soundsTutorial.py index 4e679b1c..097655c0 100644 --- a/src/extra/SoundsTutorial/soundsTutorial.py +++ b/src/extra/SoundsTutorial/soundsTutorial.py @@ -1,7 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import -from __future__ import unicode_literals -from builtins import object import platform import widgetUtils import os @@ -9,10 +6,7 @@ import paths import logging log = logging.getLogger("extra.SoundsTutorial.soundsTutorial") from . import soundsTutorial_constants -if platform.system() == "Windows": - from . import wx_ui as UI -elif platform.system() == "Linux": - from . import gtk_ui as UI +from . import wx_ui as UI class soundsTutorial(object): def __init__(self, sessionObject): diff --git a/src/extra/SoundsTutorial/soundsTutorial_constants.py b/src/extra/SoundsTutorial/soundsTutorial_constants.py index 536add4d..ca01b3e5 100644 --- a/src/extra/SoundsTutorial/soundsTutorial_constants.py +++ b/src/extra/SoundsTutorial/soundsTutorial_constants.py @@ -1,7 +1,4 @@ #-*- coding: utf-8 -*- -from __future__ import absolute_import -from __future__ import unicode_literals -#-*- coding: utf-8 -*- from . import reverse_sort import application actions = reverse_sort.reverse_sort([ ("audio", _(u"Audio tweet.")), diff --git a/src/extra/SoundsTutorial/wx_ui.py b/src/extra/SoundsTutorial/wx_ui.py index ebb6caf9..cb11a025 100644 --- a/src/extra/SoundsTutorial/wx_ui.py +++ b/src/extra/SoundsTutorial/wx_ui.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals import wx import widgetUtils diff --git a/src/extra/SpellChecker/spellchecker.py b/src/extra/SpellChecker/spellchecker.py index 29bf2512..791730cf 100644 --- a/src/extra/SpellChecker/spellchecker.py +++ b/src/extra/SpellChecker/spellchecker.py @@ -1,8 +1,4 @@ # -*- 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 diff --git a/src/extra/SpellChecker/twitterFilter.py b/src/extra/SpellChecker/twitterFilter.py index 98e53aee..f5e308c3 100644 --- a/src/extra/SpellChecker/twitterFilter.py +++ b/src/extra/SpellChecker/twitterFilter.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals import re from enchant.tokenize import Filter diff --git a/src/extra/SpellChecker/wx_ui.py b/src/extra/SpellChecker/wx_ui.py index 9c7159fd..a401e3af 100644 --- a/src/extra/SpellChecker/wx_ui.py +++ b/src/extra/SpellChecker/wx_ui.py @@ -16,7 +16,6 @@ # along with this program. If not, see . # ############################################################ -from __future__ import unicode_literals import wx import application diff --git a/src/extra/translator/__init__.py b/src/extra/translator/__init__.py index 07b41a1e..d302ff8f 100644 --- a/src/extra/translator/__init__.py +++ b/src/extra/translator/__init__.py @@ -2,7 +2,4 @@ from __future__ import absolute_import from __future__ import unicode_literals from . import translator -import platform -if platform.system() == "Windows": - from . import wx_ui as gui - +from . import wx_ui as gui \ No newline at end of file diff --git a/src/sessionmanager/__init__.py b/src/sessionmanager/__init__.py index 000da2cf..f59d8d26 100644 --- a/src/sessionmanager/__init__.py +++ b/src/sessionmanager/__init__.py @@ -7,4 +7,3 @@ Contents of this package: manager: Handles multiple sessions, setting the configuration files and check if the session is valid. Part of the model. session: Creates a twitter session for an user. The other part of the model. """ -from __future__ import unicode_literals diff --git a/src/sessionmanager/gtkUI.py b/src/sessionmanager/gtkUI.py deleted file mode 100644 index a6f8a4f0..00000000 --- a/src/sessionmanager/gtkUI.py +++ /dev/null @@ -1,57 +0,0 @@ -from __future__ import unicode_literals -from gi.repository import Gtk -import widgetUtils - -class sessionManagerWindow(widgetUtils.baseDialog): - def __init__(self): - super(sessionManagerWindow, self).__init__("Session Manager", None, 0, (Gtk.STOCK_OK, widgetUtils.OK, Gtk.STOCK_CANCEL, widgetUtils.CANCEL)) - self.list = widgetUtils.list("Session") - self.box.add(self.list.list) - btnBox = Gtk.Box(spacing=6) - self.new = Gtk.Button("New account") - self.remove = Gtk.Button("Remove account") - self.configuration = Gtk.Button("Configuration") - btnBox.add(self.new) - btnBox.add(self.remove) - btnBox.add(self.configuration) - self.box.add(btnBox) - self.show_all() - - def fill_list(self, sessionsList): - for i in sessionsList: - self.list.insert_item(False, i) - if self.list.get_count() > 0: - self.list.select_item(0) - - def new_account_dialog(self): - dialog = Gtk.MessageDialog(self, 0, Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, "Authorization") - dialog.format_secondary_text("The request to authorize your Twitter account will be opened in your browser. You only need to do this once. Would you like to continue?") - answer = dialog.run() - dialog.destroy() - return answer - - def add_new_session_to_list(self): - total = self.list.get_count() - name = "Authorized account %d" % (total+1) - self.list.insert_item(name) - if self.list.get_count() == 1: - self.list.select_item(0) - - def show_unauthorised_error(self): - dialog = Gtk.MessageDialog(self, 0, Gtk.MessageType.ERROR, Gtk.ButtonsType.CANCEL, "Invalid user token") - dialog.format_secondary_text("Your access token is invalid or the authorization has failed. Please try again.") - answer = dialog.run() - return answer - - def remove_account_dialog(self): - dialog = Gtk.MessageDialog(self, 0, Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, "Remove account") - dialog.format_secondary_text("Do you really want delete this account?") - answer = dialog.run() - return answer - - def get_selected(self): - return self.list.get_selected() - - def remove_session(self, sessionID): - self.list.remove_item(sessionID) - diff --git a/src/sessionmanager/sessionManager.py b/src/sessionmanager/sessionManager.py index d4255862..999b0b47 100644 --- a/src/sessionmanager/sessionManager.py +++ b/src/sessionmanager/sessionManager.py @@ -1,13 +1,9 @@ # -*- coding: utf-8 -*- import shutil import widgetUtils -import platform import output -if platform.system() == "Windows": - from . import wxUI as view - from controller import settings -elif platform.system() == "Linux": - from . import gtkUI as view +from . import wxUI as view +from controller import settings import paths import time import os diff --git a/src/sessions/twitter/compose.py b/src/sessions/twitter/compose.py index 539b4df7..0e5ad12f 100644 --- a/src/sessions/twitter/compose.py +++ b/src/sessions/twitter/compose.py @@ -1,6 +1,4 @@ # -*- coding: utf-8 -*- -import platform -system = platform.system() from . import utils import re import time @@ -17,14 +15,11 @@ chars = "abcdefghijklmnopqrstuvwxyz" def compose_tweet(tweet, db, relative_times, show_screen_names=False, session=None): """ It receives a tweet and returns a list with the user, text for the tweet or message, date and the client where user is.""" - if system == "Windows": - original_date = arrow.get(tweet.created_at, locale="en") - if relative_times == True: - ts = original_date.humanize(locale=languageHandler.curLang[:2]) - else: - ts = original_date.shift(seconds=db["utc_offset"]).format(_(u"dddd, MMMM D, YYYY H:m:s"), locale=languageHandler.curLang[:2]) + original_date = arrow.get(tweet.created_at, locale="en") + if relative_times == True: + ts = original_date.humanize(locale=languageHandler.curLang[:2]) else: - ts = tweet.created_at + ts = original_date.shift(seconds=db["utc_offset"]).format(_(u"dddd, MMMM D, YYYY H:m:s"), locale=languageHandler.curLang[:2]) if hasattr(tweet, "message"): value = "message" elif hasattr(tweet, "full_text"): @@ -58,16 +53,13 @@ def compose_tweet(tweet, db, relative_times, show_screen_names=False, session=No return [user+", ", text, ts+", ", source] def compose_direct_message(item, db, relative_times, show_screen_names=False, session=None): - if system == "Windows": - # Let's remove the last 3 digits in the timestamp string. - # Twitter sends their "epoch" timestamp with 3 digits for milliseconds and arrow doesn't like it. - original_date = arrow.get(int(item.created_timestamp)) - if relative_times == True: - ts = original_date.humanize(locale=languageHandler.curLang[:2]) - else: - ts = original_date.shift(seconds=db["utc_offset"]).format(_(u"dddd, MMMM D, YYYY H:m:s"), locale=languageHandler.curLang[:2]) + # Let's remove the last 3 digits in the timestamp string. + # Twitter sends their "epoch" timestamp with 3 digits for milliseconds and arrow doesn't like it. + original_date = arrow.get(int(item.created_timestamp)) + if relative_times == True: + ts = original_date.humanize(locale=languageHandler.curLang[:2]) else: - ts = item.created_timestamp + ts = original_date.shift(seconds=db["utc_offset"]).format(_(u"dddd, MMMM D, YYYY H:m:s"), locale=languageHandler.curLang[:2]) text = StripChars(item.message_create["message_data"]["text"]) source = "DM" sender = session.get_user(item.message_create["sender_id"]) @@ -125,23 +117,17 @@ def compose_quoted_tweet(quoted_tweet, original_tweet, show_screen_names=False, return quoted_tweet def compose_followers_list(tweet, db, relative_times=True, show_screen_names=False, session=None): - if system == "Windows": - original_date = arrow.get(tweet.created_at, locale="en") - if relative_times == True: - ts = original_date.humanize(locale=languageHandler.curLang[:2]) - else: - ts = original_date.shift(seconds=db["utc_offset"]).format(_(u"dddd, MMMM D, YYYY H:m:s"), locale=languageHandler.curLang[:2]) + original_date = arrow.get(tweet.created_at, locale="en") + if relative_times == True: + ts = original_date.humanize(locale=languageHandler.curLang[:2]) else: - ts = tweet.created_at + ts = original_date.shift(seconds=db["utc_offset"]).format(_(u"dddd, MMMM D, YYYY H:m:s"), locale=languageHandler.curLang[:2]) if hasattr(tweet, "status"): - if system == "Windows": - original_date2 = arrow.get(tweet.status.created_at, locale="en") - if relative_times: - ts2 = original_date2.humanize(locale=languageHandler.curLang[:2]) - else: - ts2 = original_date2.shift(seconds=db["utc_offset"]).format(_(u"dddd, MMMM D, YYYY H:m:s"), locale=languageHandler.curLang[:2]) + original_date2 = arrow.get(tweet.status.created_at, locale="en") + if relative_times: + ts2 = original_date2.humanize(locale=languageHandler.curLang[:2]) else: - ts2 = _("Unavailable") + ts2 = original_date2.shift(seconds=db["utc_offset"]).format(_(u"dddd, MMMM D, YYYY H:m:s"), locale=languageHandler.curLang[:2]) else: ts2 = _("Unavailable") return [_(u"%s (@%s). %s followers, %s friends, %s tweets. Last tweeted %s. Joined Twitter %s") % (tweet.name, tweet.screen_name, tweet.followers_count, tweet.friends_count, tweet.statuses_count, ts2, ts)] diff --git a/src/sessions/twitter/long_tweets/__init__.py b/src/sessions/twitter/long_tweets/__init__.py index 007ad61c..84185940 100644 --- a/src/sessions/twitter/long_tweets/__init__.py +++ b/src/sessions/twitter/long_tweets/__init__.py @@ -1,3 +1,2 @@ # -*- coding: utf-8 -*- """ this package holds different modules to extract information regarding long tweets. A long tweet contains more than one tweet (such a quoted tweet), or is made via services like twishort.""" -from __future__ import unicode_literals diff --git a/src/update/__init__.py b/src/update/__init__.py index 443025e3..e69de29b 100644 --- a/src/update/__init__.py +++ b/src/update/__init__.py @@ -1,13 +0,0 @@ -from __future__ import unicode_literals -import glob -import os.path -import platform - -def find_datafiles(): - system = platform.system() - if system == 'Windows': - file_ext = '*.exe' - else: - file_ext = '*.sh' - path = os.path.abspath(os.path.join(__path__[0], 'bootstrappers', file_ext)) - return [('', glob.glob(path))] diff --git a/src/update/updater.py b/src/update/updater.py index 5214c1de..4e1b4046 100644 --- a/src/update/updater.py +++ b/src/update/updater.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- import application from . import update -import platform import logging import output from requests.exceptions import ConnectionError