Remove hardcoded app names.

This commit is contained in:
Bill Dengler 2015-04-19 19:10:34 -04:00
parent be0253815f
commit 00d5b88b8d
8 changed files with 20 additions and 18 deletions

View File

@ -2,15 +2,16 @@
import argparse import argparse
import paths import paths
import logging import logging
import application
log = logging.getLogger("commandlineLauncher") log = logging.getLogger("commandlineLauncher")
parser = argparse.ArgumentParser(description="TW Blue command line launcher") parser = argparse.ArgumentParser(description=application.name+" command line launcher")
group = parser.add_mutually_exclusive_group() group = parser.add_mutually_exclusive_group()
group.add_argument("-p", "--portable", help="Use TW Blue as a portable application.", action="store_true", default=True) group.add_argument("-p", "--portable", help="Use " + application.name + " as a portable application.", action="store_true", default=True)
group.add_argument("-i", "--installed", help="Use TW Blue as an installed application. Config files will be saved in the user data directory", action="store_true") group.add_argument("-i", "--installed", help="Use " + application.name + " as an installed application. Config files will be saved in the user data directory", action="store_true")
parser.add_argument("-d", "--data-directory", action="store", dest="directory", help="Specifies the directory where TW Blue saves userdata.") parser.add_argument("-d", "--data-directory", action="store", dest="directory", help="Specifies the directory where " + application.name + " saves userdata.")
args = parser.parse_args() args = parser.parse_args()
log.debug("Starting TWBlue with the following arguments: installed = %s, portable = %s and directory = %s" % (args.installed, args.portable, args.directory)) log.debug("Starting " + application.name + " with the following arguments: installed = %s, portable = %s and directory = %s" % (args.installed, args.portable, args.directory))
if args.installed == True: paths.mode = "installed" if args.installed == True: paths.mode = "installed"
elif args.portable == True: elif args.portable == True:
paths.mode = "portable" paths.mode = "portable"

View File

@ -5,6 +5,7 @@ import os
import exceptions import exceptions
import dropbox import dropbox
import logging import logging
import application
from keys import keyring from keys import keyring
from utils import * from utils import *
from dropbox.rest import ErrorResponse from dropbox.rest import ErrorResponse
@ -51,7 +52,7 @@ class dropboxLogin(object):
return self.flow.start() return self.flow.start()
def authorise(self, code): def authorise(self, code):
log.debug("Authorising TWBlue in Dropbox...") log.debug("Authorising " + application.name + " to Dropbox...")
access_token, user_id = self.flow.finish(code) access_token, user_id = self.flow.finish(code)
log.debug("Saving tokens...") log.debug("Saving tokens...")
self.config["services"]["dropbox_token"] = access_token self.config["services"]["dropbox_token"] = access_token
@ -64,7 +65,7 @@ class dropboxUploader(object):
self.client = dropbox.client.DropboxClient(config["services"]["dropbox_token"]) self.client = dropbox.client.DropboxClient(config["services"]["dropbox_token"])
else: else:
log.error("Dropbox is not authorised for this session.") log.error("Dropbox is not authorised for this session.")
raise UnauthorisedError("You need authorise TWBlue") raise UnauthorisedError("You need to authorise " + application.name)
self.filename = filename self.filename = filename
self.short_url = short_url self.short_url = short_url
self.file = open(self.filename, "rb") self.file = open(self.filename, "rb")

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import wx import wx
import widgetUtils import widgetUtils
import application
class autocompletionSettingsDialog(widgetUtils.BaseDialog): class autocompletionSettingsDialog(widgetUtils.BaseDialog):
def __init__(self): def __init__(self):
super(autocompletionSettingsDialog, self).__init__(parent=None, id=-1, title=_(u"Autocomplete users settings")) super(autocompletionSettingsDialog, self).__init__(parent=None, id=-1, title=_(u"Autocomplete users settings"))
@ -23,4 +23,4 @@ class autocompletionSettingsDialog(widgetUtils.BaseDialog):
self.SetClientSize(sizer.CalcMin()) self.SetClientSize(sizer.CalcMin())
def show_success_dialog(): def show_success_dialog():
wx.MessageDialog(None, _(u"TWBlue's database of users has been updated."), _(u"Done"), wx.OK).ShowModal() wx.MessageDialog(None, _(uapplication.name+"'s database of users has been updated."), _(u"Done"), wx.OK).ShowModal()

View File

