Skip to content

Commit

Permalink
text, icon and button aligned horizontally
Browse files Browse the repository at this point in the history
  • Loading branch information
lindakladivova committed May 10, 2024
1 parent 8f8dcd1 commit 2f6e1b5
Showing 1 changed file with 10 additions and 27 deletions.
37 changes: 10 additions & 27 deletions gui/wxpython/history/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ def _layout(self):
def _initImages(self):
bmpsize = (16, 16)
self.icons = {
"check": MetaIcon(img="grassdb").GetBitmap(bmpsize),
"cross": MetaIcon(img="location").GetBitmap(bmpsize),
"check": MetaIcon(img="check").GetBitmap(bmpsize),
"cross": MetaIcon(img="check").GetBitmap(bmpsize),
}

def _createGeneralInfoBox(self):
Expand Down Expand Up @@ -145,7 +145,7 @@ def _createRegionSettingsBox(self):
self.sizer_region_settings_grid.SetCols(2)
self.sizer_region_settings_grid.SetRows(9)

self.sizer_region_settings_match = wx.BoxSizer(wx.VERTICAL)
self.sizer_region_settings_match = wx.BoxSizer(wx.HORIZONTAL)
self.region_settings_box_sizer.Add(
self.sizer_region_settings_match, proportion=0, flag=wx.EXPAND, border=5
)
Expand Down Expand Up @@ -237,60 +237,43 @@ def _updateRegionSettingsBox(self, command_info):

self.sizer_region_settings_match.Clear(True)

status_text = _("Region match")

if self.region_settings != self._get_current_region():
status_text = _("Region does not match current region")
icon = self.icons["cross"]
button_label = _("Update current region")
else:
status_text = _("Region match current region")
icon = self.icons["check"]
button_label = None

# Sizer for text and icon
text_icon_sizer = wx.BoxSizer(wx.HORIZONTAL)
self.sizer_region_settings_match.Add(
text_icon_sizer,
proportion=0,
flag=wx.ALL | wx.EXPAND,
border=5,
)

# Static text
textRegionMatch = StaticText(
parent=self.region_settings_box,
id=wx.ID_ANY,
label=status_text,
)
text_icon_sizer.Add(
self.sizer_region_settings_match.Add(
textRegionMatch,
proportion=0,
flag=wx.ALL | wx.EXPAND,
border=5,
border=15,
)

# Static bitmap for icon
iconRegionMatch = wx.StaticBitmap(self.region_settings_box, bitmap=icon)
text_icon_sizer.Add(
self.sizer_region_settings_match.Add(
iconRegionMatch,
proportion=0,
flag=wx.ALL | wx.EXPAND,
border=5,
)

if button_label:
button_sizer = wx.BoxSizer(wx.HORIZONTAL)
self.sizer_region_settings_match.Add(
button_sizer,
proportion=0,
flag=wx.ALL | wx.EXPAND,
border=5,
)

buttonUpdateRegion = wx.Button(self.region_settings_box, label=button_label)
buttonUpdateRegion.Bind(wx.EVT_BUTTON, self.OnUpdateRegion)
button_sizer.Add(
self.sizer_region_settings_match.Add(
buttonUpdateRegion,
proportion=0,
proportion=1,
flag=wx.ALL | wx.EXPAND,
border=5,
)
Expand Down

0 comments on commit 2f6e1b5

Please sign in to comment.