コード例 #1
0
ファイル: Parameters.py プロジェクト: slee1009/MIST
    def __init__(self,
                 mode=None,
                 data=None,
                 type=None,
                 id_prj=0,
                 *args,
                 **kwds):
        """ Constructor of the MainFrame class """
        self.idPrj = id_prj

        cdml.CDMFrame.__init__(self, mode, data, type, *args, **kwds)

        # Define Popup menu items
        # Format : tuple of list --> ([Label, Event handler, Id] , [], [], ... )
        #           Label : label of an item
        #           Event handler : name of event handler
        #           Id : Id of current menu item
        # Special label : '-'--> separator, '+' --> submenu items
        #           First item after last '+' marked items is the title of the submenu
        # If an item doesn't have event handler, the second parameter should be 'None'
        # If an item doesn't have Id, the third item should be -1
        # In Project form dedicated event handler in that class (ex. see Project or PopulationData form)
        self.pup_menus = (["Undo", self.FrameEventHandler, wx.ID_UNDO], [
            "-", None, -1
        ], ["Add", self.FrameEventHandler, wx.ID_ADD], [
            "Copy Record", self.FrameEventHandler, cdml.ID_MENU_COPY_RECORD
        ], ["Delete", self.FrameEventHandler, wx.ID_DELETE], ["-", None, -1], [
            "Find", self.FrameEventHandler, wx.ID_FIND
        ], ["-", None,
            -1], ["+Param", self.FrameEventHandler, cdml.IDF_BUTTON1], [
                "+Formula", self.FrameEventHandler, cdml.IDF_BUTTON2
            ], ["+Parameter Type", self.FrameEventHandler, cdml.IDF_BUTTON3], [
                "+Validation Rule Params", self.FrameEventHandler,
                cdml.IDF_BUTTON5
            ], ["+Notes", self.FrameEventHandler,
                cdml.IDF_BUTTON6], ["Sort By", None, -1])

        # Define the window menus
        cdml.GenerateStandardMenu(self)

        # create panel for field titles
        # IMPORTANT NOTE:
        #   In current version, name of a panel for the title section should be "pn_title"
        #   And should be an instance of CDMPanel class with False as a first argument
        self.pn_title = cdml.CDMPanel(False, self, -1)
        self.st_title = wx.StaticText(self.pn_title, -1, "Define Parameters")

        # Create bitmap buttons to display title of each field
        # Syntax : cdml.BitmapButton( parent, id, bitmap, label )
        # Don't need to set bitmap here. It will be assigned in the event handler when pressed
        # For the sort function, the labels need to be same with the variable name in database object
        self.button_1 = cdml.BitmapButton(self.pn_title, cdml.IDF_BUTTON1,
                                          None, "Param")
        self.button_2 = cdml.BitmapButton(self.pn_title, cdml.IDF_BUTTON2,
                                          None, "Formula")
        self.button_3 = cdml.BitmapButton(self.pn_title, cdml.IDF_BUTTON3,
                                          None, "Parameter Type")
        self.button_4 = cdml.BitmapButton(self.pn_title, cdml.IDF_BUTTON5,
                                          None, "Validation Rule Params")
        self.button_5 = cdml.BitmapButton(self.pn_title, cdml.IDF_BUTTON6,
                                          None, "Notes")

        # Create Add/Find buttons
        # Syntax : cdml.Button( parent, ID )
        # ID should be wx.ID_ADD for add button and wx.ID_FIND for find button in all forms
        self.button_6 = cdml.Button(self.pn_title, wx.ID_ADD)
        self.button_7 = cdml.Button(self.pn_title, wx.ID_FIND)

        # Create a button to open the dialog for display option
        self.button_8 = cdml.Button(self.pn_title, wx.ID_OPEN, "Select")

        # Scroll window that the RowPanel objects will be placed
        # IMPORTANT NOTE:
        #   In current version, all forms that need to manage the instance(s) of RowPanel class
        #       should have an instance of wx.ScrolledWindow class.
        #   Also the name of the panel should be "pn_view"
        self.pn_view = wx.ScrolledWindow(self,
                                         -1,
                                         style=wx.SUNKEN_BORDER
                                         | wx.TAB_TRAVERSAL)

        self.__set_properties()
        self.__do_layout()

        # Assign event handler for the buttons in title section -- to check the focus change
        self.pn_title.Bind(wx.EVT_BUTTON,
                           self.FrameEventHandler,
                           id=cdml.IDF_BUTTON1,
                           id2=cdml.IDF_BUTTON6)
        self.button_6.Bind(wx.EVT_BUTTON, self.FrameEventHandler)
        self.button_7.Bind(wx.EVT_BUTTON, self.FrameEventHandler)
        self.button_8.Bind(wx.EVT_BUTTON, self.FrameEventHandler)

        self.InitParameters()
