Пример #1
0
    def __init__(self,
                 parent,
                 phil,
                 backend_name='BACKEND',
                 target=None,
                 content_style='normal',
                 label_style='bold',
                 opt_size=(500, 500),
                 phil_size=(500, 500),
                 *args,
                 **kwargs):
        BaseDialog.__init__(self,
                            parent,
                            content_style=content_style,
                            label_style=label_style,
                            *args,
                            **kwargs)

        self.parent = parent
        self.target_phil = target
        self.backend = backend_name
        self.params = phil.extract()
        self.opt_size = opt_size
        self.phil_size = phil_size
        self.sash_position = None

        self.splitter = wx.SplitterWindow(self,
                                          style=wx.SP_LIVE_UPDATE
                                          | wx.SP_3DSASH | wx.SP_NOBORDER)

        # Create options panel (all objects should be called as self.options.object)
        self.options = ScrolledPanel(self.splitter, size=self.opt_size)
        self.options_sizer = wx.BoxSizer(wx.VERTICAL)
        self.options.SetSizer(self.options_sizer)

        # Create PHIL panel
        phil_label = "{} Target Settings".format(backend_name)
        self.phil_panel = wx.Panel(self.splitter, size=self.opt_size)
        phil_box = wx.StaticBox(self.phil_panel, label=phil_label)
        self.phil_sizer = wx.StaticBoxSizer(phil_box, wx.VERTICAL)
        self.phil_panel.SetSizer(self.phil_sizer)

        # Dialog control
        self.dlg_ctr = ct.DialogButtonsCtrl(self, preset='PROC_DIALOG')

        # Splitter button
        self.btn_hide_script = GenToggleButton(self, label='Show Script >>>')
        self.show_hide_script()
        self.btn_hide_script.SetValue(False)

        self.main_sizer.Add(self.btn_hide_script,
                            flag=wx.ALIGN_RIGHT | wx.ALL,
                            border=10)
        self.main_sizer.Add(self.splitter,
                            1,
                            flag=wx.EXPAND | wx.ALL,
                            border=10)
        self.main_sizer.Add(self.dlg_ctr,
                            flag=wx.EXPAND | wx.ALIGN_RIGHT | wx.RIGHT,
                            border=10)
Пример #2
0
    def __init__(self,
                 parent,
                 label_style='bold',
                 content_style='normal',
                 *args,
                 **kwargs):

        dlg_style = wx.CAPTION | wx.CLOSE_BOX | wx.RESIZE_BORDER | wx.STAY_ON_TOP
        IOTABaseDialog.__init__(self,
                                parent,
                                style=dlg_style,
                                label_style=label_style,
                                content_style=content_style,
                                size=(400, 400),
                                title='Recover Completed Run',
                                *args,
                                **kwargs)

        self.pathlist = wx.ListCtrl(self,
                                    style=wx.LC_REPORT | wx.LC_SINGLE_SEL)
        self.selected = None
        self.recovery_mode = 0

        self.pathlist.InsertColumn(0, "")
        self.pathlist.InsertColumn(1, "Status")
        self.pathlist.InsertColumn(2, "Path")

        bmps = wx.ImageList(width=16, height=16)
        finished_bmp = bitmaps.fetch_icon_bitmap('actions',
                                                 'button_ok',
                                                 size=16)
        aborted_bmp = bitmaps.fetch_icon_bitmap('actions', 'cancel', size=16)
        unknown_bmp = bitmaps.fetch_icon_bitmap('actions',
                                                'status_unknown',
                                                size=16)
        bmps.Add(finished_bmp)
        bmps.Add(aborted_bmp)
        bmps.Add(unknown_bmp)
        self.pathlist.AssignImageList(bmps, which=1)

        self.envelope.Add(self.pathlist, 1, flag=wx.EXPAND | wx.ALL, border=10)

        # Dialog control
        self.dlg_ctr = ct.DialogButtonsCtrl(
            self,
            preset='OK_CANCEL',
            choices=['everything', 'settings only'],
            choice_label='Recover: ')
        self.envelope.Add(self.dlg_ctr,
                          flag=wx.EXPAND | wx.ALIGN_RIGHT | wx.ALL,
                          border=10)

        self.Bind(wx.EVT_BUTTON, self.onOK, id=wx.ID_OK)
        self.Bind(wx.EVT_BUTTON, self.onCancel, self.dlg_ctr.btn_cancel)
        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onItemActivated, id=-1)

        self.place_and_size(set_by='parent', set_size='dialog')