def __init__(self, *args, **kwargs):
     """Initializer.
     """
     InspectorPage.__init__(self, *args, **kwargs)
     # path text.
     path_label = wx.StaticText(self, -1, 'Path')
     path_text = wx.TextCtrl(self, -1, style=wx.TE_READONLY)
     # attributes grid.
     attr_label = wx.StaticText(self, -1, 'Attributes')
     attr_grid = Grid(self, -1, size=(-1, 100))
     attr_grid.CreateGrid(0, 2)
     attr_grid.SetColLabelValue(0, 'Key')
     attr_grid.SetColLabelValue(1, 'Value')
     attr_grid.EnableEditing(False)
     # values (for datasets) grid.
     vals_label = wx.StaticText(self, -1, 'Values')
     vals_grid = Grid(self, -1)
     vals_grid.CreateGrid(0, 0)
     vals_grid.EnableEditing(False)
     self.sizer.Add(path_label, 0, wx.ALL | wx.EXPAND, 5)
     self.sizer.Add(path_text, 0, wx.ALL | wx.EXPAND, 5)
     self.sizer.Add(attr_label, 0, wx.ALL | wx.EXPAND, 5)
     self.sizer.Add(attr_grid, 0, wx.ALL | wx.EXPAND, 5)
     self.sizer.Add(vals_label, 0, wx.ALL | wx.EXPAND, 5)
     self.sizer.Add(vals_grid, 1, wx.ALL | wx.EXPAND, 5)
     self.path_text = path_text
     self.attr_grid = attr_grid
     self.vals_grid = vals_grid
示例#2
0
    def __init__(self):
        wx.Dialog.__init__(self, None, -1, "Mini Excel")
        sizer = wx.BoxSizer(wx.VERTICAL)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        hsizer.Add(wx.StaticText(self, -1, "Value:"), 0,
                   wx.ALIGN_CENTER_VERTICAL)
        self.cell_value = wx.TextCtrl(self, -1)
        hsizer.Add(self.cell_value, 1, wx.EXPAND)
        b = wx.Button(self, -1, "&Set")
        self.Bind(wx.EVT_BUTTON, self.OnSetCell, b)
        hsizer.Add(b)
        sizer.Add(hsizer, 0, wx.EXPAND)

        grid = Grid(self)
        grid.SetTable(Table())
        grid.ForceRefresh()
        self.grid = grid

        self.Bind(EVT_GRID_CELL_LEFT_CLICK, self.OnCellClick, grid)
        self.current_cell = (0, 0)

        sizer.Add(grid, 1, wx.EXPAND)
        self.SetSizer(sizer)
        sizer.Fit(self)
        grid.SetFocus()

        self.CenterOnScreen()
示例#3
0
 def init_grid(panel):
     grid_box = wx.BoxSizer(wx.VERTICAL)
     title = wx.StaticText(panel, -1, "Grid")
     data_grid = Grid(panel, -1, size=(700, -1))
     data_grid.SetTable(GlobalVariable.grid_data)
     data_grid.AdjustScrollbars()
     data_grid.EnableEditing(False)  # 设置数据无法修改
     data_grid.SetRowLabelSize(40)
     data_grid.SetColLabelSize(20)
     data_grid.DisableDragRowSize()  # 设置无法拖动修改行高
     data_grid.SetSelectionMode(Grid.wxGridSelectRows)  # 设置整行选取模式
     data_grid.Refresh()
     data_grid.Bind(grid.EVT_GRID_CELL_RIGHT_DCLICK, self.copy_line)
     button_box = wx.BoxSizer(wx.HORIZONTAL)
     previous_button = wx.Button(panel, -1, '<', size=(-1, -1))
     next_button = wx.Button(panel, -1, '>', size=(-1, -1))
     self.Bind(wx.EVT_BUTTON, self.__on_previous, previous_button)
     self.Bind(wx.EVT_BUTTON, self.__on_next, next_button)
     button_box.Add(previous_button)
     button_box.Add(next_button)
     grid_box.Add(title, 0)
     grid_box.Add(data_grid, 1,
                  wx.EXPAND | wx.TOP | wx.RIGHT | wx.BOTTOM, 5)
     grid_box.Add(button_box, 0, wx.EXPAND | wx.BOTTOM, 5)
     return data_grid, grid_box
示例#4
0
    def __init__(self, parent, id, title):
        self.dao = self.init_db()
        self.read_records = 0
        constraint = Constraints()
        constraint.offset = 0
        constraint.limit = 100

        # First, call the base class' __init__ method to create the frame
        wx.Frame.__init__(self, parent, id, title, wx.Point(100, 100),
                          wx.Size(300, 200))

        # Associate some events with methods of this class
        wx.EVT_SIZE(self, self.OnSize)
        #wx.EVT_SCROLLWIN_BOTTOM(self, self.OnEndScroll)

        # Add a panel and some controls to display the size and position
        panel = wx.Panel(self, -1)
        panel.SetBackgroundColour('#FDDF99')

        self.grid = Grid(panel)
        self.grid.CreateGrid(0, 12)
        wx.grid.EVT_GRID_CELL_LEFT_CLICK(self, self.OnGridLeftClick)
        #wx.EVT_SCROLLWIN_BOTTOM(self.grid, self.OnEndScroll)
        self.grid.Bind(wx.EVT_SCROLLWIN, self.OnEndScroll)

        #self.grid.SetCellBackgroundColour(2, 2, wx.CYAN)

        #self.grid.SetCellEditor(5, 0, wx.grid.GridCellNumberEditor(1,1000))
        #self.grid.SetCellValue(5, 0, "123")

        #self.grid.SetCellAlignment(9, 1, wx.ALIGN_CENTRE, wx.ALIGN_CENTRE)
        #self.grid.SetCellValue(9, 1, "This cell is set to span 3 rows and 3 columns")

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.grid, 1, wx.EXPAND)
        panel.SetSizer(sizer)

        #self.grid.ClearGrid()
        ##self.grid.AppendRows(20)
        #self.grid.SetColLabelValue(0,"test")
        #self.grid.SetCellValue(21, 1, "This cell is set to span 3 rows and 3 columns")

        rows = self.dao.fetch_records(constraint,
                                      raw_answers=True,
                                      record_type_classname=AutosModel)
        self.read_records = len(rows)

        print(rows[0])
        #print(rows[7]["marca"])
        #print(rows[7]["modelo"])
        #print(rows[7]["version"])

        self.printRows(rows)
示例#5
0
文件: wistool.py 项目: peicer/wistool
    def createchannelwin(self,chn):
        newspwin=wx.SplitterWindow(self.channelwin,wx.ID_ANY,style=wx.SP_3DBORDER|wx.SP_3DSASH|wx.NO_BORDER)
        xgrid=Grid(newspwin,wx.ID_ANY,style=wx.SUNKEN_BORDER)
        xgrid.SetRowLabelSize(0)
        xtable=CustomDataTable()
        xtable.colLabels=['深度',chn]
        xx,yy=self.wish.readchannel(chn)
        self.actch_data=(xx,yy)
        xtable.data=list(zip(xx[:500],yy[:500]))
        xgrid.SetTable(xtable,True)
        xgrid.ForceRefresh()
        
        
        xpan=wx.Panel(newspwin,wx.ID_ANY,style=wx.SUNKEN_BORDER)
        self.toolb.SetToolShortHelp(200,u'保存曲线数据['+chn+']')
        mpl=PlotExample(xpan,(400,4000))
        mpl.plot(yy, xx)
#         mpl.Show()
        
#         MPL=MPL_Panel_base(xpan,(400,4000))
#         
#         #MPL.Figure.set_figheight(20)
#         #MPL.set_psize(500, 3000)
#         #MPL.xticker(10.0,2.0)
        BoxSizer=wx.BoxSizer(wx.VERTICAL) 
        BoxSizer.Add(mpl,proportion =1, border = 1,flag = wx.ALL|wx.EXPAND)
        xpan.SetSizer(BoxSizer)
        xpan.Fit()
#         MPL.cla()
#         MPL.plot(yy,xx,'red')
#         MPL.yticker(50.0, 25.0)
#         MPL.xticker(10, 5)
#         MPL.xlim(50,150)
#         MPL.ylim(4000, 1000)
#         MPL.grid()
#         dd=MPL.pl.gca().xaxis
        #dd.set_label_position('top')
#         MPL.UpdatePlot()

        #MPL.Update()
        #wx.StaticText(xpan, -1, chn, (5,5))
        
        newspwin.SetMinimumPaneSize(20)
        newspwin.SplitVertically(xgrid, xpan, 180)
        old=self.channelwin.GetWindow2()
        self.channelwin.ReplaceWindow(old,newspwin)
        old.Destroy()
        newspwin.Show(True)
示例#6
0
    def run_as_data_tool(self, workspace):
        m = workspace.measurements
        assert isinstance(m, cpmeas.Measurements)
        m.is_first_image = True
        image_set_count = m.image_set_count
        for i in range(image_set_count):
            self.run(workspace)
            img_stats = workspace.display_data.statistics
            if i == 0:
                header = ["Image set"]
                for flag_name, object_name, feature, value, pf in img_stats:
                    header.append(flag_name)
                header.append("Pass/Fail")
                statistics = [header]
            row = [str(i + 1)]
            ok = True
            for flag_name, object_name, feature, value, pf in img_stats:
                ok = ok and (pf == "Pass")
                row.append(str(value))
            row.append("Pass" if ok else "Fail")
            statistics.append(row)
            if i < image_set_count - 1:
                m.next_image_set()
        self.show_window = False
        if image_set_count > 0:
            import wx
            from wx.grid import Grid, PyGridTableBase, EVT_GRID_LABEL_LEFT_CLICK
            from cellprofiler.gui import get_cp_icon

            frame = wx.Frame(workspace.frame, -1, "Flag image results")
            sizer = wx.BoxSizer(wx.VERTICAL)
            frame.SetSizer(sizer)
            grid = Grid(frame, -1)
            sizer.Add(grid, 1, wx.EXPAND)
            #
            # The flag table supplies the statistics to the grid
            # using the grid table interface
            #
            sort_order = np.arange(len(statistics) - 1)
            sort_col = [None]
            sort_ascending = [None]

            def on_label_clicked(event):
                col = event.GetCol()
                if sort_col[0] == col:
                    sort_ascending[0] = not sort_ascending[0]
                else:
                    sort_ascending[0] = True
                sort_col[0] = col
                data = [x[col] for x in statistics[1:]]
                try:
                    data = np.array(data, float)
                except ValueError:
                    data = np.array(data)
                if sort_ascending[0]:
                    sort_order[:] = np.lexsort((data, ))
                else:
                    sort_order[::-1] = np.lexsort((data, ))
                grid.ForceRefresh()

            grid.Bind(EVT_GRID_LABEL_LEFT_CLICK, on_label_clicked)

            class FlagTable(PyGridTableBase):
                def __init__(self):
                    PyGridTableBase.__init__(self)

                def GetColLabelValue(self, col):
                    if col == sort_col[0]:
                        if sort_ascending[0]:

                            return statistics[0][col] + " v"
                        else:
                            return statistics[0][col] + " ^"
                    return statistics[0][col]

                def GetNumberRows(self):
                    return len(statistics) - 1

                def GetNumberCols(self):
                    return len(statistics[0])

                def GetValue(self, row, col):
                    return statistics[sort_order[row] + 1][col]

            grid.SetTable(FlagTable())
            frame.Fit()
            max_size = int(
                wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y) * 3 / 4)
            if frame.Size[1] > max_size:
                frame.SetSize((frame.Size[0], max_size))
            frame.SetIcon(get_cp_icon())
            frame.Show()
示例#7
0
    def __init__(self, parent, model):
        wx.Dialog.__init__(self,
                           parent,
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
                           | wx.MAXIMIZE_BOX)
        vbox = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(vbox)
        self.SetTitle('Statistical Analysis of Parameters')

        dpi_scale_factor = wx.GetApp().dpi_scale_factor

        self.ptxt = wx.StaticText(self, label="...")
        self.pbar = wx.Gauge(self, range=1000)

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        vbox.Add(hbox, proportion=1, flag=wx.EXPAND)

        lpanel = wx.Panel(self)
        gpanel = wx.Panel(self)
        gbox = wx.BoxSizer(wx.VERTICAL)
        gpanel.SetSizer(gbox)
        self.grid = Grid(gpanel)
        gbox.Add(wx.StaticText(gpanel, label='Estimated covariance matrix:'),
                 proportion=0,
                 flag=wx.FIXED_MINSIZE)
        gbox.Add(self.grid, proportion=1, flag=wx.EXPAND)
        self.normalize_checkbox = wx.CheckBox(
            gpanel, label='Normalize value (σ_ij/σ_i/σ_j)')
        self.normalize_checkbox.SetValue(True)
        self.normalize_checkbox.Bind(wx.EVT_CHECKBOX, self.OnToggleNormalize)
        gbox.Add(self.normalize_checkbox, proportion=0, flag=wx.FIXED_MINSIZE)

        nfparams = len([pi for pi in model.parameters if pi.fit])
        self.grid.CreateGrid(nfparams + 1, nfparams)
        self.grid.SetColLabelTextOrientation(wx.VERTICAL)
        self.grid.SetColLabelSize(int(dpi_scale_factor * 80))
        for i in range(nfparams):
            self.grid.SetRowSize(i, int(dpi_scale_factor * 80))
            self.grid.SetColSize(i, int(dpi_scale_factor * 80))
            self.grid.SetColLabelValue(i, '%i' % i)
            self.grid.SetRowLabelValue(i + 1, '%i' % i)
        self.grid.SetRowSize(nfparams, int(dpi_scale_factor * 80))
        self.grid.DisableCellEditControl()
        self.grid.SetMinSize(
            (int(dpi_scale_factor * 200), int(dpi_scale_factor * 200)))
        self.grid.Bind(EVT_GRID_CELL_LEFT_DCLICK, self.OnSelectCell)
        rpanel = PlotPanel(self)
        rpanel.SetMinSize(
            (int(dpi_scale_factor * 200), int(dpi_scale_factor * 200)))
        self.plot_panel = rpanel
        self.ax = rpanel.figure.add_subplot(111)

        hbox.Add(lpanel, proportion=0, flag=wx.EXPAND | wx.ALIGN_TOP)
        hbox.Add(gpanel, proportion=1, flag=wx.EXPAND)
        hbox.Add(rpanel, proportion=1, flag=wx.EXPAND)

        lsizer = wx.GridSizer(vgap=1, hgap=2, cols=2)
        lpanel.SetSizer(lsizer)
        self.entries = {}
        for key, emin, emax, val in [('pop', 1, 20 * nfparams, 2 * nfparams),
                                     ('samples', 1000, 10000000, 10000),
                                     ('burn', 0, 10000, 200)]:
            lsizer.Add(wx.StaticText(lpanel, label='%s:' % key),
                       flag=wx.FIXED_MINSIZE)
            self.entries[key] = wx.SpinCtrl(lpanel,
                                            wx.ID_ANY,
                                            min=emin,
                                            max=emax,
                                            value=str(val))
            lsizer.Add(self.entries[key], flag=wx.FIXED_MINSIZE)

        lsizer.AddStretchSpacer(10)
        but = wx.Button(self, label='Run Analysis...')
        vbox.Add(but)
        vbox.Add(self.ptxt, proportion=0, flag=wx.EXPAND)
        vbox.Add(self.pbar, proportion=0, flag=wx.EXPAND)

        self.Bind(wx.EVT_BUTTON, self.OnRunAnalysis, but)
        self.Bind(wx.EVT_CLOSE, self.OnClose)

        self.model = model
        self.thread = None

        psize = parent.GetSize()
        self.SetSize(int(psize.GetWidth() * 0.75),
                     int(psize.GetHeight() * 0.75))
示例#8
0
    def __init__(self, parent, title, processed_payments, output_file_loc):
        wx.Frame.__init__(self, parent, title=title,
                          size=GUIUtils.calculate_window_size())

        self.margin_to_frame_edge = 25
        self.column_width = len(
            self.get_object_attrs_not_abstract(processed_payments))
        self.processed_payments = processed_payments
        self.attr_column_mapping = {}
        self.output_file_loc = output_file_loc

        self.title_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.title = wx.StaticText(
            self, -1,
            style=wx.ALIGN_CENTER
        )
        self.title.SetLabelMarkup(
            "<span size=\"xx-large\" weight=\"bold\">"
            "Checking Window</span>")
        self.title_sizer.Add(self.title, 1, wx.EXPAND,
                             self.margin_to_frame_edge)
        self.title_sizer.SetMinSize(100, 50)

        # Build up the grid to display the data
        self.grid_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.grid = Grid(self, -1)

        self.grid.CreateGrid(len(processed_payments), self.column_width)
        self.grid_sizer.Add(self.grid, wx.EXPAND)

        for col_id, attribute in enumerate(self.get_object_attrs_not_abstract(
                processed_payments)):
            self.grid.SetColLabelValue(col_id, processed_payments[0].__dict__[attribute].name)
            self.attr_column_mapping[attribute] = \
                (col_id, processed_payments[0].__dict__[attribute].name)

        for row_id, payment in enumerate(processed_payments):
            for col_id, attribute in enumerate(self.get_object_attrs_not_abstract(
                    processed_payments)):
                if isinstance(payment.__dict__[attribute].value, datetime):
                    self.grid.SetCellValue(
                        row_id, col_id,
                        payment.__dict__[attribute].value.strftime("%d/%m/%Y"))
                else:
                    self.grid.SetCellValue(
                        row_id, col_id, payment.__dict__[attribute].value)
                if isinstance(payment.__dict__[attribute].value, str) and \
                        re.match(r"X{6,14}", payment.__dict__[attribute].value):
                    for col_col_id, _ in enumerate(self.get_object_attrs_not_abstract(
                    processed_payments)):
                        self.grid.SetCellBackgroundColour(
                            row_id, col_col_id,
                            wx.Colour(238, 210, 2, wx.ALPHA_OPAQUE))
                elif not payment.__dict__[attribute].user_editable:
                    self.grid.SetReadOnly(row_id, col_id)

        self.grid.AutoSize()

        # Create a Confirm Button
        self.confirm_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.confirm_button = wx.Button(self, label="Confirm")
        self.confirm_button.Bind(wx.EVT_BUTTON, self.confirm)
        self.confirm_sizer.Add(self.confirm_button, 1, wx.EXPAND|wx.ALL,
                               self.margin_to_frame_edge)
        self.confirm_sizer.SetMinSize(100, 50)

        # Set up the base sizers

        self.base_sizer = wx.BoxSizer(wx.VERTICAL)
        self.base_sizer.Add(self.title_sizer, 1, wx.EXPAND|wx.ALL,
                            self.margin_to_frame_edge)
        self.base_sizer.Add(self.grid_sizer, 5,
                            wx.EXPAND|wx.LEFT|wx.RIGHT,
                            self.margin_to_frame_edge)
        self.base_sizer.Add(self.confirm_sizer, 0.5 , wx.EXPAND|wx.ALL,
        self.margin_to_frame_edge)
        # Layout sizers
        self.SetSizer(self.base_sizer)
        self.SetAutoLayout(1)
        self.base_sizer.Fit(self)
        self.Show()
示例#9
0
    def __init__(self, graph, settings):
        wx.Panel.__init__(self, graph)

        self.spectrum = None
        self.graph = graph
        self.settings = settings

        self.measure = None

        self.checked = {Measure.MIN: "",
                        Measure.MAX: "",
                        Measure.AVG: "",
                        Measure.GMEAN: "",
                        Measure.HBW: "",
                        Measure.OBW: ""}

        self.selected = None

        self.SetBackgroundColour('white')

        self.grid = Grid(self)
        self.grid.CreateGrid(3, 19)
        self.grid.EnableEditing(True)
        self.grid.EnableDragGridSize(False)
        self.grid.SetColLabelSize(1)
        self.grid.SetRowLabelSize(1)
        self.grid.SetColMinimalAcceptableWidth(1)
        self.grid.SetColSize(2, 1)
        self.grid.SetColSize(7, 1)
        self.grid.SetColSize(11, 1)
        self.grid.SetColSize(15, 1)
        self.grid.SetMargins(0, wx.SystemSettings.GetMetric(wx.SYS_HSCROLL_Y))

        for x in range(self.grid.GetNumberRows()):
            self.grid.SetRowLabelValue(x, '')
        for y in range(self.grid.GetNumberCols()):
            self.grid.SetColLabelValue(y, '')

        for row in range(self.grid.GetNumberRows()):
            for col in range(self.grid.GetNumberCols()):
                self.grid.SetReadOnly(row, col, True)

        self.locsDesc = {'F Start': (0, 0),
                         'F End': (1, 0),
                         'F Delta': (2, 0),
                         'P Min': (0, 4),
                         'P Max': (1, 4),
                         'P Delta': (2, 4),
                         'Mean': (0, 9),
                         'GMean': (1, 9),
                         'Flatness': (2, 9),
                         '-3dB Start': (0, 13),
                         '-3dB End': (1, 13),
                         '-3dB Delta': (2, 13),
                         'OBW Start': (0, 17),
                         'OBW End': (1, 17),
                         'OBW Delta': (2, 17)}
        self.__set_descs()

        self.locsCheck = {Measure.MIN: (0, 3), Measure.MAX: (1, 3),
                          Measure.AVG: (0, 8), Measure.GMEAN: (1, 8),
                          Measure.HBW: (0, 12),
                          Measure.OBW: (0, 16)}
        self.__set_check_editor()

        self.locsFreq = [(0, 1), (1, 1)]
        self.__set_freq_editor()

        colour = self.grid.GetBackgroundColour()
        self.grid.SetCellTextColour(2, 3, colour)
        self.grid.SetCellTextColour(2, 8, colour)
        self.grid.SetCellTextColour(1, 12, colour)
        self.grid.SetCellTextColour(2, 12, colour)
        self.grid.SetCellTextColour(1, 16, colour)
        self.grid.SetCellTextColour(2, 16, colour)

        self.__clear_checks()

        self.locsMeasure = {'start': (0, 1), 'end': (1, 1), 'deltaF': (2, 1),
                            'minFP': (0, 5), 'maxFP': (1, 5), 'deltaFP': (2, 5),
                            'minP': (0, 6), 'maxP': (1, 6), 'deltaP': (2, 6),
                            'avg': (0, 10), 'gmean': (1, 10), 'flat': (2, 10),
                            'hbwstart': (0, 14), 'hbwend': (1, 14), 'hbwdelta': (2, 14),
                            'obwstart': (0, 18), 'obwend': (1, 18), 'obwdelta': (2, 18)}

        fontCell = self.grid.GetDefaultCellFont()
        fontSize = fontCell.GetPointSize()
        fontStyle = fontCell.GetStyle()
        fontWeight = fontCell.GetWeight()
        font = wx.Font(fontSize, wx.FONTFAMILY_MODERN, fontStyle,
                       fontWeight)
        dc = wx.WindowDC(self.grid)
        dc.SetFont(font)
        widthMHz = dc.GetTextExtent('###.######')[0] * 1.2
        widthdB = dc.GetTextExtent('-##.##')[0] * 1.2
        for _desc, (_row, col) in self.locsDesc.items():
            self.grid.AutoSizeColumn(col)
        for col in [1, 5, 14, 18]:
            self.grid.SetColSize(col, widthMHz)
            for row in range(self.grid.GetNumberRows()):
                self.grid.SetCellFont(row, col, font)
        for col in [6, 10]:
            self.grid.SetColSize(col, widthdB)
            for row in range(self.grid.GetNumberRows()):
                self.grid.SetCellFont(row, col, font)
        for _desc, (_row, col) in self.locsCheck.items():
            self.grid.AutoSizeColumn(col)

        toolTips = {self.locsMeasure['start']: 'Selection start (MHz)', self.locsMeasure['end']: 'Selection end (MHz)',
                    self.locsMeasure['deltaF']: 'Selection bandwidth (MHz)',
                    self.locsMeasure['minFP']: 'Minimum power location (MHz)',
                    self.locsMeasure['maxFP']: 'Maximum power location (MHz)',
                    self.locsMeasure['deltaFP']: 'Power location difference (MHz)',
                    self.locsMeasure['minP']: 'Minimum power (dB)', self.locsMeasure['maxP']: 'Maximum power (dB)',
                    self.locsMeasure['deltaP']: 'Power difference (dB)', self.locsMeasure['avg']: 'Mean power (dB)',
                    self.locsMeasure['gmean']: 'Geometric mean power (dB)',
                    self.locsMeasure['flat']: 'Spectral flatness',
                    self.locsMeasure['hbwstart']: '-3db start location (MHz)',
                    self.locsMeasure['hbwend']: '-3db end location (MHz)',
                    self.locsMeasure['hbwdelta']: '-3db bandwidth (MHz)',
                    self.locsMeasure['obwstart']: '99% start location (MHz)',
                    self.locsMeasure['obwend']: '99% end location (MHz)',
                    self.locsMeasure['obwdelta']: '99% bandwidth (MHz)'}

        self.toolTips = GridToolTips(self.grid, toolTips)

        self.popupMenu = wx.Menu()
        self.popupMenuCopy = self.popupMenu.Append(wx.ID_ANY, "&Copy",
                                                   "Copy entry")
        self.Bind(wx.EVT_MENU, self.__on_copy, self.popupMenuCopy)

        self.Bind(EVT_GRID_CELL_RIGHT_CLICK, self.__on_popup_menu)
        self.Bind(EVT_GRID_CELL_LEFT_CLICK, self.__on_cell_click)
        if wx.VERSION >= (3, 0, 0, 0):
            self.Bind(EVT_GRID_CELL_CHANGED, self.__on_cell_change)

        box = wx.BoxSizer(wx.VERTICAL)
        box.Add(self.grid, 0, wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT,
                border=10)
        self.SetSizer(box)
示例#10
0
    def __init__(self, parent):
        Panel.__init__(self, parent)

        grid = Grid(self)

        grid.CreateGrid(0, _TOTAL_COLS)

        grid.HideRowLabels()  # Hide the index column
        grid.EnableGridLines(False)  # Hide grid lines
        grid.DisableDragGridSize(
        )  # Disable resizing of rows/columns by dragging
        grid.DisableDragColMove()  # Disable reordering of columns by dragging
        grid.SetCellHighlightPenWidth(
            0)  # Disable the highlight around the "current" cell
        grid.SetCellHighlightROPenWidth(
            0)  # Disable the highlight around the "current" read-only cell
        grid.SetSelectionMode(wx.grid.Grid.SelectRows)  # Select the entire row

        grid.SetColLabelValue(_SHIP_COL, "Ship")
        grid.SetColLabelValue(_FIT_COL, "Fit")
        grid.SetColLabelValue(_POINTS_COL, "Points")
        grid.SetColLabelValue(_EHP_COL, "EHP")
        grid.SetColLabelValue(_DPS_COL, "DPS")
        grid.SetColLabelValue(_TANK_COL, "Tank")
        grid.SetColLabelValue(_ACTIVE_COL, "Active?")

        grid.SetColFormatBool(_ACTIVE_COL)

        grid.Bind(wx.grid.EVT_GRID_CELL_CHANGING, self._onCellChanging)
        grid.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK, self._showContextMenu)
        grid.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self._onCellLeftClick)
        grid.Bind(wx.grid.EVT_GRID_CELL_LEFT_DCLICK,
                  self._onCellDoubleLeftClick)
        gui.mainFrame.MainFrame.getInstance().Bind(GE.FIT_CHANGED,
                                                   self._onFitChanged)

        shipCountLabel = wx.StaticText(self)
        pointCountLabel = wx.StaticText(self)
        dpsLabel = wx.StaticText(self)
        ehpLabel = wx.StaticText(self)

        infoPanelSizer = wx.FlexGridSizer(4, 0, 16)
        infoPanelSizer.Add(wx.StaticText(self, label="Ships"),
                           flag=wx.ALIGN_CENTER)
        infoPanelSizer.Add(wx.StaticText(self, label="Points"),
                           flag=wx.ALIGN_CENTER)
        infoPanelSizer.Add(wx.StaticText(self, label="Total DPS"),
                           flag=wx.ALIGN_CENTER)
        infoPanelSizer.Add(wx.StaticText(self, label="Total EHP"),
                           flag=wx.ALIGN_CENTER)
        infoPanelSizer.Add(shipCountLabel, flag=wx.ALIGN_CENTER)
        infoPanelSizer.Add(pointCountLabel, flag=wx.ALIGN_CENTER)
        infoPanelSizer.Add(dpsLabel, flag=wx.ALIGN_CENTER)
        infoPanelSizer.Add(ehpLabel, flag=wx.ALIGN_CENTER)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(grid, 1, wx.EXPAND)
        sizer.Add(infoPanelSizer, 0, wx.EXPAND | wx.ALL, border=8)
        self.SetSizer(sizer)

        self._grid = grid
        self.shipCountLabel = shipCountLabel
        self.pointCountLabel = pointCountLabel
        self.dpsLabel = dpsLabel
        self.ehpLabel = ehpLabel
        self._setup: Setup = None
示例#11
0
    def __init__(self, parent, id):
        wx.Panel.__init__(self, parent, id)

        # Top Sizer
        topSizer = wx.BoxSizer(wx.VERTICAL)

        # Input Label
        labelSizer = wx.BoxSizer(wx.HORIZONTAL)
        self.inputLabel = wx.StaticText(self, -1, data.enterPadyamLabel,
                                        wx.Point(40, 20), wx.Size(720, 20))
        self.increaseFontSize(self.inputLabel, 1.5)
        labelSizer.Add(self.inputLabel, 1, wx.EXPAND | wx.ALL, 5)
        topSizer.Add(labelSizer, 0, wx.ALIGN_LEFT)

        # Input Multiline TextCtrl
        self.input = wx.TextCtrl(self, 5, '', wx.Point(40, 50),
                                 wx.Size(720, 140),
                                 wx.TE_MULTILINE | wx.TE_DONTWRAP)
        self.increaseFontSize(self.input, 1.5)
        topSizer.Add(self.input, 1, wx.EXPAND | wx.ALL, 5)

        # Output Label
        labelSizer1 = wx.BoxSizer(wx.HORIZONTAL)
        self.outputLabel = wx.StaticText(self, -1, data.seeResultsHereLabel,
                                         wx.Point(40, 20), wx.Size(720, 20))
        self.increaseFontSize(self.outputLabel, 1.5)
        labelSizer1.Add(self.outputLabel, 1, wx.EXPAND | wx.ALL, 5)
        topSizer.Add(labelSizer1, 0, wx.ALIGN_LEFT)

        # Output Multiline Grid
        self.output = Grid(self, 6, wx.Point(40, 210), wx.Size(790, 140),
                           wx.TE_MULTILINE | wx.TE_READONLY)
        self.output.SetDefaultRowSize(25)
        self.output.SetDefaultColSize(50)
        self.output.SetRowLabelSize(0)
        self.output.SetColLabelSize(0)
        self.output.CreateGrid(10, 30)
        self.output.Bind(wx.grid.EVT_GRID_SELECT_CELL, self.evtOnCellSelected)
        topSizer.Add(self.output, 1, wx.EXPAND | wx.ALL, 5)

        # Control Sizer
        controlSizer = wx.BoxSizer(wx.HORIZONTAL)

        # Radio Box
        self.radioList = [data.findVruthamLabel, data.checkVruthamLabel]
        self.rb = wx.RadioBox(self, 50, data.whatToDoLabel, wx.Point(40, 375),
                              wx.Size(250, 90), self.radioList, 3,
                              wx.RA_SPECIFY_ROWS)
        self.increaseFontSize(self.rb, 1.5)
        controlSizer.Add(self.rb, 0, wx.ALL, 10)
        wx.EVT_RADIOBOX(self, 50, self.evtRadioBox)

        # Combobox
        self.vruthamList = data.vruthamNameList()
        self.vruthamCombo = wx.ComboBox(self, 30, data.selectVruthamLabel,
                                        wx.Point(420, 390), wx.Size(250, -1),
                                        self.vruthamList,
                                        wx.CB_DROPDOWN | wx.CB_READONLY)
        self.increaseFontSize(self.vruthamCombo, 1.5)
        controlSizer.Add(self.vruthamCombo, 0, wx.ALIGN_CENTER)
        wx.EVT_COMBOBOX(self, 30, self.evtComboBox)
        self.vruthamCombo.Enable(0)

        # Status TextCtrl
        self.status = wx.TextCtrl(self, 5, '', wx.DefaultPosition,
                                  wx.Size(250, 80),
                                  wx.TE_MULTILINE | wx.TE_READONLY)
        self.increaseFontSize(self.status, 1.5)
        self.status.SetBackgroundColour(
            wx.SystemSettings.GetColour(wx.SYS_COLOUR_SCROLLBAR))
        controlSizer.Add(self.status, 0, wx.EXPAND | wx.ALL, 15)

        topSizer.Add(controlSizer, 0, wx.ALIGN_CENTER)

        # Button Sizer
        buttonSizer = wx.BoxSizer(wx.HORIZONTAL)

        # Buttons
        self.goButton = wx.Button(self, 10, data.findLabel, wx.Point(379, 470),
                                  wx.Size(117, 35))
        self.increaseFontSize(self.goButton, 1.5)
        self.increaseFontWeight(self.goButton)
        wx.EVT_BUTTON(self, 10, self.goClick)
        buttonSizer.Add(self.goButton, 0, wx.ALL, 10)

        self.clearButton = wx.Button(self, 11, data.clearLabel,
                                     wx.Point(506, 470), wx.Size(117, 35))
        self.increaseFontSize(self.clearButton, 1.5)
        self.increaseFontWeight(self.clearButton)
        wx.EVT_BUTTON(self, 11, self.clearClick)
        buttonSizer.Add(self.clearButton, 0, wx.ALL, 10)

        self.closeButton = wx.Button(self, 12, data.closeLabel,
                                     wx.Point(633, 470), wx.Size(117, 35))
        self.increaseFontSize(self.closeButton, 1.5)
        self.increaseFontWeight(self.closeButton)
        wx.EVT_BUTTON(self, 12, self.closeClick)
        buttonSizer.Add(self.closeButton, 0, wx.ALL, 10)

        topSizer.Add(buttonSizer, 0, wx.ALIGN_CENTER)
        self.SetSizer(topSizer)
        topSizer.SetSizeHints(self)

        # Initialize Variables
        self.inVruthamName = ''
        self.checkVruthamFlg = 0
        self.checkFlgSet = 0
        self.dictErrors = {}