Пример #1
0
    def __init__(self, parent):
        wx.Frame.__init__(self,
                          parent,
                          -1,
                          "PROYECTO BASE DE DATOS ^u^",
                          size=(1090, 500))

        Panel = wx.Panel(self)
        Notebook = wx.Notebook(Panel)
        grid = SimpleGrid(Notebook)  #wx.Panel(Notebook)
        grid_1 = Diccionario_1(Notebook)
        page_1 = wx.Panel(Notebook)
        a = wx.StaticText(page_1, -1, "Aca sale el resultado <3")
        Notebook.AddPage(grid, "EMPLOYEES")
        Notebook.AddPage(grid_1, "DICCIONARIO")
        Notebook.AddPage(page_1, "RESULTADO")
        sizer = wx.BoxSizer()
        sizer.Add(Notebook, 1, wx.EXPAND)
        Panel.SetSizer(sizer)
        grid.AutoSize()
        grid.EnableEditing(False)
        grid.DisableDragGridSize()
        grid_1.AutoSize()
        grid_1.EnableEditing(False)
        grid_1.DisableDragGridSize()

        self.InitUI()
Пример #2
0
 def __init__(self, parent): 
    super(MyPanel1, self).__init__(parent) 
    #text = wx.TextCtrl(self, style = wx.TE_MULTILINE, size = (250,150)) 
    lbl1 = wx.StaticText(self, label="Position")#, pos=(0,0)
    grid = SimpleGrid(self)
    grid.AutoSize()
    grid.EnableEditing(False)
    grid.DisableDragGridSize()
Пример #3
0
    def __init__(self, window):
        # This is how Python handles classes. __init__ is the special name for
        # the constructor of the class. The first parameter to every object
        # method is the object itself, called "self" by convention. self is
        # like "this" in Java/C++, except you have to explicitly mention it
        # whenever you want to use instance variables or methods.
        grid = wx.grid.Grid(parent=window)
        grid.CreateGrid(sudoku.ROW_SIZE, sudoku.ROW_SIZE)

        # Set row and column sizes, and fix them so the user can't change them
        grid.SetRowLabelSize(0)
        grid.SetColLabelSize(0)
        grid.SetDefaultRowSize(40, True)
        grid.SetDefaultColSize(40, True)
        grid.DisableDragGridSize()

        # Change cell attributes to work well for Sudoku displaying
        font = grid.GetDefaultCellFont()
        font.SetPointSize(20)
        grid.SetDefaultCellFont(font)
        grid.SetDefaultCellAlignment(wx.ALIGN_CENTER, wx.ALIGN_CENTER)

        self.grid = grid
Пример #4
0
 def __init__(self, parent):
     wx.Frame.__init__(self, parent, -1, "A Grid", size=(275, 275))
     grid = SimpleGrid(self)
     grid.AutoSize()
     grid.EnableEditing(False)
     grid.DisableDragGridSize()
Пример #5
0
    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, title=title, size=(1100, 600))
        wx.Log.SetActiveTarget(wx.LogStderr())
        self.CenterOnScreen()
        self.CreateStatusBar()
        #		self.SetStatusText("This is the statusbar")

        #Initialising the MenuBar
        menuBar = wx.MenuBar()
        menu1 = wx.Menu()
        #		menu1.Append(101,"Paste\tCtrl+V")
        #		menu1.Append(102,"Copy\tCtrl+C")
        menu1.AppendSeparator()
        menu1.Append(103, "Quit\tCtrl+Q")
        self.Bind(wx.EVT_MENU, self.MenuClose, id=103)
        menuBar.Append(menu1, "File")
        self.SetMenuBar(menuBar)

        #Initialising the Graphical User Interface (GUI)
        Tabs = wx.Notebook(self, style=wx.BK_BOTTOM)

        panelA = wx.Window(Tabs, wx.ID_ANY)
        Tabs.AddPage(panelA, "Overview")
        browser = wx.html2.WebView.New(panelA)
        browser.LoadURL("file://" + globals.filepath + "/overview_frame.html")

        panelB = wx.Window(panelA, wx.ID_ANY)
        browser2 = wx.html2.WebView.New(panelB)
        browser2.LoadURL("file://" + globals.filepath + "/html/" +
                         "overview2.html")

        panelC = wx.Window(panelB, wx.ID_ANY)

        panelD = wx.Window(panelC, wx.ID_ANY)  #For all investment indicators
        panelE = wx.Window(panelC,
                           wx.ID_ANY)  #For 'Liqudity' and 'Total' indicators
        total = 0.0
        total_inv = 0.0
        panel_scrolled = wx.lib.scrolledpanel.ScrolledPanel(
            panelD,
            -1,
            style=wx.TAB_TRAVERSAL | wx.SUNKEN_BORDER,
            name="panel1")
        fgs1 = wx.FlexGridSizer(cols=2, vgap=2, hgap=0)
        fgs1.SetMinSize(230, 10)

        #Summary Label
        st_summary = wx.StaticText(panel_scrolled, wx.ID_ANY,
                                   "Summary of assets: ")
        st_summary_placeholder = wx.StaticText(panel_scrolled, wx.ID_ANY, "")
        fgs1.Add(st_summary, flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL)
        fgs1.Add(st_summary_placeholder,
                 flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL)

        for i in globals.config.sections():
            fullname = str(globals.config[i]["fullname"])
            j = globals.config.sections().index(i)
            if str(globals.config[i]["type"]) == "deka":
                clr = ""
                if globals.wealth_amount[j][-1] - globals.invested[j] > 0:
                    clr = "#00cc00"
                else:
                    clr = "red"
                st_fullname = wx.StaticText(panel_scrolled, wx.ID_ANY,
                                            fullname + " : ")
                st_placeholder = wx.StaticText(panel_scrolled, wx.ID_ANY, "")
                st_amount = wx.StaticText(panel_scrolled, wx.ID_ANY, "")
                st_amount.SetLabelMarkup(
                    "<b><span color='" + str(globals.config[i]["color"]) +
                    "'>" + "  {:.2f}".format(globals.wealth_amount[j][-1]) +
                    " </span></b>")
                try:
                    st_amount_percentage = wx.StaticText(
                        panel_scrolled, wx.ID_ANY, "")
                    st_amount_percentage.SetLabelMarkup(
                        "<span color='" + str(clr) + "'>" +
                        ("+" if globals.wealth_amount[j][-1] -
                         globals.invested[j] > 0 else "") + "{:.2f}".format(
                             round(
                                 globals.wealth_amount[j][-1] -
                                 globals.invested[j], 2)) + " (" +
                        "{:.2f}".format(
                            round((
                                (globals.wealth_amount[j][-1] -
                                 globals.invested[j]) / globals.invested[j]) *
                                  100, 2)) + " %) </span>")
                except ZeroDivisionError:
                    st_amount_percentage = wx.StaticText(
                        panel_scrolled, wx.ID_ANY, "")
                    st_amount_percentage.SetLabelMarkup(
                        "<span color='" + str(clr) + "'>" +
                        ("+" if globals.wealth_amount[j][-1] -
                         globals.invested[j] > 0 else "") + "{:.2f}".format(
                             round(
                                 globals.wealth_amount[j][-1] -
                                 globals.invested[j], 2)) + " </span>")
                total_inv += globals.invested[j]
                total += globals.wealth_amount[j][-1]
                fgs1.Add(st_fullname,
                         flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL)
                fgs1.Add(st_amount,
                         flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL)
                fgs1.Add(st_placeholder, flag=wx.ALIGN_LEFT | wx.ALIGN_TOP)
                fgs1.Add(st_amount_percentage,
                         flag=wx.ALIGN_LEFT | wx.ALIGN_TOP)
                fgs1.Add((0, 2))
                fgs1.Add((0, 2))
            if str(globals.config[i]["type"]) == "liq":
                st_fullname = wx.StaticText(panelE, wx.ID_ANY,
                                            fullname + " : ", (10, 0))
                st_amount = wx.StaticText(
                    panelE, wx.ID_ANY,
                    "  {:.2f} ".format(globals.liquidity[0]), (217, 0))

        #Total Labels
        st_total_fullname = wx.StaticText(panelE, wx.ID_ANY,
                                          "Total (w/o Liquidity): ", (10, 20))
        st_total_amount = wx.StaticText(panelE, wx.ID_ANY, "", (217, 20))
        st_total_amount.SetLabelMarkup("<b><span>" + "  {:.2f}".format(total) +
                                       " </span></b>")
        st_toal_amount_percentage = wx.StaticText(panelE, wx.ID_ANY, "",
                                                  (217, 40))
        st_toal_amount_percentage.SetLabelMarkup(
            "<span color='" +
            ("red" if (total - total_inv) < 0 else "#00cc00") + "'>" +
            ("+" if (total - total_inv) > 0 else "") +
            "{:.2f}".format(round(total - total_inv, 2)) + " (" +
            "{:.2f}".format(round((total - total_inv) * 100 / total_inv, 2)) +
            " %) </span>")
        panel_scrolled.SetSizer(fgs1)
        panel_scrolled.SetAutoLayout(1)
        panel_scrolled.SetupScrolling()

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add(panel_scrolled, 1, wx.FIXED_MINSIZE | wx.EXPAND)
        panelD.SetSizer(hbox)

        bsizerDE = wx.BoxSizer(wx.VERTICAL)
        bsizerDE.Add(panelD, 3, wx.FIXED_MINSIZE | wx.EXPAND)
        bsizerDE.Add(panelE, 1, wx.EXPAND)
        panelC.SetSizer(bsizerDE)

        bsizer1 = wx.BoxSizer(wx.VERTICAL)
        bsizer1.Add(browser2, 1, wx.EXPAND)
        bsizer1.Add(panelC, 1, wx.EXPAND)
        panelB.SetSizer(bsizer1)

        bsizer2 = wx.BoxSizer(wx.HORIZONTAL)
        bsizer2.Add(browser, 2, wx.EXPAND)
        bsizer2.Add(panelB, 1, wx.EXPAND)
        panelA.SetSizer(bsizer2)

        self.choiceboxes = []  #300+
        self.browsers = []
        self.checkboxes = []
        self.checkboxes_ids = []  #400+
        self.checkboxes_auto_ids = []  #500+
        self.DatePicker_ids = []  #600+
        self.DatePickers = []
        self.SpinCtrls = []  #700+
        self.Notebooks = []  #800+

        self.choices = ["Fond Evolution", "Investment Evolution"]

        j = 0
        for i in globals.config.sections():
            panelA = wx.Window(Tabs, wx.ID_ANY)
            name = str(globals.config[str(i)]["name"])
            Tabs.AddPage(panelA, name)

            browser = wx.html2.WebView.New(panelA)
            browser.LoadURL("file://" + globals.filepath + "/html/" + name +
                            "/" + name + ".html")
            self.browsers.append(browser)

            panelB = wx.Window(panelA, wx.ID_ANY)

            panelC = wx.Window(panelB, wx.ID_ANY)

            t1 = wx.StaticText(panelC, wx.ID_ANY, "Settings")
            choicebox = wx.Choice(panelC,
                                  300 + len(self.choiceboxes),
                                  choices=self.choices)
            self.choiceboxes.append(choicebox)
            self.Bind(wx.EVT_CHOICE, self.OnChose, choicebox)

            cb = wx.CheckBox(panelC, 400 + len(self.checkboxes_ids),
                             "Show since establishment")
            self.checkboxes_ids.append(cb.GetId())
            cb.SetValue(False)
            self.checkboxes.append(cb)
            self.Bind(wx.EVT_CHECKBOX, self.EvtCheckBox, cb)

            if str(globals.config[i]["type"]) == "deka":
                clr = ""
                if globals.wealth_amount[j][-1] - globals.invested[j] > 0:
                    clr = "#00cc00"
                else:
                    clr = "red"
                wx.StaticText(panelC, wx.ID_ANY, "Invested Amount: ", (10, 90))
                wx.StaticText(panelC, wx.ID_ANY,
                              "{:.2f}".format(globals.invested[j]), (250, 90))
                wx.StaticText(
                    panelC, wx.ID_ANY,
                    "Value of the Invested Amount\n(w reinvested dividends): ",
                    (10, 110))
                wx.StaticText(panelC, wx.ID_ANY,
                              "{:.2f}".format(globals.wealth_amount[j][-1]),
                              (250, 115))
                wx.StaticText(panelC, wx.ID_ANY, "Current Holding: ",
                              (10, 145))
                wx.StaticText(panelC, wx.ID_ANY,
                              str(round(globals.current_holding[j], 3)) + " ",
                              (250, 145))
                wx.StaticText(panelC, wx.ID_ANY, "", (10, 165)).SetLabelMarkup(
                    "<span color='blue'>Reinvested dividends: </span>")
                wx.StaticText(panelC, wx.ID_ANY,
                              "{:.2f}".format(globals.dividends_invested[j]),
                              (250, 165))
                wx.StaticText(panelC, wx.ID_ANY, "", (10, 185)).SetLabelMarkup(
                    "<span color='red'>Transferred dividends: </span>")
                wx.StaticText(
                    panelC, wx.ID_ANY,
                    str("{:.2f}".format(globals.dividends_transferred[j])),
                    (250, 185))
                wx.StaticText(panelC, wx.ID_ANY, "Total gain/loss:", (10, 205))
                wx.StaticText(panelC, wx.ID_ANY, "", (
                    250 - 5,
                    205)).SetLabelMarkup("<span color='" + str(clr) + "'>" +
                                         ("+" if globals.wealth_amount[j][-1] -
                                          globals.invested[j] > 0 else "") +
                                         "{:.2f}".format(
                                             round(
                                                 globals.wealth_amount[j][-1] -
                                                 globals.invested[j], 2)) +
                                         " </span>")
                try:
                    wx.StaticText(
                        panelC, wx.ID_ANY, "", (250 - 5, 225)).SetLabelMarkup(
                            "<span color='" + str(clr) + "'>" +
                            ("+" if globals.wealth_amount[j][-1] -
                             globals.invested[j] > 0 else "") +
                            "{:.2f}".format(
                                round(((globals.wealth_amount[j][-1] -
                                        globals.invested[j]) /
                                       globals.invested[j]) * 100, 2)) +
                            " % </span>")
                except ZeroDivisionError:
                    wx.StaticText(
                        panelC, wx.ID_ANY, "", (250 - 5, 225)).SetLabelMarkup(
                            "<span color='" + str(clr) + "'>" +
                            ("+" if globals.wealth_amount[j][-1] -
                             globals.invested[j] > 0 else "") +
                            "{:.2f}".format(
                                round(
                                    globals.wealth_amount[j][-1] -
                                    globals.invested[j], 2)) + " </span>")
                cb_aut = wx.CheckBox(panelC,
                                     500 + len(self.checkboxes_auto_ids),
                                     "Monthly Automatisation from:", (10, 255))
                self.checkboxes_auto_ids.append(cb_aut.GetId())
                self.Bind(wx.EVT_CHECKBOX, self.EvtCheckBoxAut, cb_aut)
                dpc = wx.adv.DatePickerCtrl(panelC,
                                            600 + len(self.DatePicker_ids),
                                            wx.DateTime.Today(), (10, 275))
                if len(globals.wealth_dates[0]) > 1:
                    minimumdate = wx.DateTime(
                        int(str(globals.wealth_dates[j][0])[-2:]),
                        int(str(globals.wealth_dates[j][0])[5:7]) - 1,
                        int(str(globals.wealth_dates[j][0])[:4]))
                    maximumdate = wx.DateTime(
                        int(str(globals.wealth_dates[j][-1])[-2:]),
                        int(str(globals.wealth_dates[j][-1])[5:7]) - 1,
                        int(str(globals.wealth_dates[j][-1])[:4]))
                    dpc.SetRange(minimumdate, maximumdate)
                date = globals.config[i]["aut"]
                if date == "":
                    dpc.Disable()
                    dpc.SetValue(wx.DateTime.Today())
                    cb_aut.SetValue(False)
                else:
                    cb_aut.SetValue(True)
                    dpc.SetValue(
                        wx.DateTime(int(date[:2]),
                                    int(date[3:5]) - 1, int(date[-4:])))
                self.Bind(wx.adv.EVT_DATE_CHANGED, self.OnDateChanged, dpc)
                self.DatePicker_ids.append(dpc.GetId())
                self.DatePickers.append(dpc)
                SpinCtrlDouble_amount = wx.SpinCtrlDouble(panelC,
                                                          value='25.00',
                                                          min=25,
                                                          max=1000,
                                                          pos=(200, 280),
                                                          id=700 +
                                                          len(self.SpinCtrls),
                                                          inc=0.01)
                if date == "": SpinCtrlDouble_amount.Enable(False)
                if globals.config[i]["aut_amount"] != "":
                    SpinCtrlDouble_amount.SetValue(
                        str(
                            globals.ConvertToFloat(
                                globals.config[i]["aut_amount"])))
                self.SpinCtrls.append(SpinCtrlDouble_amount)
                self.Bind(wx.EVT_SPINCTRL, self.OnSpinCtrl,
                          SpinCtrlDouble_amount)
                self.Bind(wx.EVT_TEXT, self.OnSpinCtrl, SpinCtrlDouble_amount)
            if str(globals.config[i]["type"]) == "liq":
                wx.StaticText(panelC, wx.ID_ANY, "Available Liqudity",
                              (10, 185))
                wx.StaticText(panelC, wx.ID_ANY,
                              "{:.2f}".format(globals.liquidity[0]),
                              (250, 185))

            panelD = wx.Window(panelB, wx.ID_ANY)
            smallTabs = wx.Notebook(panelD,
                                    style=wx.BK_TOP,
                                    id=800 + len(self.Notebooks))
            self.Notebooks.append(smallTabs)
            self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED,
                      self.EvtNotebookPageChanged, smallTabs)
            panelE = wx.Window(smallTabs, wx.ID_ANY)
            smallTabs.AddPage(panelE, "History")
            grid = wx.grid.Grid(panelE)
            grid.SetRowLabelSize(0)
            grid.SetMargins(0, 0)
            grid.AutoSizeColumns(False)
            name = str(globals.config[str(i)]["name"])
            if str(globals.config[i]["type"]) == "deka":
                date_b, amount_b, date_d, amount_d = globals.parseInvestementData(
                    i, name)
                grid.CreateGrid(
                    max(len(date_b), len(amount_b), len(date_d),
                        len(amount_d)), 4)
                for k in range(len(date_d)):
                    grid.SetCellValue(k, 2, date_d[k])
                    grid.SetCellValue(k, 3, amount_d[k])
                    grid.SetCellBackgroundColour(k, 2,
                                                 wx.Colour(0, 0, 255, 80))
                    grid.SetCellBackgroundColour(k, 3,
                                                 wx.Colour(0, 0, 255, 80))
                date_d_t, amount_d_t = globals.parseTransferedDividendData(
                    name)
                for k in range(len(date_d_t)):
                    index = len(date_d) + k
                    grid.SetCellValue(index, 2, date_d_t[k])
                    grid.SetCellValue(index, 3, amount_d_t[k])
                    grid.SetCellBackgroundColour(index, 2,
                                                 wx.Colour(255, 0, 0, 80))
                    grid.SetCellBackgroundColour(index, 3,
                                                 wx.Colour(255, 0, 0, 80))
                grid.SetColLabelValue(2, "Date \nDividend")
                grid.SetColLabelValue(3, "Amount")
                grid.SetColSize(2, 80)
                grid.SetColSize(3, 70)
                grid.SetColLabelValue(0, "Date \nBuy")
            if str(globals.config[i]["type"]) == "liq":
                date_b, amount_b = globals.parseLiqudityData(name)
                grid.CreateGrid(len(date_b), 2)
                cb.Enable(False)
                choicebox.Enable(False)
                grid.SetColLabelValue(0, "Date")
            for k in range(len(date_b)):
                grid.SetCellValue(k, 0, date_b[k])
                grid.SetCellValue(k, 1, amount_b[k])
            grid.SetColLabelValue(1, "Amount")
            grid.SetColSize(0, 80)
            grid.SetColSize(1, 70)
            grid.SetRowLabelSize(20)
            grid.EnableEditing(False)
            grid.DisableDragGridSize()

            boxsizerE = wx.BoxSizer(wx.VERTICAL)
            boxsizerE.Add(grid, 0, wx.EXPAND)
            panelE.SetSizer(boxsizerE)

            if str(globals.config[i]["type"]) == "deka":
                panelF = wx.Window(smallTabs, wx.ID_ANY)
                smallTabs.AddPage(panelF, "ScopeAnalyis")
                s = globals.scopeAnalysisData[globals.config.sections().index(
                    i)]
                panelFa = wx.Window(panelF, wx.ID_ANY)
                wx.StaticText(panelFa, wx.ID_ANY, "Scope Rating ", (10, 5))
                wx.StaticText(
                    panelFa, wx.ID_ANY, "{} ({})".format(
                        s.rating,
                        str(s.score) + "/100" if s.score > 0 else "--/--"),
                    (250, 5))
                wx.lib.agw.hyperlink.HyperLinkCtrl(panelFa,
                                                   wx.ID_ANY,
                                                   "Detailed Report",
                                                   URL=s.url,
                                                   pos=(225, 25))

                boxsizerFa = wx.BoxSizer(wx.VERTICAL)
                panelFa.SetSizer(boxsizerFa)

                #panelFb = wx.Window(panelF,wx.ID_ANY)
                #browser3 = wx.html2.WebView.New(panelFb,pos=(0,10))
                #browser3.LoadURL("file://"+globals.filepath+"/html/"+name+"/"+name+"_Scope.html")
                #browser3.LoadURL("file://"+globals.filepath+"/html/"+"overview1.html")

                #boxsizerFb = wx.BoxSizer(wx.VERTICAL)
                #boxsizerFb.Add(browser3,1,wx.EXPAND)
                #panelFb.SetSizer(boxsizerFb)

                boxsizerF = wx.BoxSizer(wx.VERTICAL)
                boxsizerF.Add(panelFa, 1, wx.EXPAND)
                #boxsizerF.Add(panelFb, 2, wx.EXPAND|wx.ALIGN_BOTTOM)
                panelF.SetSizer(boxsizerF)

            boxsizerD = wx.BoxSizer(wx.VERTICAL)
            boxsizerD.Add(smallTabs, 1, wx.EXPAND)
            panelD.SetSizer(boxsizerD)

            boxsizerC = wx.BoxSizer(wx.VERTICAL)
            boxsizerC.Add(t1, 0, wx.ALIGN_TOP | wx.LEFT, 10)
            boxsizerC.Add(choicebox, 0, wx.TOP | wx.LEFT, 10)
            boxsizerC.Add(cb, 0, wx.TOP | wx.LEFT, 10)
            panelC.SetSizer(boxsizerC)

            bsizerB = wx.BoxSizer(wx.VERTICAL)
            bsizerB.Add(panelC, 6, wx.EXPAND)
            bsizerB.Add(panelD, 4, wx.EXPAND | wx.FIXED_MINSIZE)
            panelB.SetSizer(bsizerB)

            bsizer1 = wx.BoxSizer(wx.HORIZONTAL)
            bsizer1.Add(browser, 2, wx.EXPAND)
            bsizer1.Add(panelB, 1, wx.EXPAND)
            panelA.SetSizer(bsizer1)
            j += 1

        self.Show(True)
Пример #6
0
    def __init__(self, parent, input_para):

        rect_parent = parent.GetRect()
        print rect_parent
        pos_target = rect_parent.GetTopRight()
        wx.Frame.__init__(self,
                          parent,
                          -1,
                          "Resource Grid",
                          pos=pos_target,
                          size=(1000, 700))
        panel = wx.Panel(self, -1)

        sizer_grid = wx.GridBagSizer(0, 0)
        usr_style = wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL
        grid = wx.grid.Grid(self, -1)
        grid.CreateGrid(12 * 2, 14)
        cell_width = 20

        grid.DisableDragColSize()
        grid.DisableDragGridSize()
        grid.DisableDragRowSize()
        grid.SetRowLabelAlignment(wx.CENTER, wx.CENTER)

        clo_num = grid.GetNumberCols()
        row_num = grid.GetNumberRows()

        for i in range(0, row_num):
            grid.SetRowLabelValue(i, str(row_num - i - 1))
            grid.AutoSizeRowLabelSize(i)
        grid.SetRowLabelSize(cell_width)
        grid.SetDefaultRowSize(cell_width)
        for j in range(0, clo_num):
            grid.SetColLabelValue(j, str(j))
            grid.AutoSizeColLabelSize(j)
        grid.SetRowLabelSize(cell_width)
        grid.SetDefaultColSize(cell_width)
        grid.SetDefaultCellBackgroundColour(wx.Colour(192, 192, 192))

        #pdcch
        for i in range(0, row_num):
            for j in range(0, clo_num):
                grid.SetReadOnly(i, j)
                if (j < input_para['pdcch_symbol']):
                    grid.SetCellBackgroundColour(i, j, wx.GREEN)
                    if ((int(grid.GetRowLabelValue(i)) - 1) % 4 == 0):
                        grid.SetCellBackgroundColour(i, j,
                                                     wx.Colour(66, 66, 111))
        #pdsch
        for i in range(0, row_num):
            for j in range(input_para['start_symbol'], clo_num):
                if (j - input_para['start_symbol'] <
                        input_para['symbol_length']):
                    grid.SetCellBackgroundColour(i, j,
                                                 wx.Colour(255, 255, 255))
        #pdsch dmrs
        for j in range(0, len(input_para['dmrs_pos_list'])):
            for i in range(0, row_num):
                if input_para['dmrs_length'] == 0 and j == 0:
                    grid.SetCellBackgroundColour(
                        i, input_para['dmrs_pos_list'][j],
                        wx.Colour(153, 204, 50))
                    continue
                if input_para['dmrs_length'] == 1 and (j == 1 or j == 0):
                    grid.SetCellBackgroundColour(
                        i, input_para['dmrs_pos_list'][j],
                        wx.Colour(153, 204, 50))
                    continue
                else:
                    grid.SetCellBackgroundColour(
                        i, input_para['dmrs_pos_list'][j],
                        wx.Colour(234, 234, 173))

        sizer_grid.Add(grid,
                       pos=(0, 0),
                       span=(5, 5),
                       flag=wx.EXPAND | usr_style)

        lbl_pdcch = wx.StaticText(self, -1, u'  PDCCH  ', style=usr_style)
        lbl_pdcch.SetBackgroundColour(wx.GREEN)
        sizer_grid.Add(lbl_pdcch,
                       pos=(7, 0),
                       span=(1, 1),
                       flag=wx.EXPAND | usr_style)

        lbl_pdcch_dmrs = wx.StaticText(
            self,
            -1,
            u'  PDCCH DMRS  ',
            style=usr_style,
        )
        lbl_pdcch_dmrs.SetBackgroundColour(wx.Colour(66, 66, 111))
        lbl_pdcch_dmrs.SetForegroundColour(wx.Colour(255, 255, 255))
        sizer_grid.Add(
            lbl_pdcch_dmrs,
            pos=(7, 1),
            span=(1, 1),
            flag=wx.EXPAND | usr_style,
        )

        lbl_pdsch = wx.StaticText(self, -1, u'  PDXCH  ', style=usr_style)
        lbl_pdsch.SetBackgroundColour(wx.Colour(255, 255, 255))
        lbl_pdsch.SetForegroundColour(wx.Colour(0, 0, 0))
        sizer_grid.Add(lbl_pdsch,
                       pos=(7, 2),
                       span=(1, 1),
                       flag=wx.EXPAND | usr_style)

        lbl_fl_dmrs = wx.StaticText(self,
                                    -1,
                                    u'Front Loaded DMRS',
                                    style=usr_style)
        lbl_fl_dmrs.SetBackgroundColour(wx.Colour(153, 204, 50))
        lbl_fl_dmrs.SetForegroundColour(wx.Colour(255, 255, 255))
        sizer_grid.Add(lbl_fl_dmrs,
                       pos=(8, 0),
                       span=(1, 1),
                       flag=wx.EXPAND | usr_style)

        lbl_add_dmrs = wx.StaticText(self, -1, u'Add DMRS', style=usr_style)
        lbl_add_dmrs.SetBackgroundColour(wx.Colour(234, 234, 173))
        lbl_add_dmrs.SetForegroundColour(wx.Colour(0, 0, 0))
        sizer_grid.Add(lbl_add_dmrs,
                       pos=(8, 1),
                       span=(1, 1),
                       flag=wx.EXPAND | usr_style)

        b_close = wx.Button(self, -1, "Close")
        self.Bind(wx.EVT_BUTTON, self.close_window, b_close)
        sizer_grid.Add(b_close,
                       pos=(10, 0),
                       span=(2, 5),
                       flag=wx.EXPAND | usr_style)
        self.equal = b_close

        self.SetSizer(sizer_grid)
        sizer_grid.Fit(self)

        self.Show()
Пример #7
0
 def __init__(self, parent):
    super(PanelDic, self).__init__(parent)
    grid = Diccionario_2(self)
    grid.AutoSize()
    grid.EnableEditing(False)
    grid.DisableDragGridSize()