Sound object refactored, more invisible shorcuts, global configuration and fixed buffer navigation in invisible mode

This commit is contained in:
Manuel Cortez 2015-01-20 15:40:33 -06:00
parent 7b1f2f9482
commit c25412bd32
15 changed files with 173 additions and 98 deletions

1
.gitignore vendored
View File

@ -10,6 +10,7 @@ src/config3/
src/dropbox/
src/logs/
src/documentation/
src/sounds/iOs
src/oggenc2.exe
src/bootstrap.exe
src/Microsoft.VC90.CRT

View File

@ -13,6 +13,11 @@ time_to_check_streams = integer(default=30)
announce_stream_status = boolean(default=True)
[sound]
volume = float(default=1.0)
input_device = string(default="Default")
output_device = string(default="Default")
global_mute = boolean(default=False)
current_soundpack = string(default="default")
sndup_api_key = string(default="")
[other_buffers]

View File

@ -7,11 +7,6 @@ ignored_sessions = list(default=list())
language = string(default="system")
hide_gui = boolean(default=False)
voice_enabled = boolean(default=False)
volume = float(default=1.0)
input_device = string(default="Default")
output_device = string(default="Default")
global_mute = boolean(default=False)
current_soundpack = string(default="default")
ask_at_exit = boolean(default=True)
use_invisible_keyboard_shorcuts = boolean(default=False)

View File

@ -44,24 +44,24 @@ class bufferController(object):
#pass
def volume_down(self):
if config.app["app-settings"]["volume"] > 0.0:
if config.app["app-settings"]["volume"] <= 0.05:
config.app["app-settings"]["volume"] = 0.0
if self.session.settings["sound"]["volume"] > 0.0:
if self.session.settings["sound"]["volume"] <= 0.05:
self.session.settings["sound"]["volume"] = 0.0
else:
config.app["app-settings"]["volume"] -=0.05
self.session.settings["sound"]["volume"] -=0.05
if hasattr(sound.URLStream, "stream"):
sound.URLStream.stream.volume = config.app["app-settings"]["volume"]
sound.player.play("volume_changed.ogg")
sound.URLStream.stream.volume = self.session.settings["sound"]["volume"]
self.session.sound.play("volume_changed.ogg")
def volume_up(self):
if config.app["app-settings"]["volume"] < 1.0:
if config.app["app-settings"]["volume"] >= 0.95:
config.app["app-settings"]["volume"] = 1.0
if self.session.settings["sound"]["volume"] < 1.0:
if self.session.settings["sound"]["volume"] >= 0.95:
self.session.settings["sound"]["volume"] = 1.0
else:
config.app["app-settings"]["volume"] +=0.05
self.session.settings["sound"]["volume"] +=0.05
if hasattr(sound.URLStream, "stream"):
sound.URLStream.stream.volume = config.app["app-settings"]["volume"]
sound.player.play("volume_changed.ogg")
sound.URLStream.stream.volume = self.session.settings["sound"]["volume"]
self.session.sound.play("volume_changed.ogg")
def start_stream(self):
pass
@ -223,7 +223,7 @@ class baseBufferController(bufferController):
screen_name = tweet["user"]["screen_name"]
id = tweet["id"]
users = utils.get_all_mentioned(tweet, self.session.db)
message = messages.reply(self.session, _(u"Reply"), _(u"Reply to %s") % (screen_name,), "@%s" % (screen_name,), users)
message = messages.reply(self.session, _(u"Reply"), _(u"Reply to %s") % (screen_name,), "@%s " % (screen_name,), users)
if message.message.get_response() == widgetUtils.OK:
if message.image == None:
call_threaded(self.session.api_call, call_name="update_status", _sound="reply_send.ogg", in_reply_to_status_id=id, status=message.message.get_text())
@ -267,7 +267,7 @@ class baseBufferController(bufferController):
ts = original_date.humanize(locale=languageHandler.getLanguage())
self.buffer.list.list.SetStringItem(self.buffer.list.get_selected(), 2, ts)
if utils.is_audio(tweet):
sound.player.play("audio.ogg")
self.session.sound.play("audio.ogg")
def audio(self):
tweet = self.get_tweet()
@ -390,6 +390,14 @@ class peopleBufferController(baseBufferController):
tweet = self.session.db[self.name]["items"][self.buffer.list.get_selected()]
return tweet
def add_new_item(self, item):
self.session.db[self.name]["items"].append(item)
tweet = self.compose_function(item, self.session.db, self.session.settings["general"]["relative_times"])
if self.session.settings["general"]["reverse_timelines"] == False:
self.buffer.list.insert_item(False, *tweet)
else:
self.buffer.list.insert_item(True, *tweet)
class searchBufferController(baseBufferController):
def start_stream(self):
log.debug("Starting stream for %s buffer, %s account and %s type" % (self.name, self.account, self.type))
@ -400,7 +408,7 @@ class searchBufferController(baseBufferController):
log.debug("Number of items retrieved: %d" % (number_of_items,))
self.put_items_on_list(number_of_items)
if number_of_items > 0:
sound.player.play("search_updated.ogg")
self.session.sound.play("search_updated.ogg")
class searchPeopleBufferController(searchBufferController):
@ -419,4 +427,4 @@ class searchPeopleBufferController(searchBufferController):
log.debug("Number of items retrieved: %d" % (number_of_items,))
self.put_items_on_list(number_of_items)
if number_of_items > 0:
sound.player.play("search_updated.ogg")
self.session.sound.play("search_updated.ogg")

View File

@ -2,6 +2,7 @@
from wxUI import (view, dialogs, commonMessageDialogs)
import buffersController
import messages
import settings
from sessionmanager import session as session_
from pubsub import pub
import sound
@ -56,14 +57,14 @@ class Controller(object):
def get_first_buffer(self, account):
for i in self.buffers:
if i.account == account:
if i.account == account and i.invisible == True:
buff = i
break
return self.view.search(buff.name, buff.account)
def get_last_buffer(self, account):
results = []
[results.append(i) for i in self.buffers if i.account == account]
[results.append(i) for i in self.buffers if i.account == account and i.invisible == True]
return self.view.search(results[-1].name, results[-1].account)
def bind_stream_events(self):
@ -91,6 +92,7 @@ class Controller(object):
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.learn_sounds, menuitem=self.view.sounds_tutorial)
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.configuration, menuitem=self.view.prefs)
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.exit, menuitem=self.view.close)
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.post_tweet, self.view.compose)
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.post_reply, self.view.reply)
@ -113,6 +115,13 @@ class Controller(object):
self.view.prepare()
self.bind_stream_events()
self.bind_other_events()
if config.app["app-settings"]["hide_gui"] == True:
self.show_hide()
self.view.Show()
self.view.Hide()
if config.app["app-settings"]["use_invisible_keyboard_shorcuts"] == True:
km = self.create_invisible_keyboard_shorcuts()
self.register_invisible_keyboard_shorcuts(km)
self.do_work()
def do_work(self):
@ -121,7 +130,7 @@ class Controller(object):
log.debug("Working on session %s" % (i,))
self.create_buffers(session_.sessions[i])
call_threaded(self.start_buffers, session_.sessions[i])
sound.player.play("tweet_timeline.ogg")
session_.sessions[session_.sessions.keys()[0]].sound.play("tweet_timeline.ogg")
self.checker_function = RepeatingTimer(60, self.check_connection)
self.checker_function.start()
@ -138,11 +147,11 @@ class Controller(object):
mentions = buffersController.baseBufferController(self.view.nb, "get_mentions_timeline", "mentions", session, session.db["user_name"])
self.buffers.append(mentions)
self.view.insert_buffer(mentions.buffer, name=_(u"Mentions"), pos=self.view.search(session.db["user_name"], session.db["user_name"]))
sound.player.play("mention_received.ogg")
session.sound.play("mention_received.ogg")
dm = buffersController.baseBufferController(self.view.nb, "get_direct_messages", "direct_messages", session, session.db["user_name"], bufferType="dmPanel")
self.buffers.append(dm)
self.view.insert_buffer(dm.buffer, name=_(u"Direct messages"), pos=self.view.search(session.db["user_name"], session.db["user_name"]))
sound.player.play("dm_received.ogg")
session.sound.play("dm_received.ogg")
sent_dm = buffersController.baseBufferController(self.view.nb, "get_sent_messages", "sent_direct_messages", session, session.db["user_name"], bufferType="dmPanel")
self.buffers.append(sent_dm)
self.view.insert_buffer(sent_dm.buffer, name=_(u"Sent direct messages"), pos=self.view.search(session.db["user_name"], session.db["user_name"]))
@ -220,7 +229,8 @@ class Controller(object):
dlg.Destroy()
def learn_sounds(self, *args, **kwargs):
SoundsTutorial.soundsTutorial()
buffer = self.get_best_buffer()
SoundsTutorial.soundsTutorial(buffer.session)
def view_user_lists(self, users):
pass
@ -234,8 +244,11 @@ class Controller(object):
def lists_manager(self):
pass
def configuration(self):
pass
def configuration(self, *args, **kwargs):
d = settings.globalSettingsController()
if d.response == widgetUtils.OK:
d.save_configuration()
def update_profile(self):
pass
@ -259,14 +272,19 @@ class Controller(object):
buffer.destroy_status()
def exit(self, *args, **kwargs):
if config.app["app-settings"]["ask_at_exit"] == True:
answer = commonMessageDialogs.exit_dialog()
if answer == widgetUtils.NO: return
log.debug("Exiting...")
log.debug("Saving global configuration...")
config.app.write()
for item in session_.sessions:
log.debug("Saving config for %s session" % (session_.sessions[item].session_id,))
session_.sessions[item].settings.write()
log.debug("Disconnecting streams for %s session" % (session_.sessions[item].session_id,))
session_.sessions[item].main_stream.disconnect()
session_.sessions[item].timelinesStream.disconnect()
sound.player.cleaner.cancel()
session_.sessions[item].sound.cleaner.cancel()
widgetUtils.exit_application()
def action(self, do_action):
@ -317,7 +335,8 @@ class Controller(object):
buffer = self.get_current_buffer()
if buffer.type == "baseBuffer" or buffer.type == "favourites_timeline" or buffer.type == "list" or buffer.type == "search":
try:
tweet = buffer.get_right_tweet()
tweet_id = buffer.get_right_tweet()["id"]
tweet = buffer.session.twitter.twitter.show_status(id=tweet_id)
msg = messages.viewTweet(tweet, )
except TwythonError:
non_tweet = buffer.get_message()
@ -373,7 +392,7 @@ class Controller(object):
except:
pass
if position == page.buffer.list.get_selected():
sound.player.play("limit.ogg")
page.session.sound.play("limit.ogg")
try:
output.speak(page.get_message())
except:
@ -388,7 +407,7 @@ class Controller(object):
except:
pass
if position == page.buffer.list.get_selected():
sound.player.play("limit.ogg")
page.session.sound.play("limit.ogg")
try:
output.speak(page.get_message())
except:
@ -458,6 +477,17 @@ class Controller(object):
msg = _(u"%s. Empty") % (self.view.get_buffer_text(),)
output.speak(msg)
def url(self, *args, **kwargs):
self.get_current_buffer().url()
def audio(self, *args, **kwargs):
self.get_current_buffer().audio()
def volume_down(self, *args, **kwargs):
self.get_current_buffer().volume_down()
def volume_up(self, *args, **kwargs):
self.get_current_buffer().volume_up()
def create_invisible_keyboard_shorcuts(self):
keymap = {}
for i in config.app["keymap"]:
@ -476,9 +506,9 @@ class Controller(object):
except AttributeError:
pass
def notify(self, play_sound=None, message=None, notification=False):
def notify(self, session, play_sound=None, message=None, notification=False):
if play_sound != None:
sound.player.play(play_sound)
session.sound.play(play_sound)
if message != None:
output.speak(message)
@ -486,45 +516,45 @@ class Controller(object):
buffer = self.search_buffer("home_timeline", user)
play_sound = "tweet_received.ogg"
buffer.add_new_item(data)
self.notify(play_sound=play_sound)
self.notify(buffer.session, play_sound=play_sound)
def manage_mentions(self, data, user):
buffer = self.search_buffer("mentions", user)
play_sound = "mention_received.ogg"
buffer.add_new_item(data)
message = _(u"New mention")
self.notify(play_sound=play_sound, message=message)
self.notify(buffer.session, play_sound=play_sound, message=message)
def manage_direct_messages(self, data, user):
buffer = self.search_buffer("direct_messages", user)
play_sound = "dm_received.ogg"
buffer.add_new_item(data)
message = _(u"New direct message")
self.notify(play_sound=play_sound, message=message)
self.notify(buffer.session, play_sound=play_sound, message=message)
def manage_sent_dm(self, data, user):
buffer = self.search_buffer("sent_direct_messages", user)
play_sound = "dm_sent.ogg"
buffer.add_new_item(data)
self.notify(play_sound=play_sound)
self.notify(buffer.session, play_sound=play_sound)
def manage_sent_tweets(self, data, user):
buffer = self.search_buffer("sent_tweets", user)
play_sound = "tweet_send.ogg"
buffer.add_new_item(data)
self.notify(play_sound=play_sound)
self.notify(buffer.session, play_sound=play_sound)
def manage_events(self, data, user):
buffer = self.search_buffer("events", user)
play_sound = "new_event.ogg"
buffer.add_new_item(data)
self.notify(play_sound=play_sound)
self.notify(buffer.session, play_sound=play_sound)
def manage_followers(self, data, user):
buffer = self.search_buffer("followers", user)
play_sound = "update_followers.ogg"
buffer.add_new_item(data)
self.notify(play_sound=play_sound)
self.notify(buffer.session, play_sound=play_sound)
def manage_friend(self, data, user):
buffer = self.search_buffer("friends", user)
@ -539,7 +569,7 @@ class Controller(object):
buffer = self.search_buffer("favourites", user)
play_sound = "favourite.ogg"
buffer.add_new_item(data)
self.notify(play_sound=play_sound)
self.notify(buffer.session, play_sound=play_sound)
def manage_unfavourite(self, item, user):
buffer = self.search_buffer("favourites", user)
@ -557,7 +587,7 @@ class Controller(object):
buffer = self.search_buffer("%s-timeline" % (who,), user)
play_sound = "tweet_timeline.ogg"
buffer.add_new_item(data)
self.notify(play_sound=play_sound)
self.notify(buffer.session, play_sound=play_sound)
def editing_keystroke(self, action, parentDialog):
print "i've pressed"

View File

@ -76,7 +76,7 @@ class basicTweet(object):
self.message.disable_button("shortenButton")
self.message.disable_button("unshortenButton")
if len(self.message.get_text()) > 140:
sound.player.play("max_length.ogg")
self.session.sound.play("max_length.ogg")
def spellcheck(self, event=None):
text = self.message.get_text()

View File

@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
import widgetUtils
import config
import languageHandler
from wxUI.dialogs import configuration
from pubsub import pub
import logging
log = logging.getLogger("Settings")
class globalSettingsController(object):
def __init__(self):
super(globalSettingsController, self).__init__()
self.dialog = configuration.configurationDialog()
self.langs = languageHandler.getAvailableLanguages()
langs = []
[langs.append(i[1]) for i in self.langs]
self.codes = []
[self.codes.append(i[0]) for i in self.langs]
id = self.codes.index(config.app["app-settings"]["language"])
self.dialog.create_general(langs)
self.dialog.general.language.SetSelection(id)
self.dialog.set_value("general", "ask_at_exit", config.app["app-settings"]["ask_at_exit"])
self.dialog.set_value("general", "use_invisible_shorcuts", config.app["app-settings"]["use_invisible_keyboard_shorcuts"])
self.dialog.set_value("general", "disable_sapi5", config.app["app-settings"]["voice_enabled"])
self.dialog.set_value("general", "hide_gui", config.app["app-settings"]["hide_gui"])
self.dialog.realize()
self.needs_restart = False
self.response = self.dialog.get_response()
def save_configuration(self):
if self.codes[self.dialog.general.language.GetSelection()] != config.app["app-settings"]["language"]:
config.app["app-settings"]["language"] = self.codes[self.dialog.general.language.GetSelection()]
languageHandler.setLanguage(config.app["app-settings"]["language"])
self.needs_restart = True
if config.app["app-settings"]["use_invisible_keyboard_shorcuts"] != self.dialog.get_value("general", "use_invisible_shorcuts"):
config.app["app-settings"]["use_invisible_keyboard_shorcuts"] = self.dialog.get_value("general", "use_invisible_shorcuts")
pub.sendMessage("invisible-shorcuts-changed", registered=self.dialog.get_value("general", "use_invisible_shorcuts"))
config.app["app-settings"]["voice_enabled"] = self.dialog.get_value("general", "disable_sapi5")
config.app["app-settings"]["hide_gui"] = self.dialog.get_value("general", "hide_gui")

View File

@ -1,18 +1,17 @@
# -*- coding: utf-8 -*-
import widgetUtils
import config
import os
import paths
import logging
log = logging.getLogger("extra.SoundsTutorial.soundsTutorial")
import sound
import wx_ui
import soundsTutorial_constants
class soundsTutorial(object):
def __init__(self):
def __init__(self, sessionObject):
log.debug("Creating sounds tutorial object...")
super(soundsTutorial, self).__init__()
self.session = sessionObject
self.actions = []
log.debug("Loading actions for sounds tutorial...")
[self.actions.append(i[1]) for i in soundsTutorial_constants.actions]
@ -26,6 +25,6 @@ class soundsTutorial(object):
def on_play(self, *args, **kwargs):
try:
sound.player.play(self.files[self.dialog.items.GetSelection()]+".ogg")
self.session.sound.play(self.files[self.dialog.items.GetSelection()]+".ogg")
except:
log.exception("Error playing the %s sound" % (self.files[self.dialog.items.GetSelection()],))

View File

@ -32,7 +32,6 @@ def setup():
del sm
r = mainController.Controller()
r.view.Show()
sound.player.play("ready.ogg")
app.MainLoop()
setup()

View File

@ -94,15 +94,19 @@ class Session(object):
def get_configuration(self):
""" Gets settings for a session."""
""" Gets settings for a session."""
file_ = "%s/session.conf" % (self.session_id,)
try:
file_ = "%s/session.conf" % (self.session_id,)
# try:
log.debug("Creating config file %s" % (file_,))
self.settings = Configuration(paths.config_path(file_), paths.app_path("Conf.defaults"))
except:
log.exception("The session configuration has failed.")
self.settings = None
self.init_sound()
# except:
# log.exception("The session configuration has failed.")
# self.settings = None
def init_sound(self):
self.sound = sound.soundSystem(self.settings["sound"])
@_require_configuration
def login(self):

View File

@ -14,13 +14,10 @@ import output
system = platform.system()
from mysc.repeating_timer import RepeatingTimer
player = URLPlayer = None
URLPlayer = None
def setup():
global player, URLPlayer
if not player:
log.debug("Creating sound player...")
player = soundSystem()
global URLPlayer
if not URLPlayer:
log.debug("creating stream URL player...")
URLPlayer = URLStream()
@ -42,8 +39,8 @@ class soundSystem(object):
def check_soundpack(self):
""" Checks if the folder where live the current soundpack exists."""
self.soundpack_OK = False
if os.path.exists(paths.sound_path(config.app["app-settings"]["current_soundpack"])):
self.path = paths.sound_path(config.app["app-settings"]["current_soundpack"])
if os.path.exists(paths.sound_path(self.config["current_soundpack"])):
self.path = paths.sound_path(self.config["current_soundpack"])
self.soundpack_OK = True
elif os.path.exists(paths.sound_path("default")):
log.error("The soundpack does not exist, using default...")
@ -53,20 +50,24 @@ class soundSystem(object):
log.error("Path for the current soundpack does not exist and the default soundpack is deleted, TWBlue will not play sounds.")
self.soundpack_OK = False
def __init__(self):
def __init__(self, soundConfig):
""" Sound Player."""
self.config = soundConfig
# Set the output and input default devices.
self.output = sound_lib.output.Output()
self.input = sound_lib.input.Input()
# Try to use the selected device from the configuration. It can fail if the machine does not has a mic.
try:
self.output = sound_lib.output.Output()
self.input = sound_lib.input.Input()
except:
pass
# Try to use the selected device from the configuration. It can fail if the machine does not has a mic.
try:
log.debug("Setting input and output devices...")
self.output.set_device(self.output.find_device_by_name(config.app["app-settings"]["output_device"]))
self.input.set_device(self.input.find_device_by_name(config.app["app-settings"]["input_device"]))
self.output.set_device(self.output.find_device_by_name(self.config["output_device"]))
self.input.set_device(self.input.find_device_by_name(self.config["input_device"]))
except:
log.error("Error in input or output devices, using defaults...")
config.app["app-settings"]["output_device"] = "Default"
config.app["app-settings"]["input_device"] = "Default"
self.config["output_device"] = "Default"
self.config["input_device"] = "Default"
self.files = []
self.cleaner = RepeatingTimer(60, self.clear_list)
@ -87,9 +88,9 @@ class soundSystem(object):
def play(self, sound, argument=False):
if self.soundpack_OK == False: return
if config.app["app-settings"]["global_mute"] == True: return
if self.config["global_mute"] == True: return
sound_object = sound_lib.stream.FileStream(file="%s/%s" % (self.path, sound))
sound_object.volume = float(config.app["app-settings"]["volume"])
sound_object.volume = float(self.config["volume"])
self.files.append(sound_object)
sound_object.play()

View File

@ -20,6 +20,8 @@ class timelinesStreamer(TwythonStreamer):
def check_tls(self, data):
for i in self.session.settings["other_buffers"]["timelines"]:
if data["user"]["screen_name"] == i:
if self.session.settings["general"]["reverse_timelines"] == False: self.session.db[i].append(data)
else: self.session.db[i].insert(0, data)
pub.sendMessage("item-in-timeline", data= data, user= self.session.db["user_name"], who= i)
def on_success(self, data):

View File

@ -6,3 +6,7 @@ def retweet_question(parent):
def delete_tweet_dialog(parent):
return wx.MessageDialog(parent, _(u"Do you really want to delete this message? It will be eliminated from Twitter as well."), _(u"Delete"), wx.ICON_QUESTION|wx.YES_NO).ShowModal()
def exit_dialog():
dlg = wx.MessageDialog(None, _(u"Do you really want to close TW Blue?"), _(u"Exit"), wx.YES_NO|wx.ICON_QUESTION)
return dlg.ShowModal()

View File

@ -14,28 +14,14 @@ 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.relative_time = wx.CheckBox(self, -1, _(U"Relative times"))
sizer.Add(self.relative_time, 0, wx.ALL, 5)
self.ask_at_exit = wx.CheckBox(self, -1, _(U"ask before exiting TwBlue?"))
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"))
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.show_gui = wx.CheckBox(self, -1, _(u"Activate the auto-start of the invisible interface"))
sizer.Add(self.show_gui, 0, wx.ALL, 5)
apiCallsBox = wx.BoxSizer(wx.HORIZONTAL)
apiCallsBox.Add(wx.StaticText(self, -1, _(u"API calls when the stream is started (One API call equals to 200 tweetts, two API calls equals 400 tweets, etc):")), 0, wx.ALL, 5)
self.apiCalls = wx.SpinCtrl(self, -1)
self.apiCalls.SetRange(1, 10)
self.apiCalls.SetSize(self.apiCalls.GetBestSize())
apiCallsBox.Add(self.apiCalls, 0, wx.ALL, 5)
sizer.Add(apiCallsBox, 0, wx.ALL, 5)
tweetsPerCallBox = wx.BoxSizer(wx.HORIZONTAL)
tweetsPerCallBox.Add(wx.StaticText(self, -1, _(u"Items on each API call")), 0, wx.ALL, 5)
self.itemsPerApiCall = wx.SpinCtrl(self, -1)
self.itemsPerApiCall.SetRange(0, 200)
self.itemsPerApiCall.SetSize(self.itemsPerApiCall.GetBestSize())
tweetsPerCallBox.Add(self.itemsPerApiCall, 0, wx.ALL, 5)
sizer.Add(tweetsPerCallBox, 0, wx.ALL, 5)
self.reverse_timelines = wx.CheckBox(self, -1, _(u"Inverted buffers: The newest tweets will be shown at the beginning of the lists while the oldest at the end"))
sizer.Add(self.reverse_timelines, 0, wx.ALL, 5)
self.hide_gui = wx.CheckBox(self, -1, _(u"Activate the auto-start of the invisible interface"))
sizer.Add(self.hide_gui, 0, wx.ALL, 5)
self.SetSizer(sizer)
class other_buffers(wx.Panel):
@ -131,7 +117,7 @@ class audioServicesPanel(wx.Panel):
mainSizer.Add(first_sizer, 0, wx.ALL, 5)
self.SetSizer(mainSizer)
class configurationDialog(wx.Dialog):
class configurationDialog(baseDialog.BaseWXDialog):
def __init__(self):
super(configurationDialog, self).__init__(None, -1)
self.panel = wx.Panel(self)
@ -176,7 +162,8 @@ class configurationDialog(wx.Dialog):
p = getattr(self, panel)
return getattr(p, key).GetValue()
def set_value(self, panel, key):
def set_value(self, panel, key, value):
p = getattr(self, panel)
getattr(self, p).SetValue(key)
control = getattr(p, key)
getattr(control, "SetValue")(value)

View File

@ -146,3 +146,4 @@ class mainFrame(wx.Frame):
def show(self):
self.Show()