created basic update profile with support for name and bio

This commit is contained in:
Abdulqadir Ahmad
2023-06-08 00:40:38 +01:00
parent 61525023ce
commit 453630e655
4 changed files with 88 additions and 3 deletions

View File

@@ -0,0 +1,57 @@
import wx
class UpdateProfileDialog(wx.Dialog):
"""
A dialog for user to update his / her profile details.
layout is:
```
header
avatar
name
bio
meta data
```
"""
def __init__(self, display_name: str="", note: str=""):
"""Initialize update profile dialog
Parameters:
- display_name: The user's display name to show in the display name field
- note: The users bio to show in the bio field
"""
super().__init__(parent=None)
self.SetTitle(_("Update Profile"))
panel = wx.Panel(self)
sizer = wx.BoxSizer(wx.VERTICAL)
# create widgets
display_name_label = wx.StaticText(panel, label=_("Display Name"))
self.display_name = wx.TextCtrl(panel, value=display_name, style=
wx.TE_PROCESS_ENTER)
bio_label = wx.StaticText(panel, label=_("Bio"))
self.bio = wx.TextCtrl(panel, value=note, style=wx.TE_PROCESS_ENTER)
ok = wx.Button(panel, wx.ID_OK, _(u"&OK"))
ok.SetDefault()
cancel = wx.Button(panel, wx.ID_CANCEL, _("&Close"))
self.SetEscapeId(cancel.GetId())
# manage sizers
sizer.Add(display_name_label, wx.SizerFlags().Center())
sizer.Add(self.display_name, wx.SizerFlags().Center())
sizer.Add(cancel, wx.SizerFlags().Center())
sizer.Add(ok, wx.SizerFlags().Center())
sizer.Add(self.bio, wx.SizerFlags().Center())
panel.SetSizer(sizer)
panel.Fit()
# manage events
ok.Bind(wx.EVT_BUTTON, self.on_ok)
def on_ok(self, *args):
"""Method called when user clicks ok in dialog"""
self.data = {
'display_name': self.display_name.GetValue(),
'note': self.bio.GetValue()
}
self.EndModal(wx.ID_OK)

View File

@@ -15,7 +15,6 @@ class mainFrame(wx.Frame):
self.menubar_application = wx.Menu()
self.manage_accounts = self.menubar_application.Append(wx.ID_ANY, _(u"&Manage accounts"))
self.updateProfile = self.menubar_application.Append(wx.ID_ANY, _("&Update profile"))
self.updateProfile.Enable(False)
self.show_hide = self.menubar_application.Append(wx.ID_ANY, _(u"&Hide window"))
self.menuitem_search = self.menubar_application.Append(wx.ID_ANY, _(u"&Search"))
self.lists = self.menubar_application.Append(wx.ID_ANY, _(u"&Lists manager"))