view user info is now posible from the menu bar or control+win+shift+n

This commit is contained in:
2015-03-08 14:18:29 -06:00
parent 007da773c9
commit 2cc865b62c
11 changed files with 185 additions and 87 deletions

View File

@@ -1 +1 @@
import baseDialog, trends, configuration, lists, message, search, show_user, update_profile, urlList, userSelection
import baseDialog, trends, configuration, lists, message, search, show_user, update_profile, urlList, userSelection, utils

View File

@@ -23,3 +23,6 @@ class BaseWXDialog(wx.Dialog):
elif hasattr(control, "ChangeValue"): return getattr(control, "ChangeValue")(text)
else: return -1
else: return 0
def set_title(self, title):
self.SetTitle(title)

View File

@@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
import wx
import baseDialog
class showUserProfile(wx.Dialog):
def __init__(self, screen_name):
super(showUserProfile, self).__init__(self, None, -1)
self.SetTitle(_(u"Information for %s") % (screen_name))
class showUserProfile(baseDialog.BaseWXDialog):
def __init__(self):
super(showUserProfile, self).__init__(parent=None, id=wx.NewId())
panel = wx.Panel(self)
sizer = wx.BoxSizer(wx.VERTICAL)
static = wx.StaticText(panel, -1, _(u"Details"))
sizer.Add(static, 0, wx.ALL, 5)
text = wx.TextCtrl(panel, -1, style=wx.TE_MULTILINE|wx.TE_READONLY)
text.SetFocus()
sizer.Add(text, 0, wx.ALL|wx.EXPAND, 5)
self.text = wx.TextCtrl(panel, -1, style=wx.TE_MULTILINE|wx.TE_READONLY, size=(350, 250))
self.text.SetFocus()
sizer.Add(self.text, 0, wx.ALL|wx.EXPAND, 5)
self.url = wx.Button(panel, -1, _(u"Go to URL"), size=wx.DefaultSize)
self.url.Disable()
close = wx.Button(panel, wx.ID_CANCEL, _(u"Close"))
@@ -19,10 +19,8 @@ class showUserProfile(wx.Dialog):
btnSizer.Add(self.url, 0, wx.ALL, 5)
btnSizer.Add(close, 0, wx.ALL, 5)
sizer.Add(btnSizer, 0, wx.ALL, 5)
text.ChangeValue(self.compose_string())
text.SetSize(text.GetBestSize())
panel.SetSizer(sizer)
self.SetClientSize(sizer.CalcMin())
def get_response(self):
return self.ShowModal()
def enable_url(self, enabled=True):
self.url.Enable(enabled)

46
src/wxUI/dialogs/utils.py Normal file
View File

@@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
############################################################
# Copyright (c) 2013, 2014 Manuel Eduardo Cortéz Vallejo <manuel@manuelcortez.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
############################################################
import wx
import baseDialog
class selectUserDialog(baseDialog.BaseWXDialog):
def __init__(self, title, users):
super(selectUserDialog, self).__init__(parent=None, id=wx.NewId(), title=title)
panel = wx.Panel(self)
userSizer = wx.BoxSizer()
self.cb = wx.ComboBox(panel, -1, choices=users, value=users[0], size=wx.DefaultSize)
self.cb.SetFocus()
userSizer.Add(wx.StaticText(panel, -1, _(u"User")), 0, wx.ALL, 5)
userSizer.Add(self.cb)
sizer = wx.BoxSizer(wx.VERTICAL)
ok = wx.Button(panel, wx.ID_OK, _(u"OK"))
ok.SetDefault()
# ok.Bind(wx.EVT_BUTTON, self.onok)
cancel = wx.Button(panel, wx.ID_CANCEL, _(u"Close"))
btnsizer = wx.BoxSizer()
btnsizer.Add(ok, 0, wx.ALL, 5)
btnsizer.Add(cancel, 0, wx.ALL, 5)
sizer.Add(userSizer, 0, wx.ALL, 5)
sizer.Add(btnsizer, 0, wx.ALL, 5)
panel.SetSizer(sizer)
self.SetClientSize(sizer.CalcMin())
def get_user(self):
return self.cb.GetValue()

View File

@@ -18,7 +18,7 @@ class mainFrame(wx.Frame):
self.menuitem_search = app.Append(wx.NewId(), _(u"&Search"))
self.trends = app.Append(wx.NewId(), _(u"View &trending topics"))
self.lists = app.Append(wx.NewId(), _(u"&Lists manager"))
self.lists.Enable(True)
self.lists.Enable(False)
self.sounds_tutorial = app.Append(wx.NewId(), _(u"Sounds &tutorial"))
self.keystroke_editor = app.Append(wx.NewId(), _(u"&Edit keystrokes"))
self.account_settings = app.Append(wx.NewId(), _(u"Account se&ttings"))
@@ -53,7 +53,6 @@ class mainFrame(wx.Frame):
self.viewLists = user.Append(wx.NewId(), _(u"&View lists"))
self.viewLists.Enable(False)
self.details = user.Append(wx.NewId(), _(u"Show user &profile"))
self.details.Enable(False)
self.timeline = user.Append(wx.NewId(), _(u"&Timeline"))
self.timeline.Enable(False)
self.favs = user.Append(wx.NewId(), _(u"V&iew favourites"))