mirror of
				https://github.com/MCV-Software/TWBlue.git
				synced 2025-11-04 13:57:05 +00:00 
			
		
		
		
	Basic tt support, fixed some English mistakes reported by @sukiletxe
This commit is contained in:
		@@ -1 +1 @@
 | 
			
		||||
import message, urlList, follow, utils, show_user, update_profile, configuration, lists, search
 | 
			
		||||
import message, urlList, follow, utils, show_user, update_profile, configuration, lists, search, trending
 | 
			
		||||
@@ -19,24 +19,34 @@
 | 
			
		||||
import wx
 | 
			
		||||
 | 
			
		||||
class trendingTopicsDialog(wx.Dialog):
 | 
			
		||||
 def __init__(self):
 | 
			
		||||
  super(searchDialog, self).__init__(None, -1)
 | 
			
		||||
 def __init__(self, information):
 | 
			
		||||
  super(trendingTopicsDialog, self).__init__(None, -1)
 | 
			
		||||
  self.countries = {}
 | 
			
		||||
  self.cities = {}
 | 
			
		||||
  self.information = information
 | 
			
		||||
  self.split_information()
 | 
			
		||||
  panel = wx.Panel(self)
 | 
			
		||||
  sizer = wx.BoxSizer(wx.VERTICAL)
 | 
			
		||||
  self.SetTitle(_(u"Search on Twitter"))
 | 
			
		||||
  label = wx.StaticText(panel, -1, _(u"Search"))
 | 
			
		||||
  self.term = wx.TextCtrl(panel, -1,)
 | 
			
		||||
  dc = wx.WindowDC(self.term)
 | 
			
		||||
  dc.SetFont(self.term.GetFont())
 | 
			
		||||
  self.term.SetSize(dc.GetTextExtent("0"*40))
 | 
			
		||||
  self.SetTitle(_(u"View trending topics"))
 | 
			
		||||
  label = wx.StaticText(panel, -1, _(u"Trending topics by"))
 | 
			
		||||
  sizer.Add(label, 0, wx.ALL, 5)
 | 
			
		||||
  sizer.Add(self.term, 0, wx.ALL, 5)
 | 
			
		||||
  self.tweets = wx.RadioButton(panel, -1, _(u"Tweets"), style=wx.RB_GROUP)
 | 
			
		||||
  self.users = wx.RadioButton(panel, -1, _(u"Users"))
 | 
			
		||||
  self.country = wx.RadioButton(panel, -1, _(u"Country"), style=wx.RB_GROUP)
 | 
			
		||||
  self.city = wx.RadioButton(panel, -1, _(u"City"))
 | 
			
		||||
  self.Bind(wx.EVT_RADIOBUTTON, self.get_places, self.country)
 | 
			
		||||
  self.Bind(wx.EVT_RADIOBUTTON, self.get_places, self.city)
 | 
			
		||||
 | 
			
		||||
  radioSizer = wx.BoxSizer(wx.HORIZONTAL)
 | 
			
		||||
  radioSizer.Add(self.tweets, 0, wx.ALL, 5)
 | 
			
		||||
  radioSizer.Add(self.users, 0, wx.ALL, 5)
 | 
			
		||||
  radioSizer.Add(label, 0, wx.ALL, 5)
 | 
			
		||||
  radioSizer.Add(self.country, 0, wx.ALL, 5)
 | 
			
		||||
  radioSizer.Add(self.city, 0, wx.ALL, 5)
 | 
			
		||||
  sizer.Add(radioSizer, 0, wx.ALL, 5)
 | 
			
		||||
  label = wx.StaticText(panel, -1, _(u"Location"))
 | 
			
		||||
  self.location = wx.ListBox(panel, -1, choices=[], style=wx.CB_READONLY)
 | 
			
		||||
  self.get_places()
 | 
			
		||||
  locationBox = wx.BoxSizer(wx.HORIZONTAL)
 | 
			
		||||
  locationBox.Add(label, 0, wx.ALL, 5)
 | 
			
		||||
  locationBox.Add(self.location, 0, wx.ALL, 5)
 | 
			
		||||
  sizer.Add(locationBox, 0, wx.ALL, 5)
 | 
			
		||||
  ok = wx.Button(panel, wx.ID_OK, _(u"OK"))
 | 
			
		||||
  ok.SetDefault()
 | 
			
		||||
  cancel = wx.Button(panel, wx.ID_CANCEL, _(u"Close"))
 | 
			
		||||
@@ -46,3 +56,23 @@ class trendingTopicsDialog(wx.Dialog):
 | 
			
		||||
  sizer.Add(btnsizer, 0, wx.ALL, 5)
 | 
			
		||||
  panel.SetSizer(sizer)
 | 
			
		||||
  self.SetClientSize(sizer.CalcMin())
 | 
			
		||||
 | 
			
		||||
 def split_information(self):
 | 
			
		||||
  for i in self.information:
 | 
			
		||||
   if i["placeType"]["name"] == "Country":
 | 
			
		||||
    self.countries[i["name"]] = i["woeid"]
 | 
			
		||||
   else:
 | 
			
		||||
    self.cities[i["name"]] = i["woeid"]
 | 
			
		||||
 | 
			
		||||
 def get_places(self, event=None):
 | 
			
		||||
  values = []
 | 
			
		||||
  if self.country.GetValue() == True:
 | 
			
		||||
   for i in self.information:
 | 
			
		||||
    if i["placeType"]["name"] == "Country":
 | 
			
		||||
     values.append(i["name"])
 | 
			
		||||
  elif self.city.GetValue() == True:
 | 
			
		||||
   for i in self.information:
 | 
			
		||||
    if i["placeType"]["name"] != "Country":
 | 
			
		||||
     values.append(i["name"])
 | 
			
		||||
  self.location.Set(values)
 | 
			
		||||
   
 | 
			
		||||
		Reference in New Issue
	
	Block a user