mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 12:53:12 -06:00
A bug exiting TWBlue on GUI mode
This commit is contained in:
parent
2dd0cc8fbb
commit
42aea45a41
@ -414,7 +414,6 @@ class peopleBufferController(baseBufferController):
|
|||||||
def onFocus(self, ev):
|
def onFocus(self, ev):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@_tweets_exist
|
|
||||||
def get_message(self):
|
def get_message(self):
|
||||||
return " ".join(self.compose_function(self.get_tweet(), self.session.db, self.session.settings["general"]["relative_times"]))
|
return " ".join(self.compose_function(self.get_tweet(), self.session.db, self.session.settings["general"]["relative_times"]))
|
||||||
|
|
||||||
@ -490,7 +489,10 @@ class searchBufferController(baseBufferController):
|
|||||||
log.debug("Starting stream for %s buffer, %s account and %s type" % (self.name, self.account, self.type))
|
log.debug("Starting stream for %s buffer, %s account and %s type" % (self.name, self.account, self.type))
|
||||||
log.debug("args: %s, kwargs: %s" % (self.args, self.kwargs))
|
log.debug("args: %s, kwargs: %s" % (self.args, self.kwargs))
|
||||||
log.debug("Function: %s" % (self.function,))
|
log.debug("Function: %s" % (self.function,))
|
||||||
val = getattr(self.session.twitter.twitter, self.function)(*self.args, **self.kwargs)
|
try:
|
||||||
|
val = getattr(self.session.twitter.twitter, self.function)(*self.args, **self.kwargs)
|
||||||
|
except:
|
||||||
|
return None
|
||||||
number_of_items = self.session.order_buffer(self.name, val["statuses"])
|
number_of_items = self.session.order_buffer(self.name, val["statuses"])
|
||||||
log.debug("Number of items retrieved: %d" % (number_of_items,))
|
log.debug("Number of items retrieved: %d" % (number_of_items,))
|
||||||
self.put_items_on_list(number_of_items)
|
self.put_items_on_list(number_of_items)
|
||||||
@ -509,7 +511,10 @@ class searchPeopleBufferController(searchBufferController):
|
|||||||
log.debug("starting stream for %s buffer, %s account and %s type" % (self.name, self.account, self.type))
|
log.debug("starting stream for %s buffer, %s account and %s type" % (self.name, self.account, self.type))
|
||||||
log.debug("args: %s, kwargs: %s" % (self.args, self.kwargs))
|
log.debug("args: %s, kwargs: %s" % (self.args, self.kwargs))
|
||||||
log.debug("Function: %s" % (self.function,))
|
log.debug("Function: %s" % (self.function,))
|
||||||
val = getattr(self.session.twitter.twitter, self.function)(*self.args, **self.kwargs)
|
try:
|
||||||
|
val = getattr(self.session.twitter.twitter, self.function)(*self.args, **self.kwargs)
|
||||||
|
except:
|
||||||
|
return
|
||||||
number_of_items = self.session.order_buffer(self.name, val)
|
number_of_items = self.session.order_buffer(self.name, val)
|
||||||
log.debug("Number of items retrieved: %d" % (number_of_items,))
|
log.debug("Number of items retrieved: %d" % (number_of_items,))
|
||||||
self.put_items_on_list(number_of_items)
|
self.put_items_on_list(number_of_items)
|
||||||
@ -535,7 +540,10 @@ class trendsBufferController(bufferController):
|
|||||||
self.get_formatted_message = self.get_message
|
self.get_formatted_message = self.get_message
|
||||||
|
|
||||||
def start_stream(self):
|
def start_stream(self):
|
||||||
data = self.session.twitter.twitter.get_place_trends(id=self.trendsFor)
|
try:
|
||||||
|
data = self.session.twitter.twitter.get_place_trends(id=self.trendsFor)
|
||||||
|
except:
|
||||||
|
return
|
||||||
if not hasattr(self, "name_"):
|
if not hasattr(self, "name_"):
|
||||||
self.name_ = data[0]["locations"][0]["name"]
|
self.name_ = data[0]["locations"][0]["name"]
|
||||||
self.trends = data[0]["trends"]
|
self.trends = data[0]["trends"]
|
||||||
@ -561,7 +569,6 @@ class trendsBufferController(bufferController):
|
|||||||
# widgetUtils.connect_event(self.buffer, widgetUtils.BUTTON_PRESSED, self.direct_message, self.buffer.dm)
|
# widgetUtils.connect_event(self.buffer, widgetUtils.BUTTON_PRESSED, self.direct_message, self.buffer.dm)
|
||||||
# widgetUtils.connect_event(self.buffer, widgetUtils.BUTTON_PRESSED, self.reply, self.buffer.reply)
|
# widgetUtils.connect_event(self.buffer, widgetUtils.BUTTON_PRESSED, self.reply, self.buffer.reply)
|
||||||
|
|
||||||
@_tweets_exist
|
|
||||||
def get_message(self):
|
def get_message(self):
|
||||||
return self.compose_function(self.trends[self.buffer.list.get_selected()])[0]
|
return self.compose_function(self.trends[self.buffer.list.get_selected()])[0]
|
||||||
|
|
||||||
|
@ -102,6 +102,7 @@ class Controller(object):
|
|||||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.accountConfiguration, menuitem=self.view.account_settings)
|
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.accountConfiguration, menuitem=self.view.account_settings)
|
||||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.configuration, menuitem=self.view.prefs)
|
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.exit, menuitem=self.view.close)
|
||||||
|
widgetUtils.connect_event(self.view, widgetUtils.CLOSE_EVENT, self.exit)
|
||||||
if widgetUtils.toolkit == "wx":
|
if widgetUtils.toolkit == "wx":
|
||||||
log.debug("Binding the exit function...")
|
log.debug("Binding the exit function...")
|
||||||
widgetUtils.connectExitFunction(self.exit_)
|
widgetUtils.connectExitFunction(self.exit_)
|
||||||
|
@ -7,9 +7,11 @@ class UserActionsDialog(wx.Dialog):
|
|||||||
panel = wx.Panel(self)
|
panel = wx.Panel(self)
|
||||||
userSizer = wx.BoxSizer()
|
userSizer = wx.BoxSizer()
|
||||||
self.SetTitle(_(u"Action"))
|
self.SetTitle(_(u"Action"))
|
||||||
|
userLabel = wx.StaticText(panel, -1, _(u"User"))
|
||||||
self.cb = wx.ComboBox(panel, -1, choices=users, value=users[0])
|
self.cb = wx.ComboBox(panel, -1, choices=users, value=users[0])
|
||||||
self.cb.SetFocus()
|
self.cb.SetFocus()
|
||||||
userSizer.Add(self.cb)
|
userSizer.Add(userLabel, 0, wx.ALL, 5)
|
||||||
|
userSizer.Add(self.cb, 0, wx.ALL, 5)
|
||||||
actionSizer = wx.BoxSizer(wx.VERTICAL)
|
actionSizer = wx.BoxSizer(wx.VERTICAL)
|
||||||
label2 = wx.StaticText(panel, -1, _(u"Action"))
|
label2 = wx.StaticText(panel, -1, _(u"Action"))
|
||||||
self.follow = wx.RadioButton(panel, -1, _(u"Follow"), style=wx.RB_GROUP)
|
self.follow = wx.RadioButton(panel, -1, _(u"Follow"), style=wx.RB_GROUP)
|
||||||
@ -21,15 +23,17 @@ class UserActionsDialog(wx.Dialog):
|
|||||||
self.reportSpam = wx.RadioButton(panel, -1, _(u"Report as spam"))
|
self.reportSpam = wx.RadioButton(panel, -1, _(u"Report as spam"))
|
||||||
self.ignore_client = wx.RadioButton(panel, -1, _(u"Ignore tweets from this client"))
|
self.ignore_client = wx.RadioButton(panel, -1, _(u"Ignore tweets from this client"))
|
||||||
self.setup_default(default)
|
self.setup_default(default)
|
||||||
actionSizer.Add(label2)
|
hSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
actionSizer.Add(self.follow)
|
hSizer.Add(label2, 0, wx.ALL, 5)
|
||||||
actionSizer.Add(self.unfollow)
|
actionSizer.Add(self.follow, 0, wx.ALL, 5)
|
||||||
actionSizer.Add(self.mute)
|
actionSizer.Add(self.unfollow, 0, wx.ALL, 5)
|
||||||
actionSizer.Add(self.unmute)
|
actionSizer.Add(self.mute, 0, wx.ALL, 5)
|
||||||
actionSizer.Add(self.block)
|
actionSizer.Add(self.unmute, 0, wx.ALL, 5)
|
||||||
actionSizer.Add(self.unblock)
|
actionSizer.Add(self.block, 0, wx.ALL, 5)
|
||||||
actionSizer.Add(self.reportSpam)
|
actionSizer.Add(self.unblock, 0, wx.ALL, 5)
|
||||||
actionSizer.Add(self.ignore_client)
|
actionSizer.Add(self.reportSpam, 0, wx.ALL, 5)
|
||||||
|
actionSizer.Add(self.ignore_client, 0, wx.ALL, 5)
|
||||||
|
hSizer.Add(actionSizer, 0, wx.ALL, 5)
|
||||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||||
ok = wx.Button(panel, wx.ID_OK, _(u"OK"))
|
ok = wx.Button(panel, wx.ID_OK, _(u"OK"))
|
||||||
ok.SetDefault()
|
ok.SetDefault()
|
||||||
@ -38,7 +42,7 @@ class UserActionsDialog(wx.Dialog):
|
|||||||
btnsizer.Add(ok)
|
btnsizer.Add(ok)
|
||||||
btnsizer.Add(cancel)
|
btnsizer.Add(cancel)
|
||||||
sizer.Add(userSizer)
|
sizer.Add(userSizer)
|
||||||
sizer.Add(actionSizer)
|
sizer.Add(hSizer, 0, wx.ALL, 5)
|
||||||
sizer.Add(btnsizer)
|
sizer.Add(btnsizer)
|
||||||
panel.SetSizer(sizer)
|
panel.SetSizer(sizer)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user