More windows to auxiliary frame
This commit is contained in:
@@ -1443,81 +1443,3 @@ class PFNotebookPagePreview(wx.Frame):
|
||||
mdc.SetBrush(wx.TRANSPARENT_BRUSH)
|
||||
|
||||
mdc.DrawRectangle(0, 16, rect.width, rect.height - 16)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
# need to set up some paths, since bitmap loader requires config to have things
|
||||
# Should probably change that so that it's not dependant on config
|
||||
import os
|
||||
os.chdir('..')
|
||||
import config
|
||||
config.defPaths(None)
|
||||
|
||||
class Frame(wx.Frame):
|
||||
def __init__(self, title):
|
||||
super().__init__(None, title=title, size=(1000, 500))
|
||||
|
||||
if 'wxMSW' in wx.PlatformInfo:
|
||||
color = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE)
|
||||
self.SetBackgroundColour(color)
|
||||
|
||||
main_sizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
splitter = wx.SplitterWindow(self, style=wx.SP_LIVE_UPDATE)
|
||||
main_sizer.Add(splitter, 1, wx.EXPAND | wx.ALL, 2)
|
||||
|
||||
# Main test notebook
|
||||
self.notebook = ChromeNotebook(splitter)
|
||||
|
||||
# Tests can_add, has dummy tabs
|
||||
notebook2 = ChromeNotebook(splitter, can_add=False)
|
||||
|
||||
self.statusbar = self.CreateStatusBar()
|
||||
|
||||
panel = wx.Panel(self)
|
||||
box = wx.BoxSizer(wx.VERTICAL)
|
||||
|
||||
head = wx.StaticText(panel, -1, "Chome Tabs Test")
|
||||
head.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD))
|
||||
box.Add(head, 0, wx.ALL, 10)
|
||||
|
||||
self.tctrl = wx.TextCtrl(panel, wx.ID_ANY, "Tab Name")
|
||||
|
||||
self.close_check = wx.CheckBox(panel, label="Closable?")
|
||||
self.close_check.SetValue(True)
|
||||
|
||||
self.icon_check = wx.CheckBox(panel, label="Icon?")
|
||||
self.icon_check.SetValue(True)
|
||||
|
||||
button = wx.Button(panel, wx.ID_ANY, "Create")
|
||||
button.Bind(wx.EVT_BUTTON, self.OnCreate)
|
||||
|
||||
box.Add(self.tctrl, 0, wx.ALL, 5)
|
||||
box.Add(self.close_check, 0, wx.ALL, 5)
|
||||
box.Add(self.icon_check, 0, wx.ALL, 5)
|
||||
box.Add(button, 0, wx.ALL, 10)
|
||||
|
||||
self.notebook.AddPage(panel, "Tab1", closeable=False)
|
||||
|
||||
# Add dummy pages
|
||||
notebook2.AddPage()
|
||||
notebook2.AddPage()
|
||||
|
||||
splitter.SplitVertically(self.notebook, notebook2)
|
||||
|
||||
panel.SetSizer(box)
|
||||
panel.Layout()
|
||||
self.SetSizer(main_sizer)
|
||||
|
||||
def OnCreate(self, event):
|
||||
tab_name = self.tctrl.GetValue()
|
||||
tab_icon = BitmapLoader.getImage("ship_small", "gui")
|
||||
self.notebook.AddPage(
|
||||
title=tab_name,
|
||||
image=tab_icon if self.icon_check.GetValue() else None,
|
||||
closeable=self.close_check.GetValue())
|
||||
|
||||
app = wx.App(redirect=False) # Error messages go to popup window
|
||||
top = Frame("Test Chrome Tabs")
|
||||
top.Show()
|
||||
app.MainLoop()
|
||||
|
||||
Reference in New Issue
Block a user