コード例 #2
0
    def __init__(
        self,
        parent,
        module,
        pipeline,
        identifier=-1,
        pos=wx.DefaultPosition,
        size=wx.DefaultSize,
        style=wx.DEFAULT_FRAME_STYLE,
        name=wx.FrameNameStr,
    ):
        # Flag to check during event handling: widgets generate events as they
        # are created leading to referencing errors before all data structs
        # have been initialized.
        self.__initialized = False

        # Init frame
        self.__module = module
        self.__pipeline = pipeline
        self.__frame = parent

        # Data members for running pipeline
        self.__measurements = None
        self.__object_set = None
        self.__image_set_list = None
        self.__keys = None
        self.__groupings = None
        self.__grouping_index = None
        self.__within_group_index = None
        self.__outlines = None
        self.__grids = None

        frame_title = "Sampling settings for module, " + self.__module.module_name
        wx.Frame.__init__(self, self.__frame, identifier, frame_title, pos,
                          size, style, name)
        self.__frame_sizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSize(wx.Size(700, 350))
        self.SetSizer(self.__frame_sizer)

        # Get parameters
        self.__parameters_list = self.get_parameters_list()
        if len(self.__parameters_list) == 0:
            dialog = wx.MessageDialog(
                self,
                self.__module.module_name + " has no unbounded parameters.",
                caption="No unbounded parameters",
                style=wx.OK,
            )
            dialog.ShowModal()
            self.Close(True)

        # Init settings panel
        self.__settings_panel = wx.Panel(self, -1)
        self.__settings_panel_sizer = wx.BoxSizer(wx.VERTICAL)
        self.__settings_panel.SetSizer(self.__settings_panel_sizer)
        self.__frame_sizer.Add(self.__settings_panel, 1, wx.EXPAND | wx.ALL, 5)

        # Init settings scrolled window
        self.__settings_scrolled_window = wx.ScrolledWindow(
            self.__settings_panel)
        self.__settings_scrolled_window.SetScrollRate(20, 20)
        self.__settings_scrolled_window.EnableScrolling(True, True)
        self.__settings_scrolled_window_sizer = wx.FlexGridSizer(rows=0,
                                                                 cols=5)
        self.__settings_scrolled_window.SetSizer(
            self.__settings_scrolled_window_sizer)
        self.__settings_scrolled_window_sizer.AddGrowableCol(0)
        self.__settings_panel_sizer.Add(self.__settings_scrolled_window, 1,
                                        wx.EXPAND | wx.ALL, 5)

        # Headings
        self.__settings_scrolled_window_sizer.Add(
            wx.StaticText(self.__settings_scrolled_window, -1, "Parameter"),
            0,
            wx.ALIGN_CENTER | wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.TOP,
            5,
        )
        self.__settings_scrolled_window_sizer.Add(
            wx.StaticText(self.__settings_scrolled_window, -1,
                          "Current value"),
            0,
            wx.ALIGN_CENTER | wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.TOP,
            5,
        )
        self.__settings_scrolled_window_sizer.Add(
            wx.StaticText(self.__settings_scrolled_window, -1, "Lower bound"),
            0,
            wx.ALIGN_CENTER | wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.TOP,
            5,
        )
        self.__settings_scrolled_window_sizer.Add(
            wx.StaticText(self.__settings_scrolled_window, -1, "Upper bound"),
            0,
            wx.ALIGN_CENTER | wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.TOP,
            5,
        )
        self.__settings_scrolled_window_sizer.Add(
            wx.StaticText(self.__settings_scrolled_window, -1,
                          "Number samples"),
            0,
            wx.ALIGN_CENTER | wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.TOP
            | wx.RIGHT,
            5,
        )

        # Init dynamic widgets based on parameters
        self.__parameters_to_widgets_list = self.get_parameters_to_widgets_list(
            self.__parameters_list)

        self.__check_box_list = []
        self.__current_static_text_list = []
        self.__lower_bound_spin_ctrl_list = []
        self.__upper_bound_spin_ctrl_list = []
        self.__number_spin_ctrl_list = []
        for i in range(len(self.__parameters_to_widgets_list)):
            label = self.__parameters_list[i][0]
            setting = self.__module.setting(self.__parameters_list[i][1])
            value = setting.get_value()

            for j in range(len(self.__parameters_to_widgets_list[i])):
                # Checkbox & label
                if j == 0:
                    check_box = wx.CheckBox(self.__settings_scrolled_window,
                                            -1, label)
                    check_box.Bind(wx.EVT_CHECKBOX, self.on_check_box)
                    self.__settings_scrolled_window_sizer.Add(
                        check_box,
                        0,
                        wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.LEFT
                        | wx.TOP,
                        5,
                    )
                    self.__check_box_list.append(check_box)
                else:
                    self.__settings_scrolled_window_sizer.Add(
                        wx.Panel(self.__settings_scrolled_window, -1))

                # Current value
                if self.is_parameter_int(setting):
                    if self.get_parameter_input_size(setting) == 1:
                        cur_value = str(value)
                    elif self.get_parameter_input_size(setting) == 2:
                        cur_value = str(value[j])
                elif self.is_parameter_float(setting):
                    if self.get_parameter_input_size(setting) == 1:
                        cur_value = str(round(value, FLOAT_DIGITS_TO_ROUND_TO))
                    elif self.get_parameter_input_size(setting) == 2:
                        cur_value = str(
                            round(value[j], FLOAT_DIGITS_TO_ROUND_TO))
                current_static_text = wx.StaticText(
                    self.__settings_scrolled_window, -1, cur_value)
                self.__settings_scrolled_window_sizer.Add(
                    current_static_text,
                    0,
                    wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.TOP | wx.RIGHT,
                    5,
                )
                self.__current_static_text_list.append(current_static_text)

                # Lower and upper bounds
                if self.is_parameter_int(setting):
                    # Integer
                    lower_spin_ctrl = wx.SpinCtrl(
                        self.__settings_scrolled_window, wx.NewId())
                    lower_spin_ctrl.SetRange(INT_LOWER_BOUND, INT_UPPER_BOUND)
                    lower_spin_ctrl.Bind(wx.EVT_SPINCTRL,
                                         self.on_lower_spin_ctrl)

                    upper_spin_ctrl = wx.SpinCtrl(
                        self.__settings_scrolled_window, wx.NewId())
                    upper_spin_ctrl.SetRange(INT_LOWER_BOUND, INT_UPPER_BOUND)
                    upper_spin_ctrl.Bind(wx.EVT_SPINCTRL,
                                         self.on_upper_spin_ctrl)

                    interval = (DEFAULT_NUMBER_SAMPLES - 1
                                )  # Used later to set upper bound
                elif self.is_parameter_float(setting):
                    # Float
                    lower_spin_ctrl = wx.lib.agw.floatspin.FloatSpin(
                        self.__settings_scrolled_window,
                        wx.NewId(),
                        size=wx.DefaultSize
                    )  # NB: if not set, spin buttons are hidden
                    lower_spin_ctrl.SetDigits(FLOAT_DIGITS_TO_ROUND_TO)
                    lower_spin_ctrl.SetIncrement(10**-FLOAT_DIGITS_TO_ROUND_TO)
                    lower_spin_ctrl.SetRange(FLOAT_LOWER_BOUND,
                                             FLOAT_UPPER_BOUND)
                    lower_spin_ctrl.Bind(wx.lib.agw.floatspin.EVT_FLOATSPIN,
                                         self.on_lower_float_spin)

                    upper_spin_ctrl = wx.lib.agw.floatspin.FloatSpin(
                        self.__settings_scrolled_window,
                        wx.NewId(),
                        size=wx.DefaultSize
                    )  # NB: if not set, spin buttons are hidden
                    upper_spin_ctrl.SetDigits(FLOAT_DIGITS_TO_ROUND_TO)
                    upper_spin_ctrl.SetIncrement(10**-FLOAT_DIGITS_TO_ROUND_TO)
                    upper_spin_ctrl.SetRange(FLOAT_LOWER_BOUND,
                                             FLOAT_UPPER_BOUND)
                    upper_spin_ctrl.Bind(wx.lib.agw.floatspin.EVT_FLOATSPIN,
                                         self.on_upper_float_spin)

                    interval = (upper_spin_ctrl.GetIncrement()
                                )  # Used later to set upper bound

                if self.get_parameter_input_size(setting) == 1:
                    lower_spin_ctrl.SetValue(
                        value)  # Set value after range to avoid rounding
                    upper_spin_ctrl.SetValue(value + interval)
                elif self.get_parameter_input_size(setting) == 2:
                    lower_spin_ctrl.SetValue(value[j])
                    upper_spin_ctrl.SetValue(value[j] + interval)

                lower_spin_ctrl.Enable(False)
                self.__settings_scrolled_window_sizer.Add(
                    lower_spin_ctrl, 0,
                    wx.EXPAND | wx.ALIGN_LEFT | wx.LEFT | wx.TOP, 5)
                self.__lower_bound_spin_ctrl_list.append(lower_spin_ctrl)

                upper_spin_ctrl.Enable(False)
                self.__settings_scrolled_window_sizer.Add(
                    upper_spin_ctrl, 0, wx.LEFT | wx.TOP, 5)
                self.__upper_bound_spin_ctrl_list.append(upper_spin_ctrl)

                # Number samples
                num_spin_ctrl = wx.SpinCtrl(self.__settings_scrolled_window,
                                            wx.NewId())
                num_spin_ctrl.Enable(False)
                num_spin_ctrl.SetRange(1, 100)
                num_spin_ctrl.SetValue(10)
                num_spin_ctrl.Bind(wx.EVT_SPINCTRL, self.on_number_spin_ctrl)
                self.__settings_scrolled_window_sizer.Add(
                    num_spin_ctrl, 0, wx.LEFT | wx.TOP | wx.RIGHT, 5)
                self.__number_spin_ctrl_list.append(num_spin_ctrl)

        self.__settings_scrolled_window.Layout()
        self.__settings_panel.Layout()

        # Add button
        self.sample_button = wx.Button(self, ID_SAMPLE_BUTTON, "Sample")
        self.sample_button.Bind(wx.EVT_BUTTON, self.on_button)
        self.sample_button.Enable(False)
        self.__frame_sizer.Add(self.sample_button, 0, wx.ALIGN_RIGHT | wx.ALL,
                               5)

        self.__initialized = True
