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 paths
import logging
import application
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.add_argument("-p", "--portable", help="Use TW Blue 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")
parser.add_argument("-d", "--data-directory", action="store", dest="directory", help="Specifies the directory where TW Blue saves userdata.")
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 " + 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 " + application.name + " saves userdata.")
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"
elif args.portable == True:
paths.mode = "portable"

View File

@ -5,6 +5,7 @@ import os
import exceptions
import dropbox
import logging
import application
from keys import keyring
from utils import *
from dropbox.rest import ErrorResponse
@ -51,7 +52,7 @@ class dropboxLogin(object):
return self.flow.start()
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)
log.debug("Saving tokens...")
self.config["services"]["dropbox_token"] = access_token
@ -64,7 +65,7 @@ class dropboxUploader(object):
self.client = dropbox.client.DropboxClient(config["services"]["dropbox_token"])
else:
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.short_url = short_url
self.file = open(self.filename, "rb")

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import wx
import widgetUtils
import application
class autocompletionSettingsDialog(widgetUtils.BaseDialog):
def __init__(self):
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())
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(self.language, 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)
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)
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)
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)
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.check_for_updates = Gtk.MenuItem(label="Check for updates")
self.reportError = Gtk.MenuItem(label="Report an error")
self.visit_website = Gtk.MenuItem(label="TWBlue's website")
self.about = Gtk.MenuItem(label="ABout TWBlue")
self.visit_website = Gtk.MenuItem(label=application.name+"'s website")
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)
help_menu = Gtk.MenuItem(label="Help")
help_menu.set_submenu(help)

View File

@ -44,7 +44,7 @@ class reportBug(object):
try:
client = Client(application.report_bugs_url)
issue = client.factory.create('IssueData')
issue.project.name = "TWBlue"
issue.project.name = application.name
issue.project.id = 0
issue.summary = self.dialog.get("summary"),
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")
def setup():
log.debug("Starting TWBlue %s" % (application.version,))
log.debug("Starting " + application.name + " %s" % (application.version,))
config.setup()
log.debug("Using %s %s" % (platform.system(), platform.architecture()[0]))
log.debug("Application path is %s" % (paths.app_path(),))

View File

@ -12,7 +12,7 @@ import platform
import output
system = platform.system()
from mysc.repeating_timer import RepeatingTimer
import application
URLPlayer = None
def setup():
@ -46,7 +46,7 @@ class soundSystem(object):
self.path = paths.sound_path("default")
self.soundpack_OK = True
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
def __init__(self, soundConfig):