mirror of
				https://github.com/MCV-Software/TWBlue.git
				synced 2025-10-31 12:12:01 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			42 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| # -*- coding: utf-8 -*-
 | ||
| import wx
 | ||
| from multiplatform_widgets import widgets
 | ||
| 
 | ||
| class autocompletionManageDialog(wx.Dialog):
 | ||
|  def __init__(self):
 | ||
|   super(autocompletionManageDialog, self).__init__(parent=None, id=-1, title=_(u"Manage Autocomplete users’ database"))
 | ||
|   panel = wx.Panel(self)
 | ||
|   sizer = wx.BoxSizer(wx.VERTICAL)
 | ||
|   label = wx.StaticText(panel, -1, _(u"Users in your database"))
 | ||
|   self.users = widgets.list(panel, _(u"Username"), _(u"Name"), style=wx.LC_REPORT)
 | ||
|   sizer.Add(label, 0, wx.ALL, 5)
 | ||
|   sizer.Add(self.users.list, 0, wx.ALL, 5)
 | ||
|   self.add = wx.Button(panel, -1, _(u"Add new user"))
 | ||
|   self.remove = wx.Button(panel, -1, _(u"Remove user"))
 | ||
|   optionsBox = wx.BoxSizer(wx.HORIZONTAL)
 | ||
|   optionsBox.Add(self.add, 0, wx.ALL, 5)
 | ||
|   optionsBox.Add(self.remove, 0, wx.ALL, 5)
 | ||
|   sizer.Add(optionsBox, 0, wx.ALL, 5)
 | ||
|   ok = wx.Button(panel, wx.ID_OK)
 | ||
|   cancel = wx.Button(panel, wx.ID_CANCEL)
 | ||
|   sizerBtn = wx.BoxSizer(wx.HORIZONTAL)
 | ||
|   sizerBtn.Add(ok, 0, wx.ALL, 5)
 | ||
|   sizer.Add(cancel, 0, wx.ALL, 5)
 | ||
|   sizer.Add(sizerBtn, 0, wx.ALL, 5)
 | ||
|   panel.SetSizer(sizer)
 | ||
|   self.SetClientSize(sizer.CalcMin())
 | ||
| 
 | ||
|  def put_users(self, users):
 | ||
|   for i in users:
 | ||
|    j = [i[0], i[1]]
 | ||
|    self.users.insert_item(False, *j)
 | ||
| 
 | ||
|  def get_user(self):
 | ||
|   usr = False
 | ||
|   userDlg = wx.TextEntryDialog(None, _(u"Twitter username"), _(u"Add user to database"))
 | ||
|   if userDlg.ShowModal() == wx.ID_OK:
 | ||
|    usr = userDlg.GetValue()
 | ||
|   return usr
 | ||
| 
 | ||
|  def show_invalid_user_error(self):
 | ||
|   wx.MessageDialog(None, _(u"The user does not exist"), _(u"Error!"), wx.ICON_ERROR).ShowModal() |