コード例 #3
0
    def __init__(self, *args, **kwds):
        # begin wxGlade: All_Widgets_Frame.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.SetSize((800, 417))
        self.SetTitle(_("All Widgets"))
        _icon = wx.NullIcon
        _icon.CopyFromBitmap(wx.ArtProvider.GetBitmap(wx.ART_TIP, wx.ART_OTHER, (32, 32)))
        self.SetIcon(_icon)

        # Menu Bar
        self.All_Widgets_menubar = wx.MenuBar()
        global mn_IDUnix; mn_IDUnix = wx.NewId()
        global mn_IDWindows; mn_IDWindows = wx.NewId()
        wxglade_tmp_menu = wx.Menu()
        wxglade_tmp_menu.Append(wx.ID_OPEN, _("&Open"), _("Open an existing document"))
        wxglade_tmp_menu.Append(wx.ID_CLOSE, _("&Close file"), _("Close current document"))
        wxglade_tmp_menu.AppendSeparator()
        wxglade_tmp_menu.Append(wx.ID_EXIT, _("E&xit"), _("Finish program"))
        self.All_Widgets_menubar.Append(wxglade_tmp_menu, _("&File"))
        wxglade_tmp_menu = wx.Menu()
        self.All_Widgets_menubar.mn_Unix = wxglade_tmp_menu.Append(mn_IDUnix, _("Unix"), _("Use Unix line endings"), wx.ITEM_RADIO)
        self.Bind(wx.EVT_MENU, self.onSelectUnix, id=mn_IDUnix)
        self.All_Widgets_menubar.mn_Windows = wxglade_tmp_menu.Append(mn_IDWindows, _("Windows"), _("Use Windows line endings"), wx.ITEM_RADIO)
        self.Bind(wx.EVT_MENU, self.onSelectWindows, id=mn_IDWindows)
        wxglade_tmp_menu.AppendSeparator()
        self.All_Widgets_menubar.mn_RemoveTabs = wxglade_tmp_menu.Append(wx.ID_ANY, _("Remove Tabs"), _("Remove all leading tabs"), wx.ITEM_CHECK)
        self.Bind(wx.EVT_MENU, self.onRemoveTabs, self.All_Widgets_menubar.mn_RemoveTabs)
        self.All_Widgets_menubar.Append(wxglade_tmp_menu, _("&Edit"))
        wxglade_tmp_menu = wx.Menu()
        wxglade_tmp_menu.Append(wx.ID_HELP, _("Manual"), _("Show the application manual"))
        self.Bind(wx.EVT_MENU, self.onShowManual, id=wx.ID_HELP)
        wxglade_tmp_menu.AppendSeparator()
        wxglade_tmp_menu.Append(wx.ID_ABOUT, _("About"), _("Show the About dialog"))
        self.All_Widgets_menubar.Append(wxglade_tmp_menu, _("&Help"))
        self.SetMenuBar(self.All_Widgets_menubar)
        # Menu Bar end

        self.All_Widgets_statusbar = self.CreateStatusBar(1, wx.ST_SIZEGRIP)
        self.All_Widgets_statusbar.SetStatusWidths([-1])
        # statusbar fields
        All_Widgets_statusbar_fields = [_("All Widgets statusbar")]
        for i in range(len(All_Widgets_statusbar_fields)):
            self.All_Widgets_statusbar.SetStatusText(All_Widgets_statusbar_fields[i], i)

        # Tool Bar
        self.All_Widgets_toolbar = wx.ToolBar(self, -1)
        self.All_Widgets_toolbar.AddTool(wx.ID_UP, _("UpDown"), wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_OTHER, (32, 32)), wx.ArtProvider.GetBitmap(wx.ART_GO_DOWN, wx.ART_OTHER, (32, 32)), wx.ITEM_CHECK, _("Up or Down"), _("Up or Down"))
        self.All_Widgets_toolbar.AddTool(wx.ID_OPEN, _("Open"), wx.Bitmap(32, 32), wx.NullBitmap, wx.ITEM_NORMAL, _("Open a new file"), _("Open a new file"))
        self.SetToolBar(self.All_Widgets_toolbar)
        self.All_Widgets_toolbar.Realize()
        # Tool Bar end

        sizer_1 = wx.FlexGridSizer(3, 1, 0, 0)

        self.notebook_1 = wx.Notebook(self, wx.ID_ANY, style=wx.NB_BOTTOM)
        sizer_1.Add(self.notebook_1, 1, wx.EXPAND, 0)

        self.notebook_1_wxBitmapButton = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxBitmapButton, _("wxBitmapButton"))

        sizer_13 = wx.FlexGridSizer(2, 2, 0, 0)

        self.bitmap_button_icon1 = wx.BitmapButton(self.notebook_1_wxBitmapButton, wx.ID_ANY, wx.Bitmap("icon.xpm", wx.BITMAP_TYPE_ANY))
        self.bitmap_button_icon1.SetSize(self.bitmap_button_icon1.GetBestSize())
        self.bitmap_button_icon1.SetDefault()
        sizer_13.Add(self.bitmap_button_icon1, 1, wx.ALL | wx.EXPAND, 5)

        self.bitmap_button_empty1 = wx.BitmapButton(self.notebook_1_wxBitmapButton, wx.ID_ANY, wx.Bitmap(10, 10))
        self.bitmap_button_empty1.SetSize(self.bitmap_button_empty1.GetBestSize())
        self.bitmap_button_empty1.SetDefault()
        sizer_13.Add(self.bitmap_button_empty1, 1, wx.ALL | wx.EXPAND, 5)

        self.bitmap_button_icon2 = wx.BitmapButton(self.notebook_1_wxBitmapButton, wx.ID_ANY, wx.Bitmap("icon.xpm", wx.BITMAP_TYPE_ANY), style=wx.BORDER_NONE | wx.BU_BOTTOM)
        self.bitmap_button_icon2.SetBitmapDisabled(wx.Bitmap(32, 32))
        self.bitmap_button_icon2.SetSize(self.bitmap_button_icon2.GetBestSize())
        self.bitmap_button_icon2.SetDefault()
        sizer_13.Add(self.bitmap_button_icon2, 1, wx.ALL | wx.EXPAND, 5)

        self.bitmap_button_art = wx.BitmapButton(self.notebook_1_wxBitmapButton, wx.ID_ANY, wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_OTHER, (32, 32)), style=wx.BORDER_NONE | wx.BU_BOTTOM)
        self.bitmap_button_art.SetSize(self.bitmap_button_art.GetBestSize())
        self.bitmap_button_art.SetDefault()
        sizer_13.Add(self.bitmap_button_art, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxButton = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxButton, _("wxButton"))

        sizer_28 = wx.BoxSizer(wx.HORIZONTAL)

        self.button_3 = wx.Button(self.notebook_1_wxButton, wx.ID_BOLD, "")
        sizer_28.Add(self.button_3, 0, wx.ALL, 5)

        self.notebook_1_wxCalendarCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxCalendarCtrl, _("wxCalendarCtrl"))

        sizer_12 = wx.BoxSizer(wx.HORIZONTAL)

        self.calendar_ctrl_1 = wx.adv.CalendarCtrl(self.notebook_1_wxCalendarCtrl, wx.ID_ANY, style=wx.adv.CAL_MONDAY_FIRST | wx.adv.CAL_SEQUENTIAL_MONTH_SELECTION | wx.adv.CAL_SHOW_SURROUNDING_WEEKS)
        sizer_12.Add(self.calendar_ctrl_1, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxCheckBox = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxCheckBox, _("wxCheckBox"))

        sizer_21 = wx.GridSizer(2, 3, 0, 0)

        self.checkbox_1 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("one (unchecked)"))
        sizer_21.Add(self.checkbox_1, 0, wx.EXPAND, 0)

        self.checkbox_2 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("two (checked)"))
        self.checkbox_2.SetValue(1)
        sizer_21.Add(self.checkbox_2, 0, wx.EXPAND, 0)

        self.checkbox_3 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("three"), style=wx.CHK_2STATE)
        sizer_21.Add(self.checkbox_3, 0, wx.EXPAND, 0)

        self.checkbox_4 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("four (unchecked)"), style=wx.CHK_3STATE)
        self.checkbox_4.Set3StateValue(wx.CHK_UNCHECKED)
        sizer_21.Add(self.checkbox_4, 0, wx.EXPAND, 0)

        self.checkbox_5 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("five (checked)"), style=wx.CHK_3STATE | wx.CHK_ALLOW_3RD_STATE_FOR_USER)
        self.checkbox_5.Set3StateValue(wx.CHK_CHECKED)
        sizer_21.Add(self.checkbox_5, 0, wx.EXPAND, 0)

        self.checkbox_6 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("six (undetermined)"), style=wx.CHK_3STATE | wx.CHK_ALLOW_3RD_STATE_FOR_USER)
        self.checkbox_6.Set3StateValue(wx.CHK_UNDETERMINED)
        sizer_21.Add(self.checkbox_6, 0, wx.EXPAND, 0)

        self.notebook_1_wxCheckListBox = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxCheckListBox, _("wxCheckListBox"))

        sizer_26 = wx.BoxSizer(wx.HORIZONTAL)

        self.check_list_box_1 = wx.CheckListBox(self.notebook_1_wxCheckListBox, wx.ID_ANY, choices=[_("one"), _("two"), _("three"), _("four")])
        self.check_list_box_1.SetSelection(2)
        sizer_26.Add(self.check_list_box_1, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxChoice = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxChoice, _("wxChoice"))

        sizer_5 = wx.BoxSizer(wx.HORIZONTAL)

        self.choice_empty = wx.Choice(self.notebook_1_wxChoice, wx.ID_ANY, choices=[])
        sizer_5.Add(self.choice_empty, 1, wx.ALL, 5)

        self.choice_filled = wx.Choice(self.notebook_1_wxChoice, wx.ID_ANY, choices=[_("Item 1"), _("Item 2 (pre-selected)")])
        self.choice_filled.SetSelection(1)
        sizer_5.Add(self.choice_filled, 1, wx.ALL, 5)

        self.notebook_1_wxComboBox = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxComboBox, _("wxComboBox"))

        sizer_6 = wx.BoxSizer(wx.VERTICAL)

        sizer_7 = wx.BoxSizer(wx.HORIZONTAL)
        sizer_6.Add(sizer_7, 1, wx.EXPAND, 0)

        self.combo_box_empty = wx.ComboBox(self.notebook_1_wxComboBox, wx.ID_ANY, choices=[], style=0)
        sizer_7.Add(self.combo_box_empty, 1, wx.ALL, 5)

        self.combo_box_filled = wx.ComboBox(self.notebook_1_wxComboBox, wx.ID_ANY, choices=[_("Item 1 (pre-selected)"), _("Item 2")], style=0)
        self.combo_box_filled.SetSelection(0)
        sizer_7.Add(self.combo_box_filled, 1, wx.ALL, 5)

        self.notebook_1_wxDatePickerCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxDatePickerCtrl, _("wxDatePickerCtrl"))

        sizer_17 = wx.BoxSizer(wx.HORIZONTAL)

        self.datepicker_ctrl_1 = wx.adv.DatePickerCtrl(self.notebook_1_wxDatePickerCtrl, wx.ID_ANY, style=wx.adv.DP_SHOWCENTURY)
        sizer_17.Add(self.datepicker_ctrl_1, 1, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)

        self.notebook_1_wxGauge = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxGauge, _("wxGauge"))

        sizer_15 = wx.BoxSizer(wx.HORIZONTAL)

        self.gauge_1 = wx.Gauge(self.notebook_1_wxGauge, wx.ID_ANY, 20)
        sizer_15.Add(self.gauge_1, 1, wx.ALL, 5)

        self.notebook_1_wxGrid = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxGrid, _("wxGrid"))

        sizer_19 = wx.BoxSizer(wx.HORIZONTAL)

        self.grid_1 = wx.grid.Grid(self.notebook_1_wxGrid, wx.ID_ANY, size=(1, 1))
        self.grid_1.CreateGrid(10, 3)
        self.grid_1.SetSelectionMode(wx.grid.Grid.SelectRows)
        sizer_19.Add(self.grid_1, 1, wx.EXPAND, 0)

        self.notebook_1_wxHyperlinkCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxHyperlinkCtrl, _("wxHyperlinkCtrl"))

        sizer_20 = wx.BoxSizer(wx.HORIZONTAL)

        self.hyperlink_1 = wx.adv.HyperlinkCtrl(self.notebook_1_wxHyperlinkCtrl, wx.ID_ANY, _("Homepage wxGlade"), _("http://wxglade.sf.net"))
        sizer_20.Add(self.hyperlink_1, 0, wx.ALL, 5)

        self.notebook_1_wxListBox = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxListBox, _("wxListBox"))

        sizer_4 = wx.BoxSizer(wx.VERTICAL)

        self.list_box_empty = wx.ListBox(self.notebook_1_wxListBox, wx.ID_ANY, choices=[], style=0)
        sizer_4.Add(self.list_box_empty, 1, wx.ALL | wx.EXPAND, 5)

        self.list_box_filled = wx.ListBox(self.notebook_1_wxListBox, wx.ID_ANY, choices=[_("Item 1"), _("Item 2 (pre-selected)")], style=wx.LB_MULTIPLE | wx.LB_SORT)
        self.list_box_filled.SetSelection(1)
        sizer_4.Add(self.list_box_filled, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxListCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxListCtrl, _("wxListCtrl"))

        sizer_3 = wx.BoxSizer(wx.HORIZONTAL)

        self.list_ctrl_1 = wx.ListCtrl(self.notebook_1_wxListCtrl, wx.ID_ANY, style=wx.BORDER_SUNKEN | wx.LC_REPORT)
        sizer_3.Add(self.list_ctrl_1, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxRadioBox = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxRadioBox, _("wxRadioBox"))

        grid_sizer_1 = wx.GridSizer(2, 2, 0, 0)

        self.radio_box_empty1 = wx.RadioBox(self.notebook_1_wxRadioBox, wx.ID_ANY, _("radio_box_empty1"), choices=[""], majorDimension=1, style=wx.RA_SPECIFY_ROWS)
        grid_sizer_1.Add(self.radio_box_empty1, 1, wx.ALL | wx.EXPAND, 5)

        self.radio_box_filled1 = wx.RadioBox(self.notebook_1_wxRadioBox, wx.ID_ANY, _("radio_box_filled1"), choices=[_("choice 1"), _("choice 2 (pre-selected)"), _("choice 3")], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
        self.radio_box_filled1.SetSelection(1)
        grid_sizer_1.Add(self.radio_box_filled1, 1, wx.ALL | wx.EXPAND, 5)

        self.radio_box_empty2 = wx.RadioBox(self.notebook_1_wxRadioBox, wx.ID_ANY, _("radio_box_empty2"), choices=[""], majorDimension=1, style=wx.RA_SPECIFY_COLS)
        grid_sizer_1.Add(self.radio_box_empty2, 1, wx.ALL | wx.EXPAND, 5)

        self.radio_box_filled2 = wx.RadioBox(self.notebook_1_wxRadioBox, wx.ID_ANY, _("radio_box_filled2"), choices=[_("choice 1"), _("choice 2 (pre-selected)")], majorDimension=0, style=wx.RA_SPECIFY_COLS)
        self.radio_box_filled2.SetSelection(1)
        grid_sizer_1.Add(self.radio_box_filled2, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxRadioButton = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxRadioButton, _("wxRadioButton"))

        sizer_8 = wx.StaticBoxSizer(wx.StaticBox(self.notebook_1_wxRadioButton, wx.ID_ANY, _("My RadioButton Group")), wx.HORIZONTAL)

        grid_sizer_2 = wx.FlexGridSizer(3, 2, 0, 0)
        sizer_8.Add(grid_sizer_2, 1, wx.EXPAND, 0)

        self.radio_btn_1 = wx.RadioButton(self.notebook_1_wxRadioButton, wx.ID_ANY, _("Alice"), style=wx.RB_GROUP)
        grid_sizer_2.Add(self.radio_btn_1, 1, wx.ALL | wx.EXPAND, 5)

        self.text_ctrl_1 = wx.TextCtrl(self.notebook_1_wxRadioButton, wx.ID_ANY, "")
        grid_sizer_2.Add(self.text_ctrl_1, 1, wx.ALL | wx.EXPAND, 5)

        self.radio_btn_2 = wx.RadioButton(self.notebook_1_wxRadioButton, wx.ID_ANY, _("Bob"))
        grid_sizer_2.Add(self.radio_btn_2, 1, wx.ALL | wx.EXPAND, 5)

        self.text_ctrl_2 = wx.TextCtrl(self.notebook_1_wxRadioButton, wx.ID_ANY, "")
        grid_sizer_2.Add(self.text_ctrl_2, 1, wx.ALL | wx.EXPAND, 5)

        self.radio_btn_3 = wx.RadioButton(self.notebook_1_wxRadioButton, wx.ID_ANY, _("Malroy"))
        grid_sizer_2.Add(self.radio_btn_3, 1, wx.ALL | wx.EXPAND, 5)

        self.text_ctrl_3 = wx.TextCtrl(self.notebook_1_wxRadioButton, wx.ID_ANY, "")
        grid_sizer_2.Add(self.text_ctrl_3, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxSlider = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxSlider, _("wxSlider"))

        sizer_22 = wx.BoxSizer(wx.HORIZONTAL)

        self.slider_1 = wx.Slider(self.notebook_1_wxSlider, wx.ID_ANY, 5, 0, 10, style=0)
        sizer_22.Add(self.slider_1, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxSpinButton = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxSpinButton, _("wxSpinButton (with wxTextCtrl)"))

        sizer_16 = wx.BoxSizer(wx.HORIZONTAL)

        self.tc_spin_button = wx.TextCtrl(self.notebook_1_wxSpinButton, wx.ID_ANY, _("1"), style=wx.TE_RIGHT)
        sizer_16.Add(self.tc_spin_button, 1, wx.ALL, 5)

        self.spin_button = wx.SpinButton(self.notebook_1_wxSpinButton, wx.ID_ANY )
        sizer_16.Add(self.spin_button, 1, wx.ALL, 5)

        self.notebook_1_wxSpinCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxSpinCtrl, _("wxSpinCtrl"))

        sizer_14 = wx.BoxSizer(wx.HORIZONTAL)

        self.spin_ctrl_1 = wx.SpinCtrl(self.notebook_1_wxSpinCtrl, wx.ID_ANY, "4", min=0, max=100)
        sizer_14.Add(self.spin_ctrl_1, 1, wx.ALL, 5)

        self.notebook_1_wxSplitterWindow_horizontal = wx.ScrolledWindow(self.notebook_1, wx.ID_ANY, style=wx.TAB_TRAVERSAL)
        self.notebook_1_wxSplitterWindow_horizontal.SetScrollRate(10, 10)
        self.notebook_1.AddPage(self.notebook_1_wxSplitterWindow_horizontal, _("wxSplitterWindow (horizontally)"))

        sizer_29 = wx.BoxSizer(wx.HORIZONTAL)

        self.splitter_1 = wx.SplitterWindow(self.notebook_1_wxSplitterWindow_horizontal, wx.ID_ANY, style=0)
        self.splitter_1.SetMinimumPaneSize(20)
        sizer_29.Add(self.splitter_1, 1, wx.ALL | wx.EXPAND, 5)

        self.splitter_1_pane_1 = wx.Panel(self.splitter_1, wx.ID_ANY)

        sizer_30 = wx.BoxSizer(wx.HORIZONTAL)

        self.label_top_pane = wx.StaticText(self.splitter_1_pane_1, wx.ID_ANY, _("top pane"))
        sizer_30.Add(self.label_top_pane, 1, wx.ALL | wx.EXPAND, 5)

        self.splitter_1_pane_2 = wx.Panel(self.splitter_1, wx.ID_ANY)

        sizer_31 = wx.BoxSizer(wx.HORIZONTAL)

        self.label_buttom_pane = wx.StaticText(self.splitter_1_pane_2, wx.ID_ANY, _("bottom pane"))
        sizer_31.Add(self.label_buttom_pane, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxSplitterWindow_vertical = wx.ScrolledWindow(self.notebook_1, wx.ID_ANY, style=wx.TAB_TRAVERSAL)
        self.notebook_1_wxSplitterWindow_vertical.SetScrollRate(10, 10)
        self.notebook_1.AddPage(self.notebook_1_wxSplitterWindow_vertical, _("wxSplitterWindow (vertically)"))

        sizer_25 = wx.BoxSizer(wx.HORIZONTAL)

        self.splitter_2 = wx.SplitterWindow(self.notebook_1_wxSplitterWindow_vertical, wx.ID_ANY, style=0)
        self.splitter_2.SetMinimumPaneSize(20)
        sizer_25.Add(self.splitter_2, 1, wx.ALL | wx.EXPAND, 5)

        self.splitter_2_pane_1 = wx.Panel(self.splitter_2, wx.ID_ANY)

        sizer_32 = wx.BoxSizer(wx.VERTICAL)

        self.label_left_pane = wx.StaticText(self.splitter_2_pane_1, wx.ID_ANY, _("left pane"))
        sizer_32.Add(self.label_left_pane, 1, wx.ALL | wx.EXPAND, 5)

        self.splitter_2_pane_2 = wx.Panel(self.splitter_2, wx.ID_ANY)

        sizer_33 = wx.BoxSizer(wx.VERTICAL)

        self.label_right_pane = wx.StaticText(self.splitter_2_pane_2, wx.ID_ANY, _("right pane"))
        sizer_33.Add(self.label_right_pane, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxStaticBitmap = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxStaticBitmap, _("wxStaticBitmap"))

        sizer_11 = wx.BoxSizer(wx.VERTICAL)

        self.bitmap_empty = wx.StaticBitmap(self.notebook_1_wxStaticBitmap, wx.ID_ANY, wx.Bitmap(32, 32))
        sizer_11.Add(self.bitmap_empty, 1, wx.ALL | wx.EXPAND, 5)

        self.bitmap_file = wx.StaticBitmap(self.notebook_1_wxStaticBitmap, wx.ID_ANY, wx.Bitmap("icon.xpm", wx.BITMAP_TYPE_ANY))
        sizer_11.Add(self.bitmap_file, 1, wx.ALL | wx.EXPAND, 5)

        self.bitmap_nofile = wx.StaticBitmap(self.notebook_1_wxStaticBitmap, wx.ID_ANY, wx.Bitmap("non-existing.bmp", wx.BITMAP_TYPE_ANY))
        sizer_11.Add(self.bitmap_nofile, 1, wx.ALL | wx.EXPAND, 5)

        self.bitmap_art = wx.StaticBitmap(self.notebook_1_wxStaticBitmap, wx.ID_ANY, wx.ArtProvider.GetBitmap(wx.ART_PRINT, wx.ART_OTHER, (32, 32)))
        sizer_11.Add(self.bitmap_art, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxStaticLine = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxStaticLine, _("wxStaticLine"))

        sizer_9 = wx.BoxSizer(wx.VERTICAL)

        sizer_10 = wx.BoxSizer(wx.HORIZONTAL)
        sizer_9.Add(sizer_10, 1, wx.EXPAND, 0)

        self.static_line_2 = wx.StaticLine(self.notebook_1_wxStaticLine, wx.ID_ANY, style=wx.LI_VERTICAL)
        sizer_10.Add(self.static_line_2, 1, wx.ALL | wx.EXPAND, 5)

        self.static_line_3 = wx.StaticLine(self.notebook_1_wxStaticLine, wx.ID_ANY, style=wx.LI_VERTICAL)
        sizer_10.Add(self.static_line_3, 1, wx.ALL | wx.EXPAND, 5)

        self.static_line_4 = wx.StaticLine(self.notebook_1_wxStaticLine, wx.ID_ANY)
        sizer_9.Add(self.static_line_4, 1, wx.ALL | wx.EXPAND, 5)

        self.static_line_5 = wx.StaticLine(self.notebook_1_wxStaticLine, wx.ID_ANY)
        sizer_9.Add(self.static_line_5, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxStaticText = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxStaticText, _("wxStaticText"))

        grid_sizer_3 = wx.FlexGridSizer(1, 3, 0, 0)

        self.label_1 = wx.StaticText(self.notebook_1_wxStaticText, wx.ID_ANY, _("red text (RGB)"), style=wx.ALIGN_CENTER_HORIZONTAL)
        self.label_1.SetForegroundColour(wx.Colour(255, 0, 0))
        grid_sizer_3.Add(self.label_1, 1, wx.ALL | wx.EXPAND, 5)

        self.label_4 = wx.StaticText(self.notebook_1_wxStaticText, wx.ID_ANY, _("black on red (RGB)"), style=wx.ALIGN_CENTER_HORIZONTAL)
        self.label_4.SetBackgroundColour(wx.Colour(255, 0, 0))
        self.label_4.SetToolTipString(_("Background colour won't show, check documentation for more details"))
        grid_sizer_3.Add(self.label_4, 1, wx.ALL | wx.EXPAND, 5)

        self.label_5 = wx.StaticText(self.notebook_1_wxStaticText, wx.ID_ANY, _("green on pink (RGB)"), style=wx.ALIGN_CENTER_HORIZONTAL)
        self.label_5.SetBackgroundColour(wx.Colour(255, 0, 255))
        self.label_5.SetForegroundColour(wx.Colour(0, 255, 0))
        self.label_5.SetToolTipString(_("Background colour won't show, check documentation for more details"))
        grid_sizer_3.Add(self.label_5, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_Spacer = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_Spacer, _("Spacer"))

        grid_sizer_4 = wx.FlexGridSizer(1, 3, 0, 0)

        self.label_3 = wx.StaticText(self.notebook_1_Spacer, wx.ID_ANY, _("Two labels with a"))
        grid_sizer_4.Add(self.label_3, 1, wx.ALL | wx.EXPAND, 5)

        grid_sizer_4.Add((60, 20), 1, wx.ALL | wx.EXPAND, 5)

        self.label_2 = wx.StaticText(self.notebook_1_Spacer, wx.ID_ANY, _("spacer between"))
        grid_sizer_4.Add(self.label_2, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxTextCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxTextCtrl, _("wxTextCtrl"))

        sizer_18 = wx.BoxSizer(wx.HORIZONTAL)

        self.text_ctrl = wx.TextCtrl(self.notebook_1_wxTextCtrl, wx.ID_ANY, _("This\nis\na\nmultiline\nwxTextCtrl"), style=wx.TE_CHARWRAP | wx.TE_MULTILINE | wx.TE_WORDWRAP)
        sizer_18.Add(self.text_ctrl, 1, wx.ALL | wx.EXPAND, 5)

        self.notebook_1_wxToggleButton = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxToggleButton, _("wxToggleButton"))

        sizer_23 = wx.BoxSizer(wx.HORIZONTAL)

        self.button_2 = wx.ToggleButton(self.notebook_1_wxToggleButton, wx.ID_ANY, _("Toggle Button 1"))
        sizer_23.Add(self.button_2, 1, wx.ALL, 5)

        self.button_4 = wx.ToggleButton(self.notebook_1_wxToggleButton, wx.ID_ANY, _("Toggle Button 2"), style=wx.BU_BOTTOM | wx.BU_EXACTFIT)
        sizer_23.Add(self.button_4, 1, wx.ALL, 5)

        self.notebook_1_wxTreeCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.notebook_1_wxTreeCtrl, _("wxTreeCtrl"))

        sizer_24 = wx.BoxSizer(wx.HORIZONTAL)

        self.tree_ctrl_1 = wx.TreeCtrl(self.notebook_1_wxTreeCtrl, wx.ID_ANY, style=0)
        sizer_24.Add(self.tree_ctrl_1, 1, wx.ALL | wx.EXPAND, 5)

        self.static_line_1 = wx.StaticLine(self, wx.ID_ANY)
        sizer_1.Add(self.static_line_1, 0, wx.ALL | wx.EXPAND, 5)

        sizer_2 = wx.FlexGridSizer(1, 2, 0, 0)
        sizer_1.Add(sizer_2, 0, wx.ALIGN_RIGHT, 0)

        self.button_5 = wx.Button(self, wx.ID_CLOSE, "")
        sizer_2.Add(self.button_5, 0, wx.ALIGN_RIGHT | wx.ALL, 5)

        self.button_1 = wx.Button(self, wx.ID_OK, "", style=wx.BU_TOP)
        sizer_2.Add(self.button_1, 0, wx.ALIGN_RIGHT | wx.ALL, 5)

        self.notebook_1_wxTreeCtrl.SetSizer(sizer_24)

        self.notebook_1_wxToggleButton.SetSizer(sizer_23)

        self.notebook_1_wxTextCtrl.SetSizer(sizer_18)

        self.notebook_1_Spacer.SetSizer(grid_sizer_4)

        self.notebook_1_wxStaticText.SetSizer(grid_sizer_3)

        self.notebook_1_wxStaticLine.SetSizer(sizer_9)

        self.notebook_1_wxStaticBitmap.SetSizer(sizer_11)

        self.splitter_2_pane_2.SetSizer(sizer_33)

        self.splitter_2_pane_1.SetSizer(sizer_32)

        self.splitter_2.SplitVertically(self.splitter_2_pane_1, self.splitter_2_pane_2)

        self.notebook_1_wxSplitterWindow_vertical.SetSizer(sizer_25)

        self.splitter_1_pane_2.SetSizer(sizer_31)

        self.splitter_1_pane_1.SetSizer(sizer_30)

        self.splitter_1.SplitHorizontally(self.splitter_1_pane_1, self.splitter_1_pane_2)

        self.notebook_1_wxSplitterWindow_horizontal.SetSizer(sizer_29)

        self.notebook_1_wxSpinCtrl.SetSizer(sizer_14)

        self.notebook_1_wxSpinButton.SetSizer(sizer_16)

        self.notebook_1_wxSlider.SetSizer(sizer_22)

        self.notebook_1_wxRadioButton.SetSizer(sizer_8)

        self.notebook_1_wxRadioBox.SetSizer(grid_sizer_1)

        self.notebook_1_wxListCtrl.SetSizer(sizer_3)

        self.notebook_1_wxListBox.SetSizer(sizer_4)

        self.notebook_1_wxHyperlinkCtrl.SetSizer(sizer_20)

        self.notebook_1_wxGrid.SetSizer(sizer_19)

        self.notebook_1_wxGauge.SetSizer(sizer_15)

        self.notebook_1_wxDatePickerCtrl.SetSizer(sizer_17)

        self.notebook_1_wxComboBox.SetSizer(sizer_6)

        self.notebook_1_wxChoice.SetSizer(sizer_5)

        self.notebook_1_wxCheckListBox.SetSizer(sizer_26)

        self.notebook_1_wxCheckBox.SetSizer(sizer_21)

        self.notebook_1_wxCalendarCtrl.SetSizer(sizer_12)

        self.notebook_1_wxButton.SetSizer(sizer_28)

        sizer_13.AddGrowableRow(0)
        sizer_13.AddGrowableRow(1)
        sizer_13.AddGrowableCol(0)
        sizer_13.AddGrowableCol(1)
        self.notebook_1_wxBitmapButton.SetSizer(sizer_13)

        sizer_1.AddGrowableRow(0)
        sizer_1.AddGrowableCol(0)
        self.SetSizer(sizer_1)
        sizer_1.SetSizeHints(self)

        self.Layout()
        self.Centre()

        self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnNotebookPageChanged, self.notebook_1)
        self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, self.OnNotebookPageChanging, self.notebook_1)
        self.Bind(wx.EVT_BUTTON, self.onStartConverting, self.button_1)