@ -14,13 +14,13 @@ class general(wx.Panel, baseDialog.BaseWXDialog):
langBox.Add(language, 0, wx.ALL, 5) langBox.Add(language, 0, wx.ALL, 5)
langBox.Add(self.language, 0, wx.ALL, 5) langBox.Add(self.language, 0, wx.ALL, 5)
sizer.Add(langBox, 0, wx.ALL, 5) sizer.Add(langBox, 0, wx.ALL, 5)
self.ask_at_exit = wx.CheckBox(self, -1, _(U"ask before exiting TwBlue?")) self.ask_at_exit = wx.CheckBox(self, -1, _(U"ask before exiting " + application.name))
sizer.Add(self.ask_at_exit, 0, wx.ALL, 5) sizer.Add(self.ask_at_exit, 0, wx.ALL, 5)
self.use_invisible_shorcuts = wx.CheckBox(self, -1, _(u"Use invisible interface's keyboard shorcuts on the GUI")) self.use_invisible_shorcuts = wx.CheckBox(self, -1, _(u"Use invisible interface's keyboard shortcuts while GUI is visible"))
sizer.Add(self.use_invisible_shorcuts, 0, wx.ALL, 5) sizer.Add(self.use_invisible_shorcuts, 0, wx.ALL, 5)
self.disable_sapi5 = wx.CheckBox(self, -1, _(u"Activate Sapi5 when any other screen reader is not being run")) self.disable_sapi5 = wx.CheckBox(self, -1, _(u"Activate Sapi5 when any other screen reader is not being run"))
sizer.Add(self.disable_sapi5, 0, wx.ALL, 5) sizer.Add(self.disable_sapi5, 0, wx.ALL, 5)
self.hide_gui = wx.CheckBox(self, -1, _(u"Activate the auto-start of the invisible interface")) self.hide_gui = wx.CheckBox(self, -1, _(u"Hide GUI on launch"))
sizer.Add(self.hide_gui, 0, wx.ALL, 5) sizer.Add(self.hide_gui, 0, wx.ALL, 5)
self.SetSizer(sizer) self.SetSizer(sizer)

View File

@ -99,8 +99,8 @@ class mainFrame(Gtk.Window):
self.changelog = Gtk.MenuItem(label="What's new in this version?") self.changelog = Gtk.MenuItem(label="What's new in this version?")
self.check_for_updates = Gtk.MenuItem(label="Check for updates") self.check_for_updates = Gtk.MenuItem(label="Check for updates")
self.reportError = Gtk.MenuItem(label="Report an error") self.reportError = Gtk.MenuItem(label="Report an error")
self.visit_website = Gtk.MenuItem(label="TWBlue's website") self.visit_website = Gtk.MenuItem(label=application.name+"'s website")
self.about = Gtk.MenuItem(label="ABout TWBlue") self.about = Gtk.MenuItem(label="ABout "+application.name)
self.append_to_menu(help, self.doc, self.sounds_tutorial, self.changelog, self.check_for_updates, self.reportError, self.visit_website, self.about) self.append_to_menu(help, self.doc, self.sounds_tutorial, self.changelog, self.check_for_updates, self.reportError, self.visit_website, self.about)
help_menu = Gtk.MenuItem(label="Help") help_menu = Gtk.MenuItem(label="Help")
help_menu.set_submenu(help) help_menu.set_submenu(help)

View File

@ -44,7 +44,7 @@ class reportBug(object):
try: try:
client = Client(application.report_bugs_url) client = Client(application.report_bugs_url)
issue = client.factory.create('IssueData') issue = client.factory.create('IssueData')
issue.project.name = "TWBlue" issue.project.name = application.name
issue.project.id = 0 issue.project.id = 0
issue.summary = self.dialog.get("summary"), issue.summary = self.dialog.get("summary"),
issue.description = "Reported by @%s\n\n" % (self.user_name) + self.dialog.get("description") issue.description = "Reported by @%s\n\n" % (self.user_name) + self.dialog.get("description")

View File

@ -49,7 +49,7 @@ if system == "Linux":
log = logging.getLogger("main") log = logging.getLogger("main")
def setup(): def setup():
log.debug("Starting TWBlue %s" % (application.version,)) log.debug("Starting " + application.name + " %s" % (application.version,))
config.setup() config.setup()
log.debug("Using %s %s" % (platform.system(), platform.architecture()[0])) log.debug("Using %s %s" % (platform.system(), platform.architecture()[0]))
log.debug("Application path is %s" % (paths.app_path(),)) log.debug("Application path is %s" % (paths.app_path(),))

View File

@ -12,7 +12,7 @@ import platform
import output import output
system = platform.system() system = platform.system()
from mysc.repeating_timer import RepeatingTimer from mysc.repeating_timer import RepeatingTimer
import application
URLPlayer = None URLPlayer = None
def setup(): def setup():
@ -46,7 +46,7 @@ class soundSystem(object):
self.path = paths.sound_path("default") self.path = paths.sound_path("default")
self.soundpack_OK = True self.soundpack_OK = True
else: else:
log.error("Path for the current soundpack does not exist and the default soundpack is deleted, TWBlue will not play sounds.") log.error("The current soundpack could not be found and the default soundpack has been deleted, " + application.name + " will not play sounds.")
self.soundpack_OK = False self.soundpack_OK = False
def __init__(self, soundConfig): def __init__(self, soundConfig):