mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 12:53:12 -06:00
Added title for filters #102
This commit is contained in:
parent
2d9124c336
commit
8836cb2bda
@ -10,6 +10,7 @@ class filter(object):
|
||||
self.buffer = buffer
|
||||
self.dialog = filterDialogs.filterDialog(languages=[i["name"] for i in application.supported_languages])
|
||||
if self.dialog.get_response() == widgetUtils.OK:
|
||||
title = self.dialog.get("title")
|
||||
contains = self.dialog.get("contains")
|
||||
term = self.dialog.get("term")
|
||||
regexp = self.dialog.get("regexp")
|
||||
@ -26,8 +27,9 @@ class filter(object):
|
||||
if i["name"] in langs:
|
||||
langcodes.append(i["code"])
|
||||
d = dict(in_buffer=self.buffer.name, word=term, regexp=regexp, in_lang=lang_option, languages=langcodes, if_word_exists=contains)
|
||||
filter_title = "filter_{0}".format(str(time.time()))
|
||||
self.buffer.session.settings["filters"][filter_title] = d
|
||||
if self.buffer.session.settings["filters"].has_key(title):
|
||||
return commonMessageDialogs.existing_filter()
|
||||
self.buffer.session.settings["filters"][title] = d
|
||||
self.buffer.session.settings.write()
|
||||
|
||||
class filterManager(object):
|
||||
|
@ -83,3 +83,6 @@ def suspended_user():
|
||||
|
||||
def delete_filter():
|
||||
return wx.MessageDialog(None, _(u"Do you really want to delete this filter?"), _(u"Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal()
|
||||
|
||||
def existing_filter():
|
||||
return wx.MessageDialog(None, _(u"This filter already exists. Please use a different title"), _(u"Error"), wx.OK).ShowModal()
|
||||
|
@ -11,6 +11,15 @@ class filterDialog(baseDialog.BaseWXDialog):
|
||||
panel = wx.Panel(self)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
self.SetTitle(_(u"Create a filter for this buffer"))
|
||||
label = wx.StaticText(panel, wx.NewId(), _(u"Filter title"))
|
||||
self.title = wx.TextCtrl(panel, -1, value)
|
||||
dc = wx.WindowDC(self.title)
|
||||
dc.SetFont(self.title.GetFont())
|
||||
self.title.SetSize(dc.GetTextExtent("0"*40))
|
||||
tsizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
tsizer.Add(label, 0, wx.ALL, 5)
|
||||
tsizer.Add(self.title, 0, wx.ALL, 5)
|
||||
sizer.Add(tsizer, 0, wx.ALL, 5)
|
||||
staticbox = wx.StaticBox(panel, label=_(u"Filter by word"))
|
||||
self.contains = wx.RadioButton(panel, -1, _(u"Ignore tweets wich contain the following word"), style=wx.RB_GROUP)
|
||||
self.doesnt_contain = wx.RadioButton(panel, -1, _(u"Ignore tweets without the following word"))
|
||||
|
Loading…
Reference in New Issue
Block a user