コード例 #4
0
    def __init__(self, parent, gpa_settings=None):

        wx.Frame.__init__(self,
                          parent=parent,
                          title="CPAC - Create New FSL Model",
                          size=(900, 650))

        if gpa_settings == None:
            self.gpa_settings = {}
            self.gpa_settings['participant_list'] = ''
            self.gpa_settings['pheno_file'] = ''
            self.gpa_settings['participant_id_label'] = ''
            self.gpa_settings['design_formula'] = ''
            self.gpa_settings['mean_mask'] = ''
            self.gpa_settings['custom_roi_mask'] = 'None'
            self.gpa_settings['coding_scheme'] = ''
            self.gpa_settings['derivative_list'] = ''
            self.gpa_settings['sessions_list'] = []
            self.gpa_settings['series_list'] = []
            self.gpa_settings['group_sep'] = ''
            self.gpa_settings['grouping_var'] = 'None'
            self.gpa_settings['z_threshold'] = ''
            self.gpa_settings['p_threshold'] = ''
        else:
            self.gpa_settings = gpa_settings

        self.parent = parent

        mainSizer = wx.BoxSizer(wx.VERTICAL)

        vertSizer = wx.BoxSizer(wx.VERTICAL)

        self.panel = wx.Panel(self)

        self.window = wx.ScrolledWindow(self.panel, size=(-1, 300))

        self.page = generic_class.GenericClass(self.window, " FSL Model Setup")

        self.page.add(label="Participant List ",
                      control=control.COMBO_BOX,
                      name="participant_list",
                      type=dtype.STR,
                      comment="Full path to a list of participants to be "
                      "included in the model.\n\nThis should be a "
                      "text file with each participant ID on its "
                      "own line.",
                      values=self.gpa_settings['participant_list'])

        self.page.add(label="Phenotype/EV File ",
                      control=control.COMBO_BOX,
                      name="pheno_file",
                      type=dtype.STR,
                      comment="Full path to a .csv file containing EV "
                      "information for each subject.\n\nTip: A "
                      "file in this format (containing a single "
                      "column listing all subjects run through "
                      "CPAC) was generated along with the main "
                      "CPAC subject list (see phenotypic_template_"
                      "X.csv).",
                      values=self.gpa_settings['pheno_file'])

        self.page.add(label="Participant Column Name ",
                      control=control.TEXT_BOX,
                      name="participant_id_label",
                      type=dtype.STR,
                      comment="Name of the participants column in your EV "
                      "file.",
                      values=self.gpa_settings['participant_id_label'],
                      style=wx.EXPAND | wx.ALL,
                      size=(160, -1))

        load_panel_sizer = wx.BoxSizer(wx.HORIZONTAL)
        load_pheno_btn = wx.Button(self.window, 2, 'Load Phenotype File',
                                   (220, 10), wx.DefaultSize, 0)
        load_panel_sizer.Add(load_pheno_btn)

        self.Bind(wx.EVT_BUTTON, self.populateEVs, id=2)

        self.page.add_pheno_load_panel(load_panel_sizer)

        self.page.add(
            label="Model Setup ",
            control=control.GPA_CHECKBOX_GRID,
            name="model_setup",
            type=10,
            values='',
            comment=
            "A list of EVs from your phenotype file will populate in this window. From here, you can select whether the EVs should be treated as categorical or if they should be demeaned (continuous/non-categorical EVs only). 'MeanFD', 'MeanFD_Jenkinson', 'Measure Mean', and 'Custom_ROI_Mean' will also appear in this window automatically as options to be used as regressors that can be included in your model design. Note that the MeanFD and mean of measure values are automatically calculated and supplied by C-PAC via individual-level analysis.",
            size=(450, -1))

        self.page.add(
            label="Design Matrix Formula ",
            control=control.TEXT_BOX,
            name="design_formula",
            type=dtype.STR,
            comment=
            "Specify the formula to describe your model design. Essentially, including EVs in this formula inserts them into the model. The most basic format to include each EV you select would be 'EV + EV + EV + ..', etc. You can also select to include MeanFD, MeanFD_Jenkinson, Measure_Mean, and Custom_ROI_Mean here. See the C-PAC User Guide for more detailed information regarding formatting your design formula.",
            values=self.gpa_settings['design_formula'],
            size=(450, -1))

        self.page.add(
            label="Custom ROI Mean Mask ",
            control=control.COMBO_BOX,
            name="custom_roi_mask",
            type=dtype.STR,
            comment=
            "Optional: Full path to a NIFTI file containing one or more ROI masks. The means of the masked regions will then be computed for each subject's output and will be included in the model as regressors (one for each ROI in the mask file) if you include 'Custom_ROI_Mean' in the Design Matrix Formula.",
            values=self.gpa_settings['custom_roi_mask'])

        self.page.add(
            label="Select Derivatives ",
            control=control.CHECKLIST_BOX,
            name="derivative_list",
            type=dtype.LSTR,
            values=[
                'ALFF', 'ALFF (smoothed)', 'f/ALFF', 'f/ALFF (smoothed)',
                'ReHo', 'ReHo (smoothed)', 'ROI Average SCA',
                'ROI Average SCA (smoothed)', 'Dual Regression',
                'Dual Regression (smoothed)', 'Multiple Regression SCA',
                'Multiple Regression SCA (smoothed)', 'Network Centrality',
                'Network Centrality (smoothed)', 'VMHC'
            ],
            comment=
            "Select which derivatives you would like to include when running group analysis.\n\nWhen including Dual Regression, make sure to correct your P-value for the number of maps you are comparing.\n\nWhen including Multiple Regression SCA, you must have more degrees of freedom (subjects) than there were time series.",
            size=(350, 160))

        self.page.add(
            label="Coding Scheme ",
            control=control.CHOICE_BOX,
            name="coding_scheme",
            type=dtype.LSTR,
            comment=
            "Choose the coding scheme to use when generating your model. 'Treatment' encoding is generally considered the typical scheme. Consult the User Guide for more information.",
            values=["Treatment", "Sum"])

        self.page.add(
            label="Mask for Means Calculation ",
            control=control.CHOICE_BOX,
            name='mean_mask',
            type=dtype.LSTR,
            comment=
            "Choose whether to use a group mask or individual-specific mask when calculating the output means to be used as a regressor.\n\nThis only takes effect if you include the 'Measure_Mean' or 'Custom_ROI_Mean' regressors in your Design Matrix Formula.",
            values=["Group Mask", "Individual Mask"])

        self.page.add(
            label="Z threshold ",
            control=control.FLOAT_CTRL,
            name='z_threshold',
            type=dtype.NUM,
            comment=
            "Only voxels with a Z-score higher than this value will be considered significant.",
            values=2.3)

        self.page.add(
            label="Cluster Significance Threshold ",
            control=control.FLOAT_CTRL,
            name='p_threshold',
            type=dtype.NUM,
            comment=
            "Significance threshold (P-value) to use when doing cluster correction for multiple comparisons.",
            values=0.05)

        self.page.add(
            label="Model Group Variances Separately ",
            control=control.CHOICE_BOX,
            name='group_sep',
            type=dtype.NUM,
            comment=
            "Specify whether FSL should model the variance for each group separately.\n\nIf this option is enabled, you must specify a grouping variable below.",
            values=['Off', 'On'])

        self.page.add(
            label="Grouping Variable ",
            control=control.TEXT_BOX,
            name="grouping_var",
            type=dtype.STR,
            comment=
            "The name of the EV that should be used to group subjects when modeling variances.\n\nIf you do not wish to model group variances separately, set this value to None.",
            values=self.gpa_settings['grouping_var'],
            size=(160, -1))

        self.page.add(label = 'Sessions (Repeated Measures Only) ',
                      control = control.LISTBOX_COMBO,
                      name = 'sessions_list',
                      type = dtype.LSTR,
                      values = self.gpa_settings['sessions_list'],
                      comment = 'Enter the session names in your dataset ' \
                                'that you wish to include within the same ' \
                                'model (this is for repeated measures/' \
                                'within-subject designs).\n\nTip: These ' \
                                'will be the names listed as "unique_id" in '\
                                'the original individual-level participant ' \
                                'list, or the labels in the original data ' \
                                'directories you marked as {session} while ' \
                                'creating the CPAC participant list.',
                      size = (200,100),
                      combo_type = 7)

        self.page.add(label = 'Series/Scans (Repeated Measures Only) ',
                      control = control.LISTBOX_COMBO,
                      name = 'series_list',
                      type = dtype.LSTR,
                      values = self.gpa_settings['series_list'],
                      comment = 'Enter the series names in your dataset ' \
                                'that you wish to include within the same ' \
                                'model (this is for repeated measures/' \
                                'within-subject designs).\n\nTip: These ' \
                                'will be the labels listed under "func:"" '\
                                'in the original individual-level ' \
                                'participant list, or the labels in the ' \
                                'original data directories you marked as ' \
                                '{series} while creating the CPAC ' \
                                'participant list.',
                      size = (200,100),
                      combo_type = 8)

        self.page.set_sizer()

        if 'group_sep' in self.gpa_settings.keys():

            for ctrl in self.page.get_ctrl_list():

                name = ctrl.get_name()

                if name == 'group_sep':

                    if self.gpa_settings['group_sep'] == True:
                        ctrl.set_value('On')
                    elif self.gpa_settings['group_sep'] == False:
                        ctrl.set_value('Off')

        mainSizer.Add(self.window, 1, wx.EXPAND)

        btnPanel = wx.Panel(self.panel, -1)
        hbox = wx.BoxSizer(wx.HORIZONTAL)

        buffer = wx.StaticText(btnPanel, label="\t\t\t\t\t\t")
        hbox.Add(buffer)

        cancel = wx.Button(btnPanel, wx.ID_CANCEL, "Cancel", (220, 10),
                           wx.DefaultSize, 0)
        self.Bind(wx.EVT_BUTTON, self.cancel, id=wx.ID_CANCEL)
        hbox.Add(cancel, 0, flag=wx.LEFT | wx.BOTTOM, border=5)

        load = wx.Button(btnPanel, wx.ID_ADD, "Load Settings", (200, -1),
                         wx.DefaultSize, 0)
        self.Bind(wx.EVT_BUTTON, self.load, id=wx.ID_ADD)
        hbox.Add(load, 0.6, flag=wx.LEFT | wx.BOTTOM, border=5)

        next = wx.Button(btnPanel, 3, "Next >", (200, -1), wx.DefaultSize, 0)
        self.Bind(wx.EVT_BUTTON, self.load_next_stage, id=3)
        hbox.Add(next, 0.6, flag=wx.LEFT | wx.BOTTOM, border=5)

        # reminder: functions bound to buttons require arguments
        #           (self, event)
        btnPanel.SetSizer(hbox)

        mainSizer.Add(btnPanel, 0.5, flag=wx.ALIGN_RIGHT | wx.RIGHT, border=20)

        self.panel.SetSizer(mainSizer)

        self.Show()

        # this fires only if we're coming BACK to this page from the second
        # page, and these parameters are already pre-loaded. this is to
        # automatically repopulate the 'Model Setup' checkbox grid and other
        # settings under it
        if self.gpa_settings['pheno_file'] != '':

            phenoFile = open(os.path.abspath(self.gpa_settings['pheno_file']))

            phenoHeaderString = phenoFile.readline().rstrip('\r\n')
            phenoHeaderItems = phenoHeaderString.split(',')
            phenoHeaderItems.remove(self.gpa_settings['participant_id_label'])

            # update the 'Model Setup' box and populate it with the EVs and
            # their associated checkboxes for categorical and demean
            for ctrl in self.page.get_ctrl_list():

                name = ctrl.get_name()

                if name == 'model_setup':
                    ctrl.set_value(phenoHeaderItems)
                    ctrl.set_selection(self.gpa_settings['ev_selections'])

                if name == 'coding_scheme':
                    ctrl.set_value(self.gpa_settings['coding_scheme'])

                if name == 'mean_mask':
                    ctrl.set_value(self.gpa_settings['mean_mask'])

                if name == 'z_threshold':
                    ctrl.set_value(self.gpa_settings['z_threshold'][0])

                if name == 'p_threshold':
                    ctrl.set_value(self.gpa_settings['p_threshold'])

                if name == 'group_sep':
                    ctrl.set_value(self.gpa_settings['group_sep'])

                if name == 'grouping_var':
                    ctrl.set_value(self.gpa_settings['grouping_var'])

                if ("list" in name) and (name != "participant_list"):

                    value = self.gpa_settings[name]

                    if isinstance(value, str):
                        value = value.replace("[", "").replace("]", "")
                        if "\"" in value:
                            value = value.replace("\"", "")
                        if "'" in value:
                            value = value.replace("'", "")
                        values = value.split(",")
                    else:
                        # instead, is a list- most likely when clicking
                        # "Back" on the modelDesign_window
                        values = value

                    new_derlist = []

                    for val in values:
                        new_derlist.append(val)

                    ctrl.set_value(new_derlist)
