mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 11:18:08 -06:00
Buffer configuration rewritten (move up and down is not possible yet)
This commit is contained in:
parent
1c4d0cc530
commit
501a5cd57e
@ -91,6 +91,13 @@ class accountSettingsController(globalSettingsController):
|
||||
self.dialog.set_value("general", "retweet_mode", _(u"Retweet with comments"))
|
||||
self.dialog.set_value("general", "persistant_session", self.config["general"]["persistant_session"])
|
||||
self.dialog.create_other_buffers()
|
||||
buffer_values = self.get_buffers_list()
|
||||
self.dialog.buffers.insert_buffers(buffer_values)
|
||||
self.dialog.buffers.connect_hook_func(self.toggle_buffer_active)
|
||||
# widgetUtils.connect_event(self.dialog.buffers.up, widgetUtils.BUTTON_PRESSED, self.dialog.buffers.move_up)
|
||||
# widgetUtils.connect_event(self.dialog.buffers.down, widgetUtils.BUTTON_PRESSED, self.dialog.buffers.down)
|
||||
|
||||
|
||||
self.dialog.create_ignored_clients(self.config["twitter"]["ignored_clients"])
|
||||
widgetUtils.connect_event(self.dialog.ignored_clients.add, widgetUtils.BUTTON_PRESSED, self.add_ignored_client)
|
||||
widgetUtils.connect_event(self.dialog.ignored_clients.remove, widgetUtils.BUTTON_PRESSED, self.remove_ignored_client)
|
||||
@ -132,24 +139,28 @@ class accountSettingsController(globalSettingsController):
|
||||
self.config["general"]["retweet_mode"] = "direct"
|
||||
else:
|
||||
self.config["general"]["retweet_mode"] = "comment"
|
||||
if self.config["other_buffers"]["show_followers"] != self.dialog.get_value("buffers", "followers"):
|
||||
self.config["other_buffers"]["show_followers"] = self.dialog.get_value("buffers", "followers")
|
||||
pub.sendMessage("create-new-buffer", buffer="followers", account=self.user, create=self.config["other_buffers"]["show_followers"])
|
||||
if self.config["other_buffers"]["show_friends"] != self.dialog.get_value("buffers", "friends"):
|
||||
self.config["other_buffers"]["show_friends"] = self.dialog.get_value("buffers", "friends")
|
||||
pub.sendMessage("create-new-buffer", buffer="friends", account=self.user, create=self.config["other_buffers"]["show_friends"])
|
||||
if self.config["other_buffers"]["show_favourites"] != self.dialog.get_value("buffers", "favs"):
|
||||
self.config["other_buffers"]["show_favourites"] = self.dialog.get_value("buffers", "favs")
|
||||
pub.sendMessage("create-new-buffer", buffer="favourites", account=self.user, create=self.config["other_buffers"]["show_favourites"])
|
||||
if self.config["other_buffers"]["show_blocks"] != self.dialog.get_value("buffers", "blocks"):
|
||||
self.config["other_buffers"]["show_blocks"] = self.dialog.get_value("buffers", "blocks")
|
||||
pub.sendMessage("create-new-buffer", buffer="blocked", account=self.user, create=self.config["other_buffers"]["show_blocks"])
|
||||
if self.config["other_buffers"]["show_muted_users"] != self.dialog.get_value("buffers", "mutes"):
|
||||
self.config["other_buffers"]["show_muted_users"] = self.dialog.get_value("buffers", "mutes")
|
||||
pub.sendMessage("create-new-buffer", buffer="muted", account=self.user, create=self.config["other_buffers"]["show_muted_users"])
|
||||
if self.config["other_buffers"]["show_events"] != self.dialog.get_value("buffers", "events"):
|
||||
self.config["other_buffers"]["show_events"] = self.dialog.get_value("buffers", "events")
|
||||
pub.sendMessage("create-new-buffer", buffer="events", account=self.user, create=self.config["other_buffers"]["show_events"])
|
||||
buffers_list = self.dialog.buffers.get_list()
|
||||
# ToDo: Start the new added buffers.
|
||||
self.config["general"]["buffer_order"] = buffers_list
|
||||
|
||||
# if self.config["other_buffers"]["show_followers"] != self.dialog.get_value("buffers", "followers"):
|
||||
# self.config["other_buffers"]["show_followers"] = self.dialog.get_value("buffers", "followers")
|
||||
# pub.sendMessage("create-new-buffer", buffer="followers", account=self.user, create=self.config["other_buffers"]["show_followers"])
|
||||
# if self.config["other_buffers"]["show_friends"] != self.dialog.get_value("buffers", "friends"):
|
||||
# self.config["other_buffers"]["show_friends"] = self.dialog.get_value("buffers", "friends")
|
||||
# pub.sendMessage("create-new-buffer", buffer="friends", account=self.user, create=self.config["other_buffers"]["show_friends"])
|
||||
# if self.config["other_buffers"]["show_favourites"] != self.dialog.get_value("buffers", "favs"):
|
||||
# self.config["other_buffers"]["show_favourites"] = self.dialog.get_value("buffers", "favs")
|
||||
# pub.sendMessage("create-new-buffer", buffer="favourites", account=self.user, create=self.config["other_buffers"]["show_favourites"])
|
||||
# if self.config["other_buffers"]["show_blocks"] != self.dialog.get_value("buffers", "blocks"):
|
||||
# self.config["other_buffers"]["show_blocks"] = self.dialog.get_value("buffers", "blocks")
|
||||
# pub.sendMessage("create-new-buffer", buffer="blocked", account=self.user, create=self.config["other_buffers"]["show_blocks"])
|
||||
# if self.config["other_buffers"]["show_muted_users"] != self.dialog.get_value("buffers", "mutes"):
|
||||
# self.config["other_buffers"]["show_muted_users"] = self.dialog.get_value("buffers", "mutes")
|
||||
# pub.sendMessage("create-new-buffer", buffer="muted", account=self.user, create=self.config["other_buffers"]["show_muted_users"])
|
||||
# if self.config["other_buffers"]["show_events"] != self.dialog.get_value("buffers", "events"):
|
||||
# self.config["other_buffers"]["show_events"] = self.dialog.get_value("buffers", "events")
|
||||
# pub.sendMessage("create-new-buffer", buffer="events", account=self.user, create=self.config["other_buffers"]["show_events"])
|
||||
if self.config["sound"]["input_device"] != self.dialog.sound.get("input"):
|
||||
self.config["sound"]["input_device"] = self.dialog.sound.get("input")
|
||||
try:
|
||||
@ -211,3 +222,18 @@ class accountSettingsController(globalSettingsController):
|
||||
def disconnect_dropbox(self):
|
||||
self.config["services"]["dropbox_token"] = ""
|
||||
self.dialog.services.set_dropbox(False)
|
||||
|
||||
def get_buffers_list(self):
|
||||
all_buffers = ['home','mentions','dm','sent_dm','sent_tweets','favorites','followers','friends','blocks','muted','events']
|
||||
list_buffers = []
|
||||
for i in all_buffers:
|
||||
if i in self.config["general"]["buffer_order"]:
|
||||
list_buffers.append((i, True))
|
||||
else:
|
||||
list_buffers.append((i, False))
|
||||
return list_buffers
|
||||
|
||||
def toggle_buffer_active(self, ev):
|
||||
change = self.dialog.buffers.get_event(ev)
|
||||
if change == True:
|
||||
self.dialog.buffers.change_selected_item()
|
||||
|
@ -79,3 +79,11 @@ class list(object):
|
||||
return 0
|
||||
else:
|
||||
return selected
|
||||
|
||||
def get_text_column(self, indexId, column):
|
||||
item = self.list.GetItem(indexId, column)
|
||||
return item.GetText()
|
||||
|
||||
def set_text_column(self, indexId, column, text):
|
||||
item = self.list.SetStringItem(indexId, column, text)
|
||||
return item
|
@ -3,9 +3,10 @@ import application
|
||||
import update
|
||||
import platform
|
||||
from wxUpdater import *
|
||||
from requests.exceptions import ConnectionError
|
||||
|
||||
def do_update():
|
||||
# try:
|
||||
return update.perform_update(endpoint=application.update_url, current_version=application.version, app_name=application.name, update_available_callback=available_update_dialog, progress_callback=progress_callback, update_complete_callback=update_finished)
|
||||
# except:
|
||||
# pass
|
||||
try:
|
||||
return update.perform_update(endpoint=application.update_url, current_version=application.version, app_name=application.name, update_available_callback=available_update_dialog, progress_callback=progress_callback, update_complete_callback=update_finished)
|
||||
except ConnectionError:
|
||||
pass
|
@ -3,6 +3,7 @@ import baseDialog
|
||||
import wx
|
||||
import logging as original_logger
|
||||
import application
|
||||
from multiplatform_widgets import widgets
|
||||
|
||||
class general(wx.Panel, baseDialog.BaseWXDialog):
|
||||
def __init__(self, parent, languages):
|
||||
@ -97,9 +98,51 @@ class other_buffers(wx.Panel):
|
||||
def __init__(self, parent):
|
||||
super(other_buffers, self).__init__(parent)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
#Todo: rewrite UI.
|
||||
self.buffers = widgets.list(self, _(u"Buffer"), _(u"Status"), style=wx.LC_SINGLE_SEL|wx.LC_REPORT)
|
||||
sizer.Add(self.buffers.list, 0, wx.ALL, 5)
|
||||
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
self.up = wx.Button(self, -1, _(u"Move up"))
|
||||
self.down = wx.Button(self, -1, _(u"Move down"))
|
||||
btnSizer.Add(self.up, 0, wx.ALL, 5)
|
||||
btnSizer.Add(self.down, 0, wx.ALL, 5)
|
||||
sizer.Add(btnSizer, 0, wx.ALL, 5)
|
||||
self.SetSizer(sizer)
|
||||
|
||||
def insert_buffers(self, buffers):
|
||||
for i in buffers:
|
||||
if i[1] == True:
|
||||
self.buffers.insert_item(False, *[i[0], _(u"Show")])
|
||||
else:
|
||||
self.buffer.insert_item(False, *[i[0], _(u"Hide")])
|
||||
|
||||
def connect_hook_func(self, func):
|
||||
self.buffers.list.Bind(wx.EVT_CHAR_HOOK, func)
|
||||
|
||||
def move_up(self, *args, **kwargs): pass
|
||||
def move_down(self, *args, **kwargs): pass
|
||||
|
||||
def get_event(self, ev):
|
||||
if ev.GetKeyCode() == wx.WXK_RETURN or ev.GetKeyCode() == wx.WXK_SPACE:
|
||||
return True
|
||||
else:
|
||||
ev.Skip()
|
||||
return False
|
||||
|
||||
def change_selected_item(self):
|
||||
current = self.buffers.get_selected()
|
||||
text = self.buffers.get_text_column(current, 1)
|
||||
if text == _(u"Show"):
|
||||
self.buffers.set_text_column(current, 1, _(u"Hide"))
|
||||
else:
|
||||
self.buffers.set_text_column(current, 1, _(u"Show"))
|
||||
|
||||
def get_list(self):
|
||||
buffers_list = []
|
||||
for i in xrange(0, self.buffers.get_count()):
|
||||
if self.buffers.get_text_column(i, 1) == _(u"Show"):
|
||||
buffers_list.append(self.buffers.get_text_column(i, 0))
|
||||
return buffers_list
|
||||
|
||||
class ignoredClients(wx.Panel):
|
||||
def __init__(self, parent, choices):
|
||||
super(ignoredClients, self).__init__(parent=parent)
|
||||
|
Loading…
Reference in New Issue
Block a user