Ejemplo n.º 1
0
    def __init__(self, parent):
        pos = wx.DefaultPosition
        size = (580, 522)
        style = (wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | wx.CLIP_CHILDREN
                 | wx.FRAME_FLOAT_ON_PARENT)
        wx.Frame.__init__(self,
                          wx.GetApp().TopWindow, wx.ID_ANY,
                          p4R.Application_name + " - Fitting options", pos,
                          size, style)

        self.Bind(wx.EVT_CLOSE, self.on_close)

        self.SetIcon(prog_icon.GetIcon())

        self.aui_mgr = aui.AuiManager()
        self.aui_mgr.SetManagedWindow(self)

        self.notebook = AUINotebookParameters(self)

        self.aui_mgr.AddPane(
            self.notebook,
            aui.AuiPaneInfo().Center().Name("notebook_content").PaneBorder(
                False).Position(1).MaximizeButton(False).CenterPane())

        all_panes = self.aui_mgr.GetAllPanes()
        '''Theme for Notebook
        aui.AuiDefaultTabArt(), aui.AuiSimpleTabArt(), aui.VC71TabArt()
        aui.FF2TabArt(), aui.VC8TabArt(), aui.ChromeTabArt()'''
        # for apply theme to all notebook
        for pane in all_panes:
            nb = pane.window
            tabArt = aui.ChromeTabArt()
            nb.SetArtProvider(tabArt)
            nb.Refresh()
            nb.Update()

        self.aui_mgr.AddPane(
            FitParametersPanel(self),
            aui.AuiPaneInfo().Name("Fit_Params").CenterPane().PaneBorder(
                False).Position(1).MaximizeButton(False))

        self.aui_mgr.GetPane("notebook_content").dock_proportion = 85
        self.aui_mgr.GetPane("Fit_Params").dock_proportion = 100
        self.Layout()
        self.aui_mgr.Update()
        #        self.Bind(wx.EVT_SIZE, self.OnSize)
        pub.subscribe(self.on_close, pubsub_Save_Param_and_quit)
        pub.subscribe(self.on_open_window, pubsub_Open_Option_Window)
        self.Layout()
Ejemplo n.º 2
0
    def __init__(self, parent):
        pos = wx.DefaultPosition
        size = (377, 282)
        if _platform == 'darwin':
            style = wx.DEFAULT_FRAME_STYLE
        else:
            style = (wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX
                     | wx.CLIP_CHILDREN | wx.FRAME_FLOAT_ON_PARENT)
        wx.Frame.__init__(self,
                          wx.GetApp().TopWindow, wx.ID_ANY,
                          p4R.Application_name + " - Strain and DW Values",
                          pos, size, style)
        self.Bind(wx.EVT_CLOSE, self.on_close)
        self.SetIcon(prog_icon.GetIcon())

        pnl = wx.Panel(self)

        self.list = TableGrid(pnl)

        if _platform == "linux" or _platform == "linux2":
            self.width_name = 70
        else:
            self.width_name = 50
        self.width = 70
        self.widthCheck = 25
        self.col2checkstatus = {2: 0, 4: 0}

        self.Bind(Grid.EVT_GRID_LABEL_LEFT_CLICK, self.OnItemSelected)
        #        self.Bind(Grid.EVT_GRID_CELL_CHANGE, self.OnCellChange)
        self.Bind(Grid.EVT_GRID_CELL_CHANGING, self.OnCellChanging)
        self.Bind(Grid.EVT_GRID_CELL_CHANGED, self.OnCellChanged)
        self.Bind(Grid.EVT_GRID_EDITOR_SHOWN, self.OnEditorHidden)
        self.Bind(Grid.EVT_GRID_EDITOR_HIDDEN, self.OnEditorHidden)

        mastersizer = wx.BoxSizer(wx.HORIZONTAL)
        mastersizer.Add(self.list, 0, wx.EXPAND, 5)

        pub.subscribe(self.on_fill_list, pubsub_Fill_List_coef)
        pub.subscribe(self.on_open_window, pubsub_Open_data_coef_Window)

        #        self.Bind(wx.EVT_SIZE, self.OnSize)
        pnl.SetSizer(mastersizer)
        pnl.Layout()
        pnl.Fit()
Ejemplo n.º 3
0
    def __init__(self):
        wx.Frame.__init__(self, None, wx.ID_ANY,
                          p4R.Application_name + " - log window")
        wx.Frame.CenterOnScreen(self)
        self.Bind(wx.EVT_CLOSE, self.onClose)

        self.SetIcon(prog_icon.GetIcon())
        sizer = wx.BoxSizer(wx.VERTICAL)
        self._logFileContents = wx.TextCtrl(self,
                                            wx.ID_ANY,
                                            size=(600, 300),
                                            style=wx.TE_MULTILINE
                                            | wx.TE_READONLY | wx.VSCROLL)

        self.updateButton = wx.Button(self, wx.ID_ANY, label="Update")

        sizer.Add(self._logFileContents, 1, wx.ALL | wx.EXPAND, 5)
        sizer.Add(self.updateButton, 0, wx.ALL | wx.EXPAND, 5)
        self.Bind(wx.EVT_BUTTON, self.on_update, self.updateButton)
        self.SetSizer(sizer)
        self.update()
        self.Layout()
        self.Fit()
Ejemplo n.º 4
0
    def __init__(self, parent):
        pos = wx.DefaultPosition
        size = (380, 340)
        style = (wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | wx.CLIP_CHILDREN
                 | wx.FRAME_FLOAT_ON_PARENT)
        wx.Frame.__init__(self,
                          wx.GetApp().TopWindow, wx.ID_ANY,
                          p4R.Application_name + " - Graph Style", pos, size,
                          style)
        self.Bind(wx.EVT_CLOSE, self.on_close)

        self.SetIcon(prog_icon.GetIcon())
        if _platform == "linux" or _platform == "linux2":
            font_update = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        elif _platform == "win32":
            font_update = wx.Font(9, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        elif _platform == 'darwin':
            font_update = wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD)

        self.lines_names = ['solid', 'dashed', 'dashdot', 'dotted', 'None']
        pnl = wx.Panel(self)

        self.buttonRefs = []

        colorlinesizer = wx.FlexGridSizer(cols=5)

        vStatictextsize = 16
        size_text = (50, vStatictextsize)
        graph = wx.StaticText(pnl, -1, "Graph", size=size_text)
        l1 = wx.StaticLine(pnl, size=(3, 20), style=wx.LI_VERTICAL)
        l2 = wx.StaticLine(pnl, size=(3, 20), style=wx.LI_VERTICAL)
        t1 = wx.StaticText(pnl, -1, "Colors")
        t2 = wx.StaticText(pnl, -1, "Style")
        graph.SetFont(font_update)
        l1.SetFont(font_update)
        l2.SetFont(font_update)
        t1.SetFont(font_update)
        t2.SetFont(font_update)
        colorlinesizer.AddMany([
            (graph, 0, wx.ALL | wx.ALIGN_CENTER, 3),
            (l1, 0, wx.ALL | wx.ALL, 3),
            (t1, 0, wx.ALL | wx.ALIGN_CENTER, 3),
            (l2, 0, wx.ALL | wx.ALL, 3),
            (t2, 0, wx.ALL | wx.ALIGN_CENTER, 3),
        ])

        self.buttonRefs = []  # for saving references to buttons
        self.list_ = ['Strain', 'DW', 'XRD Data', 'Fit', 'Fit Live']
        a = P4Rm()
        size_button = (60, 20)
        for i in range(len(self.list_)):
            key_c = p4R.s_radmax_7[i]
            key_l = p4R.s_radmax_7[i + len(self.list_)]
            color = a.DefaultDict[key_c]
            line = a.DefaultDict[key_l]
            name = self.list_[i]
            graph = wx.StaticText(pnl, -1, name, size=size_text)
            b1 = csel.ColourSelect(pnl, -1, "", color, size=size_button)
            l1 = wx.StaticLine(pnl, size=(3, 20), style=wx.LI_VERTICAL)
            l2 = wx.StaticLine(pnl, size=(3, 20), style=wx.LI_VERTICAL)
            pscb = PenStyleComboBox(pnl,
                                    choices=penStyles,
                                    style=wx.CB_READONLY,
                                    pos=(20, 40),
                                    size=(120, -1),
                                    name=name)
            pscb.SetSelection(self.lines_names.index(line))

            self.buttonRefs.append((name, b1, pscb))
            colorlinesizer.AddMany([
                (graph, 0, wx.ALL | wx.ALIGN_CENTER, 3),
                (l1, 0, wx.ALL | wx.ALL, 3),
                (b1, 0, wx.ALL, 3),
                (l2, 0, wx.ALL | wx.ALL, 3),
                (pscb, 0, wx.ALL, 3),
            ])

#        'Graph background'
        name = "Graph background color"
        size_text = (160, vStatictextsize)
        graph_bkg_txt = wx.StaticText(pnl, -1, name, size=size_text)
        color = a.DefaultDict['c_graph_background']
        lbkg = wx.StaticLine(pnl, size=(3, 20), style=wx.LI_VERTICAL)
        self.graph_bkg = csel.ColourSelect(pnl,
                                           -1,
                                           "",
                                           color,
                                           size=size_button)

        self.b = wx.Button(pnl, -1, "Apply")
        self.b.SetFont(font_update)
        self.Bind(wx.EVT_BUTTON, self.on_apply_color, id=self.b.GetId())

        self.default_1_Id = wx.NewId()
        self.default_1 = wx.Button(pnl,
                                   id=self.default_1_Id,
                                   label="Set as Default")
        self.default_1.SetFont(font_update)
        self.default_1.Bind(wx.EVT_BUTTON, self.on_save_data)

        buttonSizer = wx.FlexGridSizer(cols=2)
        buttonSizer.Add(self.b, 0, wx.ALL, 3)
        buttonSizer.Add(self.default_1, 0, wx.ALL, 3)

        bkg_sizer = wx.GridBagSizer(hgap=2, vgap=1)
        bkg_sizer.Add(graph_bkg_txt, pos=(0, 0), flag=wx.ALL, border=3)
        bkg_sizer.Add(lbkg, pos=(0, 1), flag=wx.ALL | wx.ALL)
        bkg_sizer.Add(self.graph_bkg, pos=(0, 2), flag=wx.ALL, border=3)

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(colorlinesizer, 0, wx.ALL, 3)
        mainSizer.Add(bkg_sizer, 0, wx.ALL, 3)
        mainSizer.Add(buttonSizer, 0, wx.ALL, 3)

        pub.subscribe(self.on_open_window, pubsub_Open_Color_Window)
        #        self.Bind(wx.EVT_SIZE, self.OnSize)
        pnl.SetSizer(mainSizer)
        pnl.Layout()
        pnl.Fit()
Ejemplo n.º 5
0
    def __init__(self, parent):
        pos = wx.DefaultPosition
        size = (377, 282)
        style = (wx.SYSTEM_MENU | wx.CAPTION |
                 wx.CLIP_CHILDREN | wx.FRAME_FLOAT_ON_PARENT)
        wx.Frame.__init__(self, wx.GetApp().TopWindow, wx.ID_ANY,
                          p4R.Application_name + " - Fit Parameters",
                          pos, size, style)
        self.Bind(wx.EVT_CLOSE, self.on_close)

        self.SetIcon(prog_icon.GetIcon())
        if _platform == "linux" or _platform == "linux2":
            font_update = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        elif _platform == "win32":
            font_update = wx.Font(9, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        elif _platform == 'darwin':
            font_update = wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD)

        pnl = wx.Panel(self)
        label_0 = (u"Input parameters are off limits\n" +
                   u"Please choose your action:")
        label_1 = "Modify input ?"
        label_2 = "Modify limits ?"
        label_3 = "Obi-Wan Kenobi"

        label_txt_a = wx.StaticText(pnl, -1, label=label_0,
                                    size=(250, 44))
        self.rb1 = wx.RadioButton(pnl, label=label_1, style=wx.RB_GROUP)
        self.rb2 = wx.RadioButton(pnl, label=label_2)
        self.rb3 = wx.RadioButton(pnl, label=label_3)

        self.rb1.Bind(wx.EVT_RADIOBUTTON, self.on_set_val)
        self.rb2.Bind(wx.EVT_RADIOBUTTON, self.on_set_val)
        self.rb3.Bind(wx.EVT_RADIOBUTTON, self.on_set_val)
        self.state = [True, False, False]

        self.ok_1_Id = wx.NewId()
        self.cancel_1_Id = wx.NewId()
        self.ok_1 = wx.Button(pnl, id=self.ok_1_Id, label="Ok")
        self.ok_1.SetFont(font_update)
        self.ok_1.Bind(wx.EVT_BUTTON, self.on_ok)

        self.cancel_1 = wx.Button(pnl, id=self.cancel_1_Id, label="Cancel")
        self.cancel_1.SetFont(font_update)
        self.cancel_1.Bind(wx.EVT_BUTTON, self.on_close)

        label_txt_b = wx.StaticText(pnl, -1, label="",
                                    size=(200, 22))

        mastersizer = wx.BoxSizer(wx.VERTICAL)
        horizsizer = wx.BoxSizer(wx.HORIZONTAL)
        mastersizer.Add(label_txt_a, 0, wx.ALL, 5)
        mastersizer.Add(self.rb1, 0, wx.ALL, 5)
        mastersizer.Add(self.rb2, 0, wx.ALL, 5)
        mastersizer.Add(self.rb3, 0, wx.ALL, 5)
        mastersizer.Add(label_txt_b, 0, wx.ALL, 5)
        horizsizer.Add(self.ok_1, 0, wx.ALL, 5)
        horizsizer.Add(self.cancel_1, 0, wx.ALL, 5)
        mastersizer.Add(horizsizer, 0, wx.ALL, 5)

        pub.subscribe(self.on_open_window, pubsub_Open_GSA_Window)
#        self.Bind(wx.EVT_SIZE, self.OnSize)
        pnl.SetSizer(mastersizer)
        pnl.Layout()
        pnl.Fit()
Ejemplo n.º 6
0
    def __init__(self, parent):
        pos = wx.DefaultPosition
        size = (377, 282)
        if _platform == 'darwin':
            style = wx.DEFAULT_FRAME_STYLE
        else:
            style = (wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX
                     | wx.CLIP_CHILDREN | wx.FRAME_FLOAT_ON_PARENT)
        wx.Frame.__init__(self,
                          wx.GetApp().TopWindow, wx.ID_ANY,
                          p4R.Application_name + " - Strain and DW Values",
                          pos, size, style)
        self.Bind(wx.EVT_CLOSE, self.on_close)
        self.SetIcon(prog_icon.GetIcon())

        pnl = wx.Panel(self)

        def handleCellEditStarting(evt):
            currentCol = self.GetOLVColClicked(evt)
            if currentCol == 0:
                evt.Veto()

        def handleCellEditFinishing(evt):
            currentline = evt.rowIndex
            currentCol = self.GetOLVColClicked(evt)
            val = evt.cellValue
            self.update_param_dict(currentline, currentCol, val)

        self.list = ObjectListView(pnl,
                                   sortable=False,
                                   style=wx.LC_REPORT | wx.SUNKEN_BORDER,
                                   size=(450, 500))
        self.list.cellEditMode = ObjectListView.CELLEDIT_SINGLECLICK
        self.list.handleStandardKeys = False
        self.list.SetEmptyListMsg("This database has no rows")
        self.list.SetEmptyListMsgFont(
            wx.FFont(24, wx.DEFAULT, faceName="Tekton"))

        if _platform == "linux" or _platform == "linux2":
            self.width_name = 120
        else:
            self.width_name = 80
        self.width = 70
        self.widthCheck = 25
        self.col2checkstatus = {1: 0, 2: 0}

        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected, self.list)
        self.Bind(wx.EVT_LIST_COL_CLICK, self.OnItemSelected, self.list)
        self.list.Bind(EVT_CELL_EDIT_STARTING, handleCellEditStarting)
        self.list.Bind(EVT_CELL_EDIT_FINISHING, handleCellEditFinishing)

        mastersizer = wx.BoxSizer(wx.HORIZONTAL)
        mastersizer.Add(self.list, 0, wx.ALL | wx.EXPAND, 5)

        pub.subscribe(self.on_fill_list, pubsub_Fill_List_coef)
        pub.subscribe(self.on_open_window, pubsub_Open_data_coef_Window)

        #        self.Bind(wx.EVT_SIZE, self.OnSize)
        pnl.SetSizer(mastersizer)
        pnl.Layout()
        pnl.Fit()
        self.InitializeList()
Ejemplo n.º 7
0
    def __init__(self, parent):
        pos = wx.DefaultPosition
        size = (615, 527)
        style = (wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | wx.CLIP_CHILDREN
                 | wx.FRAME_FLOAT_ON_PARENT)
        wx.Frame.__init__(self,
                          wx.GetApp().TopWindow, wx.ID_ANY,
                          p4R.Application_name + " - Fitting report", pos,
                          size, style)
        self.Bind(wx.EVT_CLOSE, self.on_close)

        self.SetIcon(prog_icon.GetIcon())
        if _platform == "linux" or _platform == "linux2":
            font_update = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
            font_title = wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        elif _platform == "win32":
            font_update = wx.Font(9, wx.DEFAULT, wx.NORMAL, wx.BOLD)
            font_title = wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        elif _platform == 'darwin':
            font_update = wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD)
            font_title = wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD)

        flagSizer = wx.ALIGN_CENTER | wx.LEFT

        pnl = wx.Panel(self)
        self.mastersizer = wx.GridBagSizer(hgap=4, vgap=3)

        label_0 = "Lmfit Leastsq fit report"
        label_txt = wx.StaticText(pnl, -1, label=label_0, size=(230, 44))
        label_txt.SetFont(font_title)

        self.label_1_a = "Success"
        self.label_1_a_txt = wx.StaticText(pnl,
                                           -1,
                                           label=self.label_1_a,
                                           size=(80, 44))
        self.label_1_a_txt.SetFont(font_update)
        l1 = wx.StaticLine(pnl, size=(3, 20), style=wx.LI_VERTICAL)

        self.label_1_b_txt = wx.StaticText(pnl, -1, label="", size=(250, 44))

        self.label_2_a = "Message"
        self.label_2_a_txt = wx.StaticText(pnl,
                                           -1,
                                           label=self.label_2_a,
                                           size=(80, 44))
        self.label_2_a_txt.SetFont(font_update)
        l2 = wx.StaticLine(pnl, size=(3, 20), style=wx.LI_VERTICAL)

        self.label_2_b_txt = wx.StaticText(pnl, -1, label="", size=(250, 44))

        self.label_3_a = "Ier"
        self.label_3_a_txt = wx.StaticText(pnl,
                                           -1,
                                           label=self.label_3_a,
                                           size=(80, 44))
        self.label_3_a_txt.SetFont(font_update)
        l3 = wx.StaticLine(pnl, size=(3, 20), style=wx.LI_VERTICAL)

        self.label_3_b_txt = wx.StaticText(pnl, -1, label="", size=(250, 44))

        l4 = wx.StaticLine(pnl, size=(3, 20), style=wx.LI_VERTICAL)
        label_3_c = "1, 2, 3 or 4, the solution was found"
        self.label_3_c_txt = wx.StaticText(pnl,
                                           -1,
                                           label=label_3_c,
                                           size=(250, 44))

        self._logFileContents = wx.TextCtrl(pnl,
                                            wx.ID_ANY,
                                            size=(600, 300),
                                            style=wx.TE_MULTILINE
                                            | wx.TE_READONLY | wx.VSCROLL)

        self.Textcontrol = [
            self.label_1_b_txt, self.label_2_b_txt, self.label_3_b_txt
        ]

        self.mastersizer.Add(label_txt,
                             pos=(0, 1),
                             span=(1, 2),
                             flag=wx.ALIGN_LEFT,
                             border=5)
        self.mastersizer.Add(self.label_1_a_txt,
                             pos=(1, 0),
                             flag=flagSizer,
                             border=10)
        self.mastersizer.Add(l1, pos=(1, 1))
        self.mastersizer.Add(self.label_1_b_txt, pos=(1, 2), flag=flagSizer)

        self.mastersizer.Add(self.label_2_a_txt,
                             pos=(2, 0),
                             flag=flagSizer,
                             border=10)
        self.mastersizer.Add(l2, pos=(2, 1))
        self.mastersizer.Add(self.label_2_b_txt,
                             pos=(2, 2),
                             span=(1, 2),
                             flag=flagSizer)

        self.mastersizer.Add(self.label_3_a_txt,
                             pos=(3, 0),
                             flag=flagSizer,
                             border=10)
        self.mastersizer.Add(l3, pos=(3, 1))
        self.mastersizer.Add(self.label_3_b_txt, pos=(3, 2), flag=flagSizer)
        self.mastersizer.Add(l4, pos=(3, 3))
        self.mastersizer.Add(self.label_3_c_txt, pos=(3, 4), flag=flagSizer)
        self.mastersizer.Add(self._logFileContents,
                             pos=(4, 0),
                             span=(1, 5),
                             flag=flagSizer)

        pub.subscribe(self.on_open_window, pubsub_Open_FitReport_Window)
        pub.subscribe(self.on_fill_report, pubsub_Open_FitReport_Window)
        #        self.Bind(wx.EVT_SIZE, self.OnSize)
        pnl.SetSizer(self.mastersizer)
        pnl.Layout()
        pnl.Fit()