コード例 #5
0
ファイル: GUI.py プロジェクト: watte1997/MyTerm
    def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.statusbar = self.CreateStatusBar(5, wx.ST_SIZEGRIP)
        self.SplitterWindow = wx.SplitterWindow(self,
                                                wx.ID_ANY,
                                                style=wx.SP_3D | wx.SP_BORDER
                                                | wx.SP_LIVE_UPDATE)
        self.window_1_pane_1 = wx.ScrolledWindow(self.SplitterWindow,
                                                 wx.ID_ANY,
                                                 style=wx.SIMPLE_BORDER
                                                 | wx.TAB_TRAVERSAL)
        self.pnlSettingBar = wx.Panel(self.window_1_pane_1, wx.ID_ANY)
        self.btnHideBar = wx.Button(self.pnlSettingBar, wx.ID_ANY, "Hide")
        self.btnEnumPorts = wx.Button(self.pnlSettingBar, wx.ID_ANY,
                                      "EnumPorts")
        self.label_1 = wx.StaticText(self.pnlSettingBar, wx.ID_ANY, "Port")
        self.cmbPort = wx.ComboBox(self.pnlSettingBar,
                                   wx.ID_ANY,
                                   choices=[],
                                   style=wx.CB_DROPDOWN)
        self.label_2 = wx.StaticText(self.pnlSettingBar, wx.ID_ANY,
                                     "Baud Rate")
        self.cmbBaudRate = wx.ComboBox(
            self.pnlSettingBar,
            wx.ID_ANY,
            choices=[
                "300", "600", "1200", "1800", "2400", "4800", "9600", "19200",
                "38400", "57600", "115200", "230400", "460800", "500000",
                "576000", "921600", "1000000", "1152000", "1500000", "2000000",
                "2500000", "3000000", "3500000", "4000000"
            ],
            style=wx.CB_DROPDOWN)
        self.label_3 = wx.StaticText(self.pnlSettingBar, wx.ID_ANY,
                                     "Data Bits")
        self.choiceDataBits = wx.Choice(self.pnlSettingBar,
                                        wx.ID_ANY,
                                        choices=["5", "6", "7", "8"])
        self.label_4 = wx.StaticText(self.pnlSettingBar, wx.ID_ANY, "Parity")
        self.choiceParity = wx.Choice(
            self.pnlSettingBar,
            wx.ID_ANY,
            choices=["None", "Even", "Odd", "Mark", "Space"])
        self.label_5 = wx.StaticText(self.pnlSettingBar, wx.ID_ANY,
                                     "Stop Bits")
        self.choiceStopBits = wx.Choice(self.pnlSettingBar,
                                        wx.ID_ANY,
                                        choices=["1", "1.5", "2"])
        self.chkboxrtscts = wx.CheckBox(self.pnlSettingBar, wx.ID_ANY,
                                        "RTS/CTS")
        self.chkboxxonxoff = wx.CheckBox(self.pnlSettingBar, wx.ID_ANY,
                                         "Xon/Xoff")
        self.sizer_6_staticbox = wx.StaticBox(self.pnlSettingBar, wx.ID_ANY,
                                              "HandShake")
        self.btnOpen = wx.Button(self.pnlSettingBar, wx.ID_ANY, "Open")
        self.btnClear = wx.Button(self.pnlSettingBar, wx.ID_ANY,
                                  "Clear Screen")
        self.window_1_pane_2 = wx.Panel(self.SplitterWindow, wx.ID_ANY)
        self.pnlData = wx.Panel(self.window_1_pane_2, wx.ID_ANY)
        self.txtctlMain = wx.TextCtrl(
            self.pnlData,
            wx.ID_ANY,
            "",
            style=wx.TE_MULTILINE | wx.TE_RICH | wx.TE_RICH2 | wx.TE_AUTO_URL
            | wx.TE_LINEWRAP | wx.TE_WORDWRAP | wx.NO_BORDER)
        self.pnlTransmitHex = wx.Panel(self.pnlData,
                                       wx.ID_ANY,
                                       style=wx.SIMPLE_BORDER
                                       | wx.TAB_TRAVERSAL)
        self.label_6 = wx.StaticText(self.pnlTransmitHex, wx.ID_ANY,
                                     "Transmit Hex")
        self.btnTransmitHex = wx.Button(self.pnlTransmitHex, wx.ID_ANY,
                                        "Transmit")
        self.txtctlHex = wx.TextCtrl(self.pnlTransmitHex,
                                     wx.ID_ANY,
                                     "",
                                     style=wx.TE_MULTILINE | wx.TE_RICH
                                     | wx.TE_RICH2 | wx.TE_LINEWRAP
                                     | wx.TE_WORDWRAP | wx.NO_BORDER)

        self.__set_properties()
        self.__do_layout()
コード例 #6
0
    def __init__(self, parent, idx, selections, values, size):

        wx.Panel.__init__(self, parent, id=idx, size=size)

        all_sizer = wx.BoxSizer(wx.HORIZONTAL)
        window_sizer = wx.BoxSizer(wx.HORIZONTAL)
        button_sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.scrollWin = wx.ScrolledWindow(self, pos=(0,25), size=(600,205), \
                             style=wx.VSCROLL)
        self.scrollWin.SetBackgroundColour(wx.WHITE)

        self.selections = selections
        self.values = values

        # y-axis position of each new row (each new entry) in the checkbox
        # grid - this will change as entries are added
        self.y_pos = 0

        self.num_entries = 0

        # this sets the column names at the top of the checkbox grid
        #x_pos = 300
        x_pos = 5
        self.x_pos_increments = []

        for selection in self.selections:

            text = wx.StaticText(self, label=selection, pos=(x_pos, 0))

            spacing = 50 + text.GetSize().width - 20
            # spacing = 50 + (len(selection)*2) # adapt the spacing to
            #                                   # label length
            x_pos += spacing

            self.x_pos_increments.append(spacing)

        self.idx = 100

        self.grid_sizer = wx.GridBagSizer(wx.VERTICAL)

        self.scrollWin.SetSizer(self.grid_sizer)
        self.scrollWin.SetScrollRate(10, 10)
        self.scrollWin.EnableScrolling(True, True)

        self.row_panel = wx.Panel(self.scrollWin, wx.HORIZONTAL)
        self.row_panel.SetBackgroundColour(wx.WHITE)

        bmp = wx.Bitmap(p.resource_filename('CPAC', \
                            'GUI/resources/images/plus12.jpg'), \
                            wx.BITMAP_TYPE_ANY)
        self.button = wx.BitmapButton(self, -1, bmp, \
                                      size=(bmp.GetWidth(), bmp.GetHeight()),\
                                      pos=(605,25))
        self.button.Bind(wx.EVT_BUTTON, self.onButtonClick)

        self.cbValuesDict = {}

        # this is for saving checkbox states during operation
        # for returning previous values when boxes come out from
        # being grayed out
        self.tempChoiceDict = {}

        # dictionary of 3 lists, each list is a list of chars
        # of either '1' or '0', a list for include, categorical,
        # demean
        self.choiceDict = {}

        # this dictionary holds all of the GUI controls associated with each
        # entry (row) in the checkbox grid. this will be used to appropriately
        # delete rows the user selects to delete
        self.entry_controls = {}
コード例 #7
0
    def __init__(self, *args, **kwds):
        # begin wxGlade: formSimulation.__init__
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
        wx.Dialog.__init__(self, *args, **kwds)
        self.panel_buttons = wx.Panel(self, -1)
        self.panel_configure = wx.Panel(self, -1)
        self.configure_notebook = wx.Notebook(self.panel_configure,
                                              -1,
                                              style=0)
        self.notebook_saves = wx.ScrolledWindow(self.configure_notebook,
                                                -1,
                                                style=wx.TAB_TRAVERSAL)
        self.notebook_general = wx.ScrolledWindow(self.configure_notebook,
                                                  -1,
                                                  style=wx.TAB_TRAVERSAL)
        self.label_0 = wx.StaticText(self.notebook_general, -1,
                                     "List of RPMS (separated with \",\"):")
        self.data['rpms'] = wx.TextCtrl(self.notebook_general, -1, "")
        self.label_1 = wx.StaticText(self.notebook_general, -1,
                                     "Number of Cycles per rpm:")
        self.data['ncycles'] = wx.TextCtrl(self.notebook_general, -1, "")
        self.label_2 = wx.StaticText(self.notebook_saves, -1,
                                     "Saving Frequency :")
        self.data['nsave'] = wx.TextCtrl(self.notebook_saves, -1, "")
        self.label_3 = wx.StaticText(self.notebook_general, -1,
                                     "Max. Delta Crank Angle:")
        self.data['dtheta_rpm'] = wx.TextCtrl(self.notebook_general, -1, "")
        self.label_4 = wx.StaticText(self.notebook_general, -1,
                                     "Courant Number: ")
        self.data['Courant'] = wx.TextCtrl(self.notebook_general, -1, "")
        self.label_5 = wx.StaticText(self.notebook_general, -1,
                                     "Gas Specific Heat Ratio:")
        self.data['ga'] = wx.TextCtrl(self.notebook_general, -1, "")
        self.label_6 = wx.StaticText(self.notebook_general, -1,
                                     "Viscous Flow:")
        self.data['viscous_flow'] = wx.TextCtrl(self.notebook_general, -1, "")
        self.label_7 = wx.StaticText(self.notebook_general, -1, "Heat Flow:")
        self.data['heat_flow'] = wx.TextCtrl(self.notebook_general, -1, "")
        self.label_8 = wx.StaticText(self.notebook_general, -1, "Gas Constat:")
        self.data['R_gas'] = wx.TextCtrl(self.notebook_general, -1, "")
        self.label_9 = wx.StaticText(self.notebook_general, -1,
                                     "Strokes per Cycle:")
        self.data['nstroke'] = wx.RadioBox(self.notebook_general,
                                           -1,
                                           "",
                                           choices=["2", "4"],
                                           majorDimension=0,
                                           style=wx.RA_SPECIFY_ROWS)
        self.label_10 = wx.StaticText(self.notebook_general, -1,
                                      "Engine Geometry:")
        self.data['engine_type'] = wx.RadioBox(
            self.notebook_general,
            -1,
            "",
            choices=["Alternative", "Opposed-Piston"],
            majorDimension=0,
            style=wx.RA_SPECIFY_ROWS)
        self.label_11 = wx.StaticText(self.notebook_general, -1,
                                      "Ignition Order:")
        self.data['ig_order'] = wx.TextCtrl(self.notebook_general, -1, "")
        self.label_12 = wx.StaticText(self.notebook_saves, -1,
                                      "File Save State: ")
        self.data['filesave_state'] = wx.TextCtrl(self.notebook_saves, -1, "")
        self.label_13 = wx.StaticText(self.notebook_saves, -1,
                                      "File Save Species:")
        self.data['filesave_spd'] = wx.TextCtrl(self.notebook_saves, -1, "")
        self.label_14 = wx.StaticText(self.notebook_saves, -1,
                                      "Get Initial State From: ")
        self.data['get_state'] = wx.RadioBox(
            self.notebook_saves,
            -1,
            "",
            choices=["Here", "File", "Solver"],
            majorDimension=0,
            style=wx.RA_SPECIFY_ROWS)
        self.label_15 = wx.StaticText(self.notebook_saves, -1, "find:")
        self.button_1 = wx.Button(self.notebook_saves, -1, "load...")
        self.filename = wx.StaticText(self.notebook_saves, -1, "\" \"")
        self.data['filein_state'] = wx.TextCtrl(self.notebook_saves, -1, "")
        self.data['calc_engine_data'] = wx.CheckBox(
            self.notebook_saves, -1,
            "Calculate Engine Performance Characteristics")
        self.label_17 = wx.StaticText(self.notebook_saves, -1,
                                      "Appending Frequency :")
        self.data['nappend'] = wx.TextCtrl(self.notebook_saves, -1, "")
        self.data['folder_name'] = wx.TextCtrl(self.notebook_saves, -1, "")
        self.label_18 = wx.StaticText(self.notebook_saves, -1, "Folder Name:")
        self.panel_23 = wx.Panel(self.notebook_saves, -1)
        self.accept = wx.Button(self.panel_buttons, wx.ID_OK, "")
        self.cancel = wx.Button(self.panel_buttons, wx.ID_CANCEL, "")
        self.help = wx.ContextHelpButton(self.panel_buttons)

        self.__set_properties()
        self.setContextualHelp()
        self.__do_layout()

        self.Bind(wx.EVT_RADIOBOX, self.onNStroke, self.data['nstroke'])
        self.Bind(wx.EVT_RADIOBOX, self.onChangeGetState,
                  self.data['get_state'])
        self.Bind(wx.EVT_BUTTON, self.onOpenDialogFile, self.button_1)
        self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.onChangeGetState,
                  self.configure_notebook)
        self.Bind(wx.EVT_BUTTON, self.ConfigureAccept, self.accept)
コード例 #8
0
ファイル: StudyModels.py プロジェクト: ilanderma/MIST
    def __init__(self,
                 mode=None,
                 data=None,
                 type=None,
                 id_prj=0,
                 *args,
                 **kwds):
        """ Constructor of the MainFrame class """
        self.idPrj = id_prj

        #create frame instance
        cdml.CDMFrame.__init__(self, mode, data, type, *args, **kwds)

        # Define Popup menu items
        # Format : tuple of list --> ([Label, Event handler, Id] , [], [], ... )
        #           Label : label of an item
        #           Event handler : name of event handler
        #           Id : Id of current menu item
        # Special label : '-'--> separator, '+' --> submenu items
        #           First item after last '+' marked items is the title of the submenu
        # If an item doesn't have event handler, the second parameter should be 'None'
        # If an item doesn't have Id, the third item should be -1
        # If a form need to manage instances of RowPanel class,
        #   the event handler should be 'self.FrameEventHandler'
        # Otherwise, dedicated event handler should be implemented in that class (ex. see Project or PopulationData form)
        self.pup_menus = (["Undo", self.FrameEventHandler, wx.ID_UNDO], [
            "-", None, -1
        ], ["Add", self.FrameEventHandler, wx.ID_ADD], [
            "Copy Record", self.FrameEventHandler, cdml.ID_MENU_COPY_RECORD
        ], ["Delete", self.FrameEventHandler, wx.ID_DELETE], ["-", None, -1], [
            "Find", self.FrameEventHandler, wx.ID_FIND
        ], ["-",
            None, -1], ["+Name", self.FrameEventHandler, cdml.IDF_BUTTON1], [
                "+Main Process", self.FrameEventHandler, cdml.IDF_BUTTON2
            ], ["+Created On", self.FrameEventHandler, cdml.IDF_BUTTON3], [
                "+Last Modified", self.FrameEventHandler, cdml.IDF_BUTTON4
            ], ["+User Modified", self.FrameEventHandler, cdml.IDF_BUTTON5], [
                "+Derived From Model", self.FrameEventHandler, cdml.IDF_BUTTON6
            ], [
                "+Created By Project", self.FrameEventHandler, cdml.IDF_BUTTON7
            ], ["+Notes", self.FrameEventHandler,
                cdml.IDF_BUTTON8], ["Sort By", None, -1])

        # Define the window menus
        cdml.GenerateStandardMenu(self)

        # create panel for field titles
        # IMPORTANT NOTE:
        #   In current version, name of a panel for the title section should be "pn_title"
        #   And should be an instance of CDMPanel class with False as a first argument
        self.pn_title = cdml.CDMPanel(False, self, -1)
        self.st_title = wx.StaticText(self.pn_title, -1, "Define Model")

        # Create bitmap buttons to display title of each field
        # Syntax : cdml.BitmapButton( parent, id, bitmap, label )
        # Don't need to set bitmap here. It will be assigned in the event handler when pressed
        # For the sort function, the labels need to be same with the variable name in database object
        self.button_1 = cdml.BitmapButton(self.pn_title, cdml.IDF_BUTTON1,
                                          None, "Name")
        self.button_2 = cdml.BitmapButton(self.pn_title, cdml.IDF_BUTTON2,
                                          None, "Main Process")
        self.button_3 = cdml.BitmapButton(self.pn_title, cdml.IDF_BUTTON3,
                                          None, "Created On")
        self.button_4 = cdml.BitmapButton(self.pn_title, cdml.IDF_BUTTON4,
                                          None, "Last Modified")
        self.button_5 = cdml.BitmapButton(self.pn_title, cdml.IDF_BUTTON5,
                                          None, "Derived From")
        self.button_6 = cdml.BitmapButton(self.pn_title, cdml.IDF_BUTTON6,
                                          None, "Notes")

        # Create buttons to open State form. This button is only used for StudyModels form
        self.btn_states = cdml.Button(self.pn_title, wx.ID_OPEN, "States")

        # Create Add/Find buttons
        # Syntax : cdml.Button( parent, ID )
        # ID should be wx.ID_ADD for add button and wx.ID_FIND for find button in all forms
        self.btn_add = cdml.Button(self.pn_title, wx.ID_ADD)
        self.btn_find = cdml.Button(self.pn_title, wx.ID_FIND)

        # Scroll window that the RowPanel objects will be placed
        # IMPORTANT NOTE:
        #   In current version, all forms that need to manage the instance(s) of RowPanel class
        #       should have an instance of wx.ScrolledWindow class.
        #   Also the name of the panel should be "pn_view"
        self.pn_view = wx.ScrolledWindow(self,
                                         -1,
                                         style=wx.SUNKEN_BORDER
                                         | wx.TAB_TRAVERSAL)

        # Test code for the usage of StatusBar - Not used
        # self.sb = cdml.StatusBar(self)
        # self.SetStatusBar(self.sb)

        # Assign event handler for the buttons in title section -- to check the focus change
        self.pn_title.Bind(wx.EVT_BUTTON,
                           self.FrameEventHandler,
                           id=cdml.IDF_BUTTON1,
                           id2=cdml.IDF_BUTTON9)
        self.btn_states.Bind(wx.EVT_BUTTON, self.FrameEventHandler)  # States
        self.btn_add.Bind(wx.EVT_BUTTON, self.FrameEventHandler)  # ADD
        self.btn_find.Bind(wx.EVT_BUTTON, self.FrameEventHandler)  # FIND

        self.__set_properties()  # set properties of controls
        self.__do_layout()  # Set position of controls/panels

        # Initialze this form : Create RowPanles and display data for each field in DB
        # Implemented in CDMLib -> CDMFrame class -> Initialize
        self.Initialize()