2014-11-12 20:41:29 -06:00
# -*- coding: utf-8 -*-
import baseDialog
import wx
import logging as original_logger
2015-04-17 17:53:24 -04:00
import application
2015-05-05 17:52:54 -05:00
from multiplatform_widgets import widgets
2015-05-06 10:42:39 -04:00
import output
2015-05-11 21:21:27 -04:00
import config
2015-06-11 16:09:46 -05:00
2014-11-12 20:41:29 -06:00
class general ( wx . Panel , baseDialog . BaseWXDialog ) :
2015-05-16 13:28:44 -04:00
def __init__ ( self , parent , languages , keymaps ) :
2014-11-12 20:41:29 -06:00
super ( general , self ) . __init__ ( parent )
sizer = wx . BoxSizer ( wx . VERTICAL )
language = wx . StaticText ( self , - 1 , _ ( u " Language " ) )
self . language = wx . ListBox ( self , - 1 , choices = languages )
self . language . SetSize ( self . language . GetBestSize ( ) )
langBox = wx . BoxSizer ( wx . HORIZONTAL )
langBox . Add ( language , 0 , wx . ALL , 5 )
langBox . Add ( self . language , 0 , wx . ALL , 5 )
sizer . Add ( langBox , 0 , wx . ALL , 5 )
2016-08-05 15:31:22 -05:00
self . autostart = wx . CheckBox ( self , - 1 , _ ( u " Run {0} at Windows startup " ) . format ( application . name , ) )
2015-06-15 04:56:36 -05:00
self . ask_at_exit = wx . CheckBox ( self , - 1 , _ ( U " ask before exiting {0} " ) . format ( application . name , ) )
2016-08-05 15:31:22 -05:00
sizer . Add ( self . autostart , 0 , wx . ALL , 5 )
2015-01-20 15:40:33 -06:00
sizer . Add ( self . ask_at_exit , 0 , wx . ALL , 5 )
2015-06-15 04:56:36 -05:00
self . play_ready_sound = wx . CheckBox ( self , - 1 , _ ( U " Play a sound when {0} launches " ) . format ( application . name , ) )
2015-04-17 17:53:24 -04:00
sizer . Add ( self . play_ready_sound , 0 , wx . ALL , 5 )
2015-06-15 04:56:36 -05:00
self . speak_ready_msg = wx . CheckBox ( self , - 1 , _ ( U " Speak a message when {0} launches " ) . format ( application . name , ) )
2015-04-17 17:53:24 -04:00
sizer . Add ( self . speak_ready_msg , 0 , wx . ALL , 5 )
2015-04-17 18:24:27 -04:00
self . use_invisible_shorcuts = wx . CheckBox ( self , - 1 , _ ( u " Use invisible interface ' s keyboard shortcuts while GUI is visible " ) )
2015-01-20 15:40:33 -06:00
sizer . Add ( self . use_invisible_shorcuts , 0 , wx . ALL , 5 )
2014-11-12 20:41:29 -06:00
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 )
2015-04-17 18:24:27 -04:00
self . hide_gui = wx . CheckBox ( self , - 1 , _ ( u " Hide GUI on launch " ) )
2015-01-20 15:40:33 -06:00
sizer . Add ( self . hide_gui , 0 , wx . ALL , 5 )
2015-06-26 22:32:50 -07:00
self . handle_longtweets = wx . CheckBox ( self , wx . NewId ( ) , _ ( u " Use Codeofdusk ' s longtweet handlers (may decrease client performance) " ) )
sizer . Add ( self . handle_longtweets , 0 , wx . ALL , 5 )
2015-05-16 13:28:44 -04:00
kmbox = wx . BoxSizer ( wx . VERTICAL )
km_label = wx . StaticText ( self , - 1 , _ ( u " Keymap " ) )
self . km = wx . ComboBox ( self , - 1 , choices = keymaps , style = wx . CB_READONLY )
self . km . SetSize ( self . km . GetBestSize ( ) )
kmbox . Add ( km_label , 0 , wx . ALL , 5 )
kmbox . Add ( self . km , 0 , wx . ALL , 5 )
2016-04-27 16:33:51 -05:00
self . check_for_updates = wx . CheckBox ( self , - 1 , _ ( U " Check for updates when {0} launches " ) . format ( application . name , ) )
sizer . Add ( self . check_for_updates , 0 , wx . ALL , 5 )
2015-05-16 13:28:44 -04:00
sizer . Add ( kmbox , 0 , wx . ALL , 5 )
self . SetSizer ( sizer )
2014-11-12 20:41:29 -06:00
2015-04-20 17:49:07 -05:00
class proxy ( wx . Panel , baseDialog . BaseWXDialog ) :
def __init__ ( self , parent ) :
super ( proxy , self ) . __init__ ( parent )
sizer = wx . BoxSizer ( wx . VERTICAL )
lbl = wx . StaticText ( self , wx . NewId ( ) , _ ( u " Proxy server: " ) )
self . server = wx . TextCtrl ( self , - 1 )
serverBox = wx . BoxSizer ( wx . HORIZONTAL )
serverBox . Add ( lbl , 0 , wx . ALL , 5 )
serverBox . Add ( self . server , 0 , wx . ALL , 5 )
sizer . Add ( serverBox , 0 , wx . ALL , 5 )
lbl = wx . StaticText ( self , wx . NewId ( ) , _ ( u " Port: " ) )
self . port = wx . TextCtrl ( self , wx . NewId ( ) )
portBox = wx . BoxSizer ( wx . HORIZONTAL )
portBox . Add ( lbl , 0 , wx . ALL , 5 )
portBox . Add ( self . port , 0 , wx . ALL , 5 )
sizer . Add ( portBox , 0 , wx . ALL , 5 )
lbl = wx . StaticText ( self , wx . NewId ( ) , _ ( u " User: " ) )
self . user = wx . TextCtrl ( self , wx . NewId ( ) )
userBox = wx . BoxSizer ( wx . HORIZONTAL )
userBox . Add ( lbl , 0 , wx . ALL , 5 )
userBox . Add ( self . user , 0 , wx . ALL , 5 )
sizer . Add ( userBox , 0 , wx . ALL , 5 )
lbl = wx . StaticText ( self , wx . NewId ( ) , _ ( u " Password: " ) )
self . password = wx . TextCtrl ( self , wx . NewId ( ) , style = wx . TE_PASSWORD )
passwordBox = wx . BoxSizer ( wx . HORIZONTAL )
passwordBox . Add ( lbl , 0 , wx . ALL , 5 )
passwordBox . Add ( self . password , 0 , wx . ALL , 5 )
sizer . Add ( serverBox , 0 , wx . ALL , 5 )
self . SetSizer ( sizer )
2015-01-25 02:38:17 -06:00
class generalAccount ( wx . Panel , baseDialog . BaseWXDialog ) :
def __init__ ( self , parent ) :
super ( generalAccount , self ) . __init__ ( parent )
sizer = wx . BoxSizer ( wx . VERTICAL )
2015-04-17 18:31:27 -04:00
self . au = wx . Button ( self , wx . NewId ( ) , _ ( u " Autocompletion settings... " ) )
2015-01-25 02:38:17 -06:00
sizer . Add ( self . au , 0 , wx . ALL , 5 )
2015-04-17 18:24:27 -04:00
self . relative_time = wx . CheckBox ( self , wx . NewId ( ) , _ ( U " Relative timestamps " ) )
2015-01-25 02:38:17 -06:00
sizer . Add ( self . relative_time , 0 , wx . ALL , 5 )
apiCallsBox = wx . BoxSizer ( wx . HORIZONTAL )
2015-04-17 18:31:27 -04:00
apiCallsBox . Add ( wx . StaticText ( self , - 1 , _ ( u " API calls (One API call = 200 tweets, two API calls = 400 tweets, etc): " ) ) , 0 , wx . ALL , 5 )
2015-01-25 02:38:17 -06:00
self . apiCalls = wx . SpinCtrl ( self , wx . NewId ( ) )
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 , wx . NewId ( ) )
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 )
2015-04-17 18:24:27 -04:00
self . reverse_timelines = wx . CheckBox ( self , wx . NewId ( ) , _ ( u " Inverted buffers: The newest tweets will be shown at the beginning while the oldest at the end " ) )
2015-01-25 02:38:17 -06:00
sizer . Add ( self . reverse_timelines , 0 , wx . ALL , 5 )
2015-04-17 18:24:27 -04:00
lbl = wx . StaticText ( self , wx . NewId ( ) , _ ( u " Retweet mode " ) )
2015-04-15 11:09:36 -05:00
self . retweet_mode = wx . ComboBox ( self , wx . NewId ( ) , choices = [ _ ( u " Ask " ) , _ ( u " Retweet without comments " ) , _ ( u " Retweet with comments " ) ] , style = wx . CB_READONLY )
rMode = wx . BoxSizer ( wx . HORIZONTAL )
rMode . Add ( lbl , 0 , wx . ALL , 5 )
rMode . Add ( self . retweet_mode , 0 , wx . ALL , 5 )
sizer . Add ( rMode , 0 , wx . ALL , 5 )
2015-05-09 23:04:06 -04:00
PersistSizeLabel = wx . StaticText ( self , - 1 , _ ( u " Number of items per buffer to cache in database (0 to disable caching, blank for unlimited) " ) )
self . persist_size = wx . TextCtrl ( self , - 1 )
sizer . Add ( PersistSizeLabel , 0 , wx . ALL , 5 )
sizer . Add ( self . persist_size , 0 , wx . ALL , 5 )
2015-01-25 02:38:17 -06:00
self . SetSizer ( sizer )
2014-11-12 20:41:29 -06:00
class other_buffers ( wx . Panel ) :
def __init__ ( self , parent ) :
super ( other_buffers , self ) . __init__ ( parent )
sizer = wx . BoxSizer ( wx . VERTICAL )
2016-08-05 15:50:46 +02:00
self . buffers = widgets . list ( self , _ ( u " Buffer " ) , _ ( u " Name " ) , _ ( u " Status " ) , style = wx . LC_SINGLE_SEL | wx . LC_REPORT )
2015-05-05 17:52:54 -05:00
sizer . Add ( self . buffers . list , 0 , wx . ALL , 5 )
btnSizer = wx . BoxSizer ( wx . HORIZONTAL )
2015-05-06 00:26:01 -04:00
self . toggle_state = wx . Button ( self , - 1 , _ ( u " Show/hide " ) )
2015-05-05 17:52:54 -05:00
self . up = wx . Button ( self , - 1 , _ ( u " Move up " ) )
self . down = wx . Button ( self , - 1 , _ ( u " Move down " ) )
2015-05-06 00:26:01 -04:00
btnSizer . Add ( self . toggle_state , 0 , wx . ALL , 5 )
2015-05-05 17:52:54 -05:00
btnSizer . Add ( self . up , 0 , wx . ALL , 5 )
btnSizer . Add ( self . down , 0 , wx . ALL , 5 )
sizer . Add ( btnSizer , 0 , wx . ALL , 5 )
2014-11-12 20:41:29 -06:00
self . SetSizer ( sizer )
2015-05-05 17:52:54 -05:00
def insert_buffers ( self , buffers ) :
for i in buffers :
2016-08-05 15:50:46 +02:00
if i [ 2 ] == True :
self . buffers . insert_item ( False , * [ i [ 0 ] , i [ 1 ] , _ ( u " Show " ) ] )
2015-05-05 17:52:54 -05:00
else :
2016-08-05 15:50:46 +02:00
self . buffers . insert_item ( False , * [ i [ 0 ] , i [ 1 ] , _ ( u " Hide " ) ] )
2015-05-05 17:52:54 -05:00
def connect_hook_func ( self , func ) :
self . buffers . list . Bind ( wx . EVT_CHAR_HOOK , func )
2015-05-06 12:05:33 -04:00
def move_up ( self , * args , * * kwargs ) :
current = self . buffers . get_selected ( )
2015-05-06 12:36:48 -04:00
if current == - 1 :
2015-05-06 13:33:53 -05:00
output . speak ( _ ( u " Select a buffer first. " ) , True )
2015-05-06 12:36:48 -04:00
return False
2016-08-05 15:50:46 +02:00
if self . buffers . get_text_column ( current , 2 ) == _ ( u " Hide " ) :
2015-05-06 13:33:53 -05:00
output . speak ( _ ( u " The buffer is hidden, show it first. " ) , True )
2015-05-06 12:05:33 -04:00
return False
2015-05-06 12:36:48 -04:00
if current < = 0 :
2015-05-06 13:33:53 -05:00
output . speak ( _ ( u " The buffer is already at the top of the list. " ) , True )
2015-05-06 13:46:47 -05:00
return False
2015-05-06 12:56:32 -05:00
current_text = self . buffers . get_text_column ( self . buffers . get_selected ( ) , 0 )
2016-08-05 15:50:46 +02:00
current_name = self . buffers . get_text_column ( self . buffers . get_selected ( ) , 1 )
current_text_state = self . buffers . get_text_column ( self . buffers . get_selected ( ) , 2 )
2015-05-06 12:56:32 -05:00
text_above = self . buffers . get_text_column ( self . buffers . get_selected ( ) - 1 , 0 )
2016-08-05 15:50:46 +02:00
name_above = self . buffers . get_text_column ( self . buffers . get_selected ( ) - 1 , 1 )
text_above_state = self . buffers . get_text_column ( self . buffers . get_selected ( ) - 1 , 2 )
2015-05-06 12:56:32 -05:00
self . buffers . set_text_column ( self . buffers . get_selected ( ) - 1 , 0 , current_text )
2016-08-05 15:50:46 +02:00
self . buffers . set_text_column ( self . buffers . get_selected ( ) - 1 , 1 , current_name )
self . buffers . set_text_column ( self . buffers . get_selected ( ) - 1 , 2 , current_text_state )
2015-05-06 12:56:32 -05:00
self . buffers . set_text_column ( self . buffers . get_selected ( ) , 0 , text_above )
2016-08-05 15:50:46 +02:00
self . buffers . set_text_column ( self . buffers . get_selected ( ) , 1 , name_above )
self . buffers . set_text_column ( self . buffers . get_selected ( ) , 2 , text_above_state )
2015-05-06 12:56:32 -05:00
2015-05-06 12:05:33 -04:00
def move_down ( self , * args , * * kwargs ) :
current = self . buffers . get_selected ( )
2015-05-06 12:36:48 -04:00
if current == - 1 :
2015-05-06 13:33:53 -05:00
output . speak ( _ ( u " Select a buffer first. " ) , True )
2015-05-06 12:36:48 -04:00
return False
2016-08-05 15:50:46 +02:00
if self . buffers . get_text_column ( current , 2 ) == _ ( u " Hide " ) :
2015-05-06 13:33:53 -05:00
output . speak ( _ ( u " The buffer is hidden, show it first. " ) , True )
2015-05-06 12:05:33 -04:00
return False
2015-05-06 13:46:47 -05:00
if current + 1 > = self . buffers . get_count ( ) :
2015-05-06 13:33:53 -05:00
output . speak ( _ ( u " The buffer is already at the bottom of the list. " ) , True )
2015-05-06 13:46:47 -05:00
return False
2015-05-06 12:56:32 -05:00
current_text = self . buffers . get_text_column ( self . buffers . get_selected ( ) , 0 )
2016-08-05 15:50:46 +02:00
current_name = self . buffers . get_text_column ( self . buffers . get_selected ( ) , 1 )
current_text_state = self . buffers . get_text_column ( self . buffers . get_selected ( ) , 2 )
2015-05-06 12:56:32 -05:00
text_below = self . buffers . get_text_column ( self . buffers . get_selected ( ) + 1 , 0 )
2016-08-05 15:50:46 +02:00
name_below = self . buffers . get_text_column ( self . buffers . get_selected ( ) + 1 , 1 )
text_below_state = self . buffers . get_text_column ( self . buffers . get_selected ( ) + 1 , 2 )
2015-05-06 12:56:32 -05:00
self . buffers . set_text_column ( self . buffers . get_selected ( ) + 1 , 0 , current_text )
2016-08-05 15:50:46 +02:00
self . buffers . set_text_column ( self . buffers . get_selected ( ) + 1 , 1 , current_name )
self . buffers . set_text_column ( self . buffers . get_selected ( ) + 1 , 2 , current_text_state )
2015-05-06 12:56:32 -05:00
self . buffers . set_text_column ( self . buffers . get_selected ( ) , 0 , text_below )
2016-08-05 15:50:46 +02:00
self . buffers . set_text_column ( self . buffers . get_selected ( ) , 1 , name_below )
self . buffers . set_text_column ( self . buffers . get_selected ( ) , 2 , text_below_state )
2015-05-05 17:52:54 -05:00
def get_event ( self , ev ) :
2015-05-06 10:27:22 -04:00
if ev . GetKeyCode ( ) == wx . WXK_SPACE :
2015-05-05 17:52:54 -05:00
return True
else :
ev . Skip ( )
return False
def change_selected_item ( self ) :
current = self . buffers . get_selected ( )
2016-08-05 15:50:46 +02:00
text = self . buffers . get_text_column ( current , 2 )
2015-05-05 17:52:54 -05:00
if text == _ ( u " Show " ) :
2016-08-05 15:50:46 +02:00
self . buffers . set_text_column ( current , 2 , _ ( u " Hide " ) )
2015-05-05 17:52:54 -05:00
else :
2016-08-05 15:50:46 +02:00
self . buffers . set_text_column ( current , 2 , _ ( u " Show " ) )
output . speak ( self . buffers . get_text_column ( current , 2 ) , True )
2015-05-05 17:52:54 -05:00
def get_list ( self ) :
buffers_list = [ ]
for i in xrange ( 0 , self . buffers . get_count ( ) ) :
2016-08-05 15:50:46 +02:00
if self . buffers . get_text_column ( i , 2 ) == _ ( u " Show " ) :
2015-05-05 17:52:54 -05:00
buffers_list . append ( self . buffers . get_text_column ( i , 0 ) )
return buffers_list
2014-11-12 20:41:29 -06:00
class ignoredClients ( wx . Panel ) :
def __init__ ( self , parent , choices ) :
super ( ignoredClients , self ) . __init__ ( parent = parent )
sizer = wx . BoxSizer ( wx . VERTICAL )
label = wx . StaticText ( self , - 1 , _ ( u " Ignored clients " ) )
self . clients = wx . ListBox ( self , - 1 , choices = choices )
self . clients . SetSize ( self . clients . GetBestSize ( ) )
clientsBox = wx . BoxSizer ( wx . HORIZONTAL )
clientsBox . Add ( label , 0 , wx . ALL , 5 )
clientsBox . Add ( self . clients , 0 , wx . ALL , 5 )
2015-01-25 02:38:17 -06:00
self . add = wx . Button ( self , - 1 , _ ( u " Add client " ) )
self . remove = wx . Button ( self , - 1 , _ ( u " Remove client " ) )
2014-11-12 20:41:29 -06:00
btnBox = wx . BoxSizer ( wx . HORIZONTAL )
2015-01-25 02:38:17 -06:00
btnBox . Add ( self . add , 0 , wx . ALL , 5 )
btnBox . Add ( self . remove , 0 , wx . ALL , 5 )
2014-11-12 20:41:29 -06:00
sizer . Add ( clientsBox , 0 , wx . ALL , 5 )
sizer . Add ( btnBox , 0 , wx . ALL , 5 )
self . SetSizer ( sizer )
2015-01-27 17:09:28 -06:00
def append ( self , client ) :
self . clients . Append ( client )
def get_clients ( self ) :
return self . clients . GetCount ( )
def get_client_id ( self ) :
return self . clients . GetSelection ( )
2015-02-01 00:49:03 -06:00
def remove_ ( self , id ) :
2015-01-27 17:09:28 -06:00
self . clients . Delete ( id )
2014-11-12 20:41:29 -06:00
class sound ( wx . Panel ) :
def __init__ ( self , parent , input_devices , output_devices , soundpacks ) :
wx . Panel . __init__ ( self , parent )
sizer = wx . BoxSizer ( wx . VERTICAL )
volume = wx . StaticText ( self , - 1 , _ ( u " Volume " ) )
self . volumeCtrl = wx . Slider ( self )
self . volumeCtrl . SetRange ( 0 , 100 )
self . volumeCtrl . SetSize ( self . volumeCtrl . GetBestSize ( ) )
volumeBox = wx . BoxSizer ( wx . HORIZONTAL )
volumeBox . Add ( volume , 0 , wx . ALL , 5 )
volumeBox . Add ( self . volumeCtrl , 0 , wx . ALL , 5 )
sizer . Add ( volumeBox , 0 , wx . ALL , 5 )
2015-03-11 17:17:29 -06:00
self . session_mute = wx . CheckBox ( self , - 1 , _ ( u " Session mute " ) )
sizer . Add ( self . session_mute , 0 , wx . ALL , 5 )
2014-11-12 20:41:29 -06:00
output_label = wx . StaticText ( self , - 1 , _ ( u " Output device " ) )
self . output = wx . ComboBox ( self , - 1 , choices = output_devices , style = wx . CB_READONLY )
self . output . SetSize ( self . output . GetBestSize ( ) )
outputBox = wx . BoxSizer ( wx . HORIZONTAL )
outputBox . Add ( output_label , 0 , wx . ALL , 5 )
outputBox . Add ( self . output , 0 , wx . ALL , 5 )
sizer . Add ( outputBox , 0 , wx . ALL , 5 )
input_label = wx . StaticText ( self , - 1 , _ ( u " Input device " ) )
self . input = wx . ComboBox ( self , - 1 , choices = input_devices , style = wx . CB_READONLY )
self . input . SetSize ( self . input . GetBestSize ( ) )
inputBox = wx . BoxSizer ( wx . HORIZONTAL )
inputBox . Add ( input_label , 0 , wx . ALL , 5 )
inputBox . Add ( self . input , 0 , wx . ALL , 5 )
sizer . Add ( inputBox , 0 , wx . ALL , 5 )
soundBox = wx . BoxSizer ( wx . VERTICAL )
soundpack_label = wx . StaticText ( self , - 1 , _ ( u " Sound pack " ) )
self . soundpack = wx . ComboBox ( self , - 1 , choices = soundpacks , style = wx . CB_READONLY )
self . soundpack . SetSize ( self . soundpack . GetBestSize ( ) )
soundBox . Add ( soundpack_label , 0 , wx . ALL , 5 )
soundBox . Add ( self . soundpack , 0 , wx . ALL , 5 )
sizer . Add ( soundBox , 0 , wx . ALL , 5 )
self . SetSizer ( sizer )
2015-01-27 17:09:28 -06:00
def get ( self , control ) :
return getattr ( self , control ) . GetStringSelection ( )
2015-06-21 21:20:53 -05:00
class servicesPanel ( wx . Panel ) :
2014-11-12 20:41:29 -06:00
def __init__ ( self , parent ) :
2015-06-21 21:20:53 -05:00
super ( servicesPanel , self ) . __init__ ( parent )
2014-11-12 20:41:29 -06:00
mainSizer = wx . BoxSizer ( wx . VERTICAL )
2015-06-26 08:27:43 -05:00
apiKeyLabel = wx . StaticText ( self , - 1 , _ ( u " If you have a SndUp account, enter your API Key here. If your API Key is invalid, {0} will fail to upload. If there is no API Key here, {0} will upload annonymously. " ) . format ( application . name , ) )
2014-11-12 20:41:29 -06:00
self . apiKey = wx . TextCtrl ( self , - 1 )
dc = wx . WindowDC ( self . apiKey )
dc . SetFont ( self . apiKey . GetFont ( ) )
self . apiKey . SetSize ( dc . GetTextExtent ( " 0 " * 100 ) )
apiKeyBox = wx . BoxSizer ( wx . HORIZONTAL )
apiKeyBox . Add ( apiKeyLabel , 0 , wx . ALL , 5 )
apiKeyBox . Add ( self . apiKey , 0 , wx . ALL , 5 )
mainSizer . Add ( apiKeyBox , 0 , wx . ALL , 5 )
2015-11-28 09:54:58 -06:00
# self.pocketBtn = wx.Button(self, -1)
# mainSizer.Add(self.pocketBtn, 0, wx.ALL, 5)
2014-11-12 20:41:29 -06:00
self . SetSizer ( mainSizer )
2015-06-21 21:20:53 -05:00
def set_pocket ( self , active = True ) :
if active == True :
self . pocketBtn . SetLabel ( _ ( u " Disconnect your Pocket account " ) )
else :
self . pocketBtn . SetLabel ( _ ( u " Connect your Pocket account " ) )
def show_pocket_dialog ( self ) :
return wx . MessageDialog ( self , _ ( u " The authorization request will be opened in your browser. You only need to do this once. Do you want to continue? " ) , _ ( u " Pocket Authorization " ) , wx . YES_NO ) . ShowModal ( )
def show_pocket_authorization_error ( self ) :
wx . MessageDialog ( self , _ ( u " Error during authorization. Try again later. " ) , _ ( u " Error! " ) , wx . ICON_ERROR ) . ShowModal ( )
def get_pocket_status ( self ) :
return self . pocketBtn . GetLabel ( )
2015-01-20 15:40:33 -06:00
class configurationDialog ( baseDialog . BaseWXDialog ) :
2015-01-25 02:38:17 -06:00
def set_title ( self , title ) :
self . SetTitle ( title )
2014-11-12 20:41:29 -06:00
def __init__ ( self ) :
super ( configurationDialog , self ) . __init__ ( None , - 1 )
self . panel = wx . Panel ( self )
2015-06-26 08:27:43 -05:00
self . SetTitle ( _ ( u " {0} preferences " ) . format ( application . name , ) )
2014-11-12 20:41:29 -06:00
self . sizer = wx . BoxSizer ( wx . VERTICAL )
self . notebook = wx . Notebook ( self . panel )
2015-05-16 13:28:44 -04:00
def create_general ( self , languageList , keymaps ) :
self . general = general ( self . notebook , languageList , keymaps )
2014-11-12 20:41:29 -06:00
self . notebook . AddPage ( self . general , _ ( u " General " ) )
self . general . SetFocus ( )
2015-04-20 17:49:07 -05:00
def create_proxy ( self ) :
self . proxy = proxy ( self . notebook )
self . notebook . AddPage ( self . proxy , _ ( u " Proxy " ) )
2015-01-25 02:38:17 -06:00
def create_general_account ( self ) :
self . general = generalAccount ( self . notebook )
self . notebook . AddPage ( self . general , _ ( u " General " ) )
self . general . SetFocus ( )
2014-11-12 20:41:29 -06:00
def create_other_buffers ( self ) :
self . buffers = other_buffers ( self . notebook )
2015-04-17 18:31:27 -04:00
self . notebook . AddPage ( self . buffers , _ ( u " Buffers " ) )
2014-11-12 20:41:29 -06:00
def create_ignored_clients ( self , ignored_clients_list ) :
self . ignored_clients = ignoredClients ( self . notebook , ignored_clients_list )
self . notebook . AddPage ( self . ignored_clients , _ ( u " Ignored clients " ) )
def create_sound ( self , output_devices , input_devices , soundpacks ) :
self . sound = sound ( self . notebook , output_devices , input_devices , soundpacks )
self . notebook . AddPage ( self . sound , _ ( u " Sound " ) )
2015-06-21 21:20:53 -05:00
def create_services ( self ) :
self . services = servicesPanel ( self . notebook )
self . notebook . AddPage ( self . services , _ ( u " Services " ) )
2014-11-12 20:41:29 -06:00
def realize ( self ) :
self . sizer . Add ( self . notebook , 0 , wx . ALL , 5 )
ok_cancel_box = wx . BoxSizer ( wx . HORIZONTAL )
ok = wx . Button ( self . panel , wx . ID_OK , _ ( u " Save " ) )
ok . SetDefault ( )
cancel = wx . Button ( self . panel , wx . ID_CANCEL , _ ( u " Close " ) )
self . SetEscapeId ( cancel . GetId ( ) )
ok_cancel_box . Add ( ok , 0 , wx . ALL , 5 )
ok_cancel_box . Add ( cancel , 0 , wx . ALL , 5 )
self . sizer . Add ( ok_cancel_box , 0 , wx . ALL , 5 )
self . panel . SetSizer ( self . sizer )
self . SetClientSize ( self . sizer . CalcMin ( ) )
def get_value ( self , panel , key ) :
p = getattr ( self , panel )
return getattr ( p , key ) . GetValue ( )
2015-01-20 15:40:33 -06:00
def set_value ( self , panel , key , value ) :
2014-11-12 20:41:29 -06:00
p = getattr ( self , panel )
2015-01-20 15:40:33 -06:00
control = getattr ( p , key )
getattr ( control , " SetValue " ) ( value )
2014-11-12 20:41:29 -06:00