mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 12:53:12 -06:00
Added GUI for filter creation. #102
This commit is contained in:
parent
636c21df94
commit
54cb099007
7
src/controller/filterController.py
Normal file
7
src/controller/filterController.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from wxUI.dialogs import filterDialogs
|
||||||
|
|
||||||
|
class filter(object):
|
||||||
|
def __init__(self):
|
||||||
|
self.dialog = filterDialogs.filterDialog()
|
||||||
|
self.dialog.get_response()
|
@ -13,6 +13,7 @@ if system == "Windows":
|
|||||||
import trendingTopics
|
import trendingTopics
|
||||||
import user
|
import user
|
||||||
import listsController
|
import listsController
|
||||||
|
import filterController
|
||||||
# from issueReporter import issueReporter
|
# from issueReporter import issueReporter
|
||||||
elif system == "Linux":
|
elif system == "Linux":
|
||||||
from gtkUI import (view, commonMessageDialogs)
|
from gtkUI import (view, commonMessageDialogs)
|
||||||
@ -139,6 +140,7 @@ class Controller(object):
|
|||||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.search, menuitem=self.view.menuitem_search)
|
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.search, menuitem=self.view.menuitem_search)
|
||||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.list_manager, menuitem=self.view.lists)
|
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.list_manager, menuitem=self.view.lists)
|
||||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.get_trending_topics, menuitem=self.view.trends)
|
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.get_trending_topics, menuitem=self.view.trends)
|
||||||
|
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.filter, menuitem=self.view.filter)
|
||||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.find, menuitem=self.view.find)
|
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.find, menuitem=self.view.find)
|
||||||
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)
|
||||||
@ -483,6 +485,13 @@ class Controller(object):
|
|||||||
return output.speak(page.get_message(), True)
|
return output.speak(page.get_message(), True)
|
||||||
output.speak(_(u"{0} not found.").format(string,), True)
|
output.speak(_(u"{0} not found.").format(string,), True)
|
||||||
|
|
||||||
|
def filter(self, *args, **kwargs):
|
||||||
|
page = self.get_current_buffer()
|
||||||
|
if not hasattr(page.buffer, "list"):
|
||||||
|
output.speak(_(u"No session is currently in focus. Focus a session with the next or previous session shortcut."), True)
|
||||||
|
return
|
||||||
|
new_filter = filterController.filter()
|
||||||
|
|
||||||
def seekLeft(self, *args, **kwargs):
|
def seekLeft(self, *args, **kwargs):
|
||||||
try:
|
try:
|
||||||
sound.URLPlayer.seek(-5)
|
sound.URLPlayer.seek(-5)
|
||||||
|
@ -1 +1 @@
|
|||||||
import baseDialog, trends, configuration, lists, message, search, find, show_user, update_profile, urlList, userSelection, utils
|
import baseDialog, trends, configuration, lists, message, search, find, show_user, update_profile, urlList, userSelection, utils, filterDialogs
|
||||||
|
45
src/wxUI/dialogs/filterDialogs.py
Normal file
45
src/wxUI/dialogs/filterDialogs.py
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import baseDialog
|
||||||
|
import wx
|
||||||
|
|
||||||
|
class filterDialog(baseDialog.BaseWXDialog):
|
||||||
|
def __init__(self, value=""):
|
||||||
|
super(filterDialog, self).__init__(None, -1)
|
||||||
|
panel = wx.Panel(self)
|
||||||
|
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||||
|
self.SetTitle(_(u"Create a filter for this buffer"))
|
||||||
|
self.contains = wx.RadioButton(panel, -1, _(u"Contains"), style=wx.RB_GROUP)
|
||||||
|
self.doesnt_contain = wx.RadioButton(panel, -1, _(u"Doesn't contain"))
|
||||||
|
radioSizer1 = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
|
radioSizer1.Add(self.contains, 0, wx.ALL, 5)
|
||||||
|
radioSizer1.Add(self.doesnt_contain, 0, wx.ALL, 5)
|
||||||
|
sizer.Add(radioSizer1, 0, wx.ALL, 5)
|
||||||
|
label = wx.StaticText(panel, -1, _(u"word"))
|
||||||
|
self.term = wx.TextCtrl(panel, -1, value)
|
||||||
|
dc = wx.WindowDC(self.contains)
|
||||||
|
dc.SetFont(self.contains.GetFont())
|
||||||
|
self.contains.SetSize(dc.GetTextExtent("0"*40))
|
||||||
|
bsizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
|
bsizer.Add(label, 0, wx.ALL, 5)
|
||||||
|
bsizer.Add(self.contains, 0, wx.ALL, 5)
|
||||||
|
sizer.Add(bsizer, 0, wx.ALL, 5)
|
||||||
|
self.regexp = wx.CheckBox(panel, wx.NewId(), _(u"Use this term as a regular expression"))
|
||||||
|
sizer.Add(self.regexp, 0, wx.ALL, 5)
|
||||||
|
self.load_language = wx.RadioButton(panel, -1, _(u"Load tweets in the following languages"), style=wx.RB_GROUP)
|
||||||
|
self.ignore_language = wx.RadioButton(panel, -1, _(u"Ignore tweets in the following languages"))
|
||||||
|
self.skip_language_filtering = wx.RadioButton(panel, -1, _(u"Don't filter by language"))
|
||||||
|
self.skip_language_filtering.SetValue(True)
|
||||||
|
radioSizer2 = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
|
radioSizer2.Add(self.load_language, 0, wx.ALL, 5)
|
||||||
|
radioSizer2.Add(self.ignore_language, 0, wx.ALL, 5)
|
||||||
|
radioSizer2.Add(self.skip_language_filtering, 0, wx.ALL, 5)
|
||||||
|
sizer.Add(radioSizer2, 0, wx.ALL, 5)
|
||||||
|
ok = wx.Button(panel, wx.ID_OK, _(u"OK"))
|
||||||
|
ok.SetDefault()
|
||||||
|
cancel = wx.Button(panel, wx.ID_CANCEL, _(u"Cancel"))
|
||||||
|
btnsizer = wx.BoxSizer()
|
||||||
|
btnsizer.Add(ok, 0, wx.ALL, 5)
|
||||||
|
btnsizer.Add(cancel, 0, wx.ALL, 5)
|
||||||
|
sizer.Add(btnsizer, 0, wx.ALL, 5)
|
||||||
|
panel.SetSizer(sizer)
|
||||||
|
self.SetClientSize(sizer.CalcMin())
|
@ -50,6 +50,7 @@ class mainFrame(wx.Frame):
|
|||||||
buffer = wx.Menu()
|
buffer = wx.Menu()
|
||||||
self.update_buffer = buffer.Append(wx.NewId(), _(u"&Update buffer"))
|
self.update_buffer = buffer.Append(wx.NewId(), _(u"&Update buffer"))
|
||||||
self.trends = buffer.Append(wx.NewId(), _(u"New &trending topics buffer..."))
|
self.trends = buffer.Append(wx.NewId(), _(u"New &trending topics buffer..."))
|
||||||
|
self.filter = buffer.Append(wx.NewId(), _(u"Create a filter"))
|
||||||
self.find = buffer.Append(wx.NewId(), _(u"Find a string in the currently focused buffer..."))
|
self.find = buffer.Append(wx.NewId(), _(u"Find a string in the currently focused buffer..."))
|
||||||
self.load_previous_items = buffer.Append(wx.NewId(), _(u"&Load previous items"))
|
self.load_previous_items = buffer.Append(wx.NewId(), _(u"&Load previous items"))
|
||||||
buffer.AppendSeparator()
|
buffer.AppendSeparator()
|
||||||
|
Loading…
Reference in New Issue
Block a user