Skip to content

Commit

Permalink
work on Ribbon
Browse files Browse the repository at this point in the history
  • Loading branch information
danheeks committed Jun 15, 2020
1 parent 7825c9d commit c7454e1
Show file tree
Hide file tree
Showing 6 changed files with 247 additions and 18 deletions.
3 changes: 3 additions & 0 deletions App.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ def LoadConfig(self):
cad.SetRotateUpright(config.ReadBool("RotateUpright", False))
cad.SetGraphicsTextMode(cad.GraphicsTextMode(config.ReadInt("TextMode", int(cad.GraphicsTextMode.FullHelp))))

cad.SetBackgroundColor(0, cad.Color(config.ReadInt("BackgroundColor0", cad.Color(230, 255, 255).ref())))
cad.SetBackgroundColor(1, cad.Color(config.ReadInt("BackgroundColor1", cad.Color(255, 255, 255).ref())))


def GetDefaultDir(self):
default_directory = os.getcwd()
Expand Down
27 changes: 12 additions & 15 deletions Ribbon.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def SelectNewColour(self, index):
if dlg.ShowModal() == wx.ID_OK:
# Colour did change.
self.SetBackgroundColor(index, dlg.GetColourData().GetColour())
HeeksConfig().WriteInt("BackgroundColor" + str(index), cad.GetBackgroundColor(index).ref())
self.ribbon.GetParent().graphics_canvas.Refresh()


Expand All @@ -97,7 +98,7 @@ def __init__(self, parent):
Ribbon.next_id = parent.ID_NEXT_ID
self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)

main_page = RB.RibbonPage(self, wx.ID_ANY, 'File', self.Image('new'))
main_page = RB.RibbonPage(self, wx.ID_ANY, 'File', self.Image('file'))
main_page.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)

panel = RB.RibbonPanel(main_page, wx.ID_ANY, 'File', self.Image('new'))
Expand Down Expand Up @@ -130,7 +131,7 @@ def __init__(self, parent):
main_page.Realize()


geom_page = RB.RibbonPage(self, wx.ID_ANY, 'Geom', self.Image('lines'))
geom_page = RB.RibbonPage(self, wx.ID_ANY, 'Geom', self.Image('geom'))
geom_page.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)

panel = RB.RibbonPanel(geom_page, wx.ID_ANY, 'Sketches', self.Image('lines'))
Expand Down Expand Up @@ -179,7 +180,7 @@ def __init__(self, parent):
geom_page.Realize()


view_page = RB.RibbonPage(self, wx.ID_ANY, 'View', self.Image('mag'))
view_page = RB.RibbonPage(self, wx.ID_ANY, 'View', self.Image('view'))
view_page.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)

panel = RB.RibbonPanel(view_page, wx.ID_ANY, 'Magnify', self.Image('mag'))
Expand Down Expand Up @@ -232,25 +233,21 @@ def __init__(self, parent):
combo = wx.ComboBox(panel, choices = ["None", "Input Mode Title", "Full Help"], style = wx.CB_READONLY )
combo.Select(cad.GetGraphicsTextMode())
self.Bind(wx.EVT_COMBOBOX, self.OnScreenText, combo)
sizer_panelsizer = wx.BoxSizer(wx.VERTICAL)
sizer_panelsizer.AddStretchSpacer(1)
sizer_panelsizer.Add(check, 0, wx.ALL|wx.EXPAND, 2)
self.AddLabelAndControl(panel, sizer_panelsizer, 'Screen Text', combo)
sizer_panelsizer.AddStretchSpacer(1)
panel.SetSizer(sizer_panelsizer)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.AddStretchSpacer(1)
sizer.Add(check, 0, wx.ALL|wx.EXPAND, 2)
self.AddLabelAndControl(panel, sizer, 'Screen Text', combo)
sizer.AddStretchSpacer(1)
panel.SetSizer(sizer)

panel = RB.RibbonPanel(options_page, wx.ID_ANY, 'View Colors', self.Image('mag'))
toolbar = RB.RibbonButtonBar(panel)
Ribbon.AddBackgroundColorButton(toolbar, 'Background Color Top', 'Edit top background color')
Ribbon.AddBackgroundColorButton(toolbar, 'Background Color Bottom', 'Edit bottom background color')

options_page.Realize()









self.Realize()

Expand Down
235 changes: 232 additions & 3 deletions bitmaps/bitmaps.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bitmaps/file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bitmaps/geom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bitmaps/view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c7454e1

Please sign in to comment.