예제 #1
0
    def bind_to_grid(self, grid):
        """Bind to intercept events on the grid

        Binds on_mouse_motion and on_column_resize in order to do tooltips.
        Sets up editing / auto size and other to customize for table type.
        """
        self.grid = grid
        grid.AutoSize()
        grid.EnableEditing(False)
        grid.SetDefaultCellOverflow(False)
        if self.v.corner_button is None:
            grid.fn_clicked = None
        else:
            fn_clicked = self.v.corner_button["fn_clicked"]

            def on_corner_button_clicked():
                fn_clicked()
                self.update_grid()
                grid.ForceRefresh()
                grid.Parent.Layout()

            grid.fn_clicked = on_corner_button_clicked
            grid.label = self.v.corner_button.get("label", "Update")
            grid.tooltip = self.v.corner_button.get("tooltip", "")
        #
        # Below largely taken from
        # http://wiki.wxpython.org/wxGrid%20ToolTips
        #
        self.last_pos = (None, None)
        grid.GetGridWindow().Bind(wx.EVT_MOTION, self.on_mouse_motion)
        grid.Bind(wx.grid.EVT_GRID_COL_SIZE, self.on_column_resize)
예제 #2
0
파일: proy.py 프로젝트: PavzM/BasedeDatos
    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()
예제 #3
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()
예제 #4
0
def setup_grid(grid, title):
    """
    This function only works with type wx.grid.Grid
    The it will create a grid that is like the one found in LinkCtrl/View.
    :param grid:
    :return:
    """

    grid.CreateGrid(6, 2)
    grid.EnableEditing(False)
    grid.EnableGridLines(True)
    grid.SetGridLineColour(wx.Colour(0, 0, 0))
    grid.EnableDragGridSize(False)

    # Columns
    grid.EnableDragColMove(False)
    grid.EnableDragColSize(True)
    grid.SetColLabelSize(0)
    grid.SetColLabelAlignment(wx.ALIGN_CENTER, wx.ALIGN_CENTER)
    grid.SetColSize(0, 110)

    # Rows
    grid.EnableDragRowSize(True)
    grid.SetRowLabelSize(0)
    grid.SetRowLabelAlignment(wx.ALIGN_CENTER, wx.ALIGN_CENTER)

    # Defaults
    grid.SetDefaultCellBackgroundColour(wx.Colour(255, 255, 255))  # white
    grid.SetDefaultCellAlignment(wx.ALIGN_LEFT, wx.ALIGN_TOP)

    # Set Cell Values
    grid.SetCellValue(0, 0, " %s" % title)
    grid.SetCellValue(1, 0, " Variable Name")
    grid.SetCellValue(2, 0, " Geometry Type")
    grid.SetCellValue(3, 0, " Geometry Count")
    grid.SetCellValue(4, 0, " Coordinate System")
    grid.SetCellValue(5, 0, " Spatial Extent")

    # set the default background color
    grid.SetDefaultCellBackgroundColour('WHITE')

    # change color and size of header
    grid.SetCellSize(0, 0, 1, 2)  # span cols 0 and 1
    grid.SetCellBackgroundColour(0, 0, wx.Colour(195, 195, 195))  # Grey

    # set the table column size
    grid.SetColSize(0, 133)
    grid.SetColSize(1, 155)

    # change color of properties
    for i in range(1, grid.GetNumberRows()):
        grid.SetCellBackgroundColour(i, 0, wx.Colour(250, 250,
                                                     250))  # light Grey

    grid.SetGridLineColour(wx.Colour(195, 195, 195))
예제 #5
0
    def __init__(self, student):

        wx.Frame.__init__(self,
                          parent=None,
                          title="学生信息单",
                          pos=(100, 100),
                          size=(500, 500))

        self.panel = wx.Panel(self)
        studentMessage = student.getStudentMessage()

        wx.StaticText(self.panel, -1, studentMessage[0], pos=(50, 10))
        wx.StaticText(self.panel, -1, studentMessage[1], pos=(100, 10))

        gradeLabel = wx.StaticText(self.panel, -1, "学生成绩单", pos=(200, 10))
        gradeLabel.SetFont(wx.Font(18, wx.ROMAN, wx.ITALIC, wx.NORMAL))

        wx.StaticText(self.panel,
                      -1,
                      "================================================",
                      pos=(50, 30))
        t = str(time.localtime(time.time()).tm_year)+\
            '.'+str(time.localtime(time.time()).tm_mon)+\
            '.'+str(time.localtime(time.time()).tm_mday)

        self.gradeLabel = wx.StaticText(self.panel, -1, t, pos=(400, 10))
        grid = wx.grid.Grid(self.panel, id=-1, pos=(50, 50), size=(400, 200))

        grid.CreateGrid(10, 5)
        grid.HideRowLabels()
        grid.HideColLabels()
        grid.SetColSize(0, 69)
        grid.SetColSize(1, 100)
        grid.SetColSize(2, 69)
        grid.SetGridLineColour(wx.Colour(230, 230, 230))
        grid.SetDefaultCellBackgroundColour(wx.Colour(230, 230, 230))
        grid.EnableEditing(False)
        classesGrade = student.getCompleteStudentGrade()
        grid.SetCellValue(0, 0, '课程号')
        grid.SetCellValue(0, 1, '课程名')
        grid.SetCellValue(0, 2, '成绩')
        grid.SetCellValue(0, 3, '学分')
        grid.SetCellValue(0, 4, '教师')
        avgGrade = 0
        for i in range(len(classesGrade)):
            for j in range(len(classesGrade[i])):
                grid.SetCellValue(i + 1, j, classesGrade[i][j])
            avgGrade += int(classesGrade[i][2])
        avgLabel = wx.StaticText(self.panel,
                                 -1,
                                 "平均成绩:" + str(avgGrade / len(classesGrade)),
                                 pos=(200, 300))
        avgLabel.SetFont(wx.Font(30, wx.ROMAN, wx.ITALIC, wx.NORMAL))
예제 #6
0
파일: per_stat.py 프로젝트: ehoac/wfund
 def init_grid(self):
     colLabels = ['日期', '类型', '金额(元)', '原因', '相关人员']
     self.grid_data = self.get_grid_data()
     print(self.grid_data)
     grid = Part.GenGrid(
         self, colLabels,
         {k: self.grid_data[k]
          for k in self.grid_data if k[1] != 5})
     grid.SetColSize(0, 175)
     grid.SetColSize(3, 200)
     grid.SetColSize(4, 200)
     grid.EnableEditing(False)
     return grid
예제 #7
0
    def draw_table(self, i, x, y):
        results = self.type_result[i]
        # size = self.ssize[i]
        size_of_par = self.size_of_par[i]

        grid = self.tables[i]
        grid.SetMaxSize(wx.Size(320, 360))
        grid.SetMinSize(wx.Size(320, 360))
        names = self.names[i]

        grid.CreateGrid(28, 13)
        grid.EnableEditing(True)
        grid.EnableGridLines(True)
        grid.EnableDragGridSize(False)
        grid.SetMargins(0, 0)

        # Columns
        grid.EnableDragColMove(False)
        grid.EnableDragColSize(True)
        grid.SetColLabelSize(30)
        grid.SetColLabelAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE)
        i = 0
        for namei in names:
            grid.SetColLabelValue(i, namei)
            i += 1

        # 设置内容
        # Rows
        grid.EnableDragRowSize(True)
        grid.SetRowLabelSize(80)
        grid.SetRowLabelAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE)

        # Label Appearance

        # Cell Defaults
        grid.SetDefaultCellAlignment(wx.ALIGN_LEFT, wx.ALIGN_TOP)
        """"设置内容"""
        j = 0
        for result in results:
            i = 0
            for row in result:
                # 截段输出 numpy 抽样结果过长
                grid.SetCellValue(i, j, str(("%.3f" % row)))
                i = i + 1
            j += 1

        self.gbSizer_show.Add(grid, wx.GBPosition(x, y), wx.GBSpan(1, 3),
                              wx.ALL, 5)
        return y + size_of_par
예제 #8
0
    def init_grid(self):
        colLabels = [
            '人员', self.fund_kind['01'] + '(元)', self.fund_kind['02'] + '(元)',
            self.fund_kind['03'] + '(元)', self.fund_kind['04'] + '(元)', '总计(元)'
        ]
        self.grid_data = self.get_grid_data()
        grid = Part.GenGrid(self, colLabels, self.get_grid_data())
        grid.EnableEditing(False)
        # grid.SetDefaultCellOverflow(False)

        grid.SetColSize(0, 110)
        grid.SetColSize(1, 125)
        grid.SetColSize(2, 125)
        grid.SetColSize(3, 125)
        grid.SetColSize(4, 125)
        grid.SetColSize(5, 125)
        return grid
예제 #9
0
    def __init__(self):
        wx.Dialog.__init__(self, None, -1, u'模板管理器', size=(500, 200))

        #这里利用grid(其实用listCtrl就足够了,但是不会用--imageList的部分??)
        colLabels = [u'模板名', u'基本信息']
        grid = wx.grid.Grid(self, -1, size=(500, 115))
        grid.CreateGrid(len(data.column1), 2)
        grid.EnableEditing(False)  #设置为不可编辑的状态

        #设置表头
        grid.SetColLabelValue(0, colLabels[0])
        grid.SetColLabelValue(1, colLabels[1])

        #设置表内容
        '''
        i = 0
        while i < len(data.column1):
            grid.SetCellValue(i,0,data.column1[i])
            grid.SetCellValue(i,1,data.column2[i])
            ++i
        grid.AutoSizeColumns(setAsMin=True)
        '''
        grid.SetCellValue(0, 0, data.column1[0])
        grid.SetCellValue(0, 1, data.column2[0])
        grid.SetCellValue(1, 0, data.column1[1])
        grid.SetCellValue(1, 1, data.column2[1])
        grid.AutoSizeColumns(setAsMin=True)
        grid.SetCellValue(2, 0, data.column1[2])
        grid.SetCellValue(2, 1, data.column2[2])
        grid.SetCellValue(3, 0, data.column1[3])
        grid.SetCellValue(3, 1, data.column2[3])

        #所有按钮
        #NameButton = wx.Button(self,wx.ID_OK,u'更名',pos=(100,125))
        NameButton = wx.Button(self, -1, u'更名', pos=(50, 125))
        self.Bind(wx.EVT_BUTTON, self.OnName, NameButton)

        DeleteButton = wx.Button(self, -1, u'删除', pos=(150, 125))
        self.Bind(wx.EVT_BUTTON, self.OnDelete, DeleteButton)

        AddButton = wx.Button(self, -1, u'新增', pos=(250, 125))
        self.Bind(wx.EVT_BUTTON, self.OnAdd, AddButton)

        #这两个暂时没什么作用,也没绑定事件
        CancelButton = wx.Button(self, wx.ID_CANCEL, u'取消', pos=(350, 125))
예제 #10
0
    def init_grid(self, grid):
        # Grid
        grid.CreateGrid(7, 2)
        grid.EnableEditing(False)
        grid.EnableGridLines(True)
        grid.SetGridLineColour(wx.Colour(0, 0, 0))
        grid.EnableDragGridSize(False)
        grid.SetMargins(0, 0)

        # Columns
        grid.EnableDragColMove(False)
        grid.EnableDragColSize(True)
        grid.SetColLabelSize(0)
        grid.SetColLabelAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE)

        # Rows
        grid.EnableDragRowSize(True)
        grid.SetRowLabelSize(0)
        grid.SetRowLabelAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE)

        # Label Appearance

        # Cell Defaults
        grid.SetDefaultCellBackgroundColour(wx.Colour(255, 255, 255))
        grid.SetDefaultCellAlignment(wx.ALIGN_LEFT, wx.ALIGN_TOP)

        # Set Cell Values
        grid.SetCellValue(0, 0, " Variable")
        grid.SetCellValue(1, 0, " Name")
        grid.SetCellValue(2, 0, " Description")
        grid.SetCellValue(3, 0, " Unit")
        grid.SetCellValue(4, 0, " Name")
        grid.SetCellValue(5, 0, " Type")
        grid.SetCellValue(6, 0, " Abbreviation")

        grid.SetCellBackgroundColour(0, 0, wx.Colour(195, 195, 195))
        grid.SetCellBackgroundColour(0, 1, wx.Colour(195, 195, 195))
        grid.SetCellBackgroundColour(3, 0, wx.Colour(195, 195, 195))
        grid.SetCellBackgroundColour(3, 1, wx.Colour(195, 195, 195))
        grid.SetGridLineColour(wx.Colour(195, 195, 195))
        self.resize_grid_to_fill_white_space(grid)
예제 #11
0
    def OnOpenLogcatClicked(self, event):
        self.open_logcat.Enable(False)
        self.close_logcat.Enable(True)

        # 加载数据库
        self.loadDataBase(
            2)  # 用一个列表返回数据库 不要赋值给self (data = xx.loadDataBase() )
        # 必须要变宽才能显示 scroll
        self.SetSize(980, 560)
        grid = wx.grid.Grid(self, pos=(320, 0), size=(640, 500))
        # 行数列数
        grid.CreateGrid(100, 4)
        # 画水平与垂直线
        for i in range(100):
            for j in range(4):
                grid.SetCellAlignment(i, j, wx.ALIGN_CENTER, wx.ALIGN_CENTER)
        # name of first row
        grid.SetColLabelValue(0, "工号")
        grid.SetColLabelValue(1, "姓名")
        grid.SetColLabelValue(2, "打卡时间")
        grid.SetColLabelValue(3, "是否迟到")
        # Size of each col
        grid.SetColSize(0, 120)
        grid.SetColSize(1, 120)
        grid.SetColSize(2, 150)
        grid.SetColSize(3, 150)

        grid.SetCellTextColour(wx.BLUE)
        for i, id in enumerate(self.logcat_id):
            grid.SetCellValue(i, 0, str(id))
            grid.SetCellValue(i, 1, self.logcat_name[i])
            grid.SetCellValue(i, 2, self.logcat_datetime[i])
            grid.SetCellValue(i, 3, self.logcat_late[i])

            grid.SetCellTextColour(
                i, 3, wx.RED
            ) if self.logcat_late[i] == '是' else grid.SetCellTextColour(
                i, 3, wx.GREEN)
        # Not allowed to edit
        grid.EnableEditing(False)
        pass
예제 #12
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()
예제 #13
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)
    def OnOpenLogcatClicked(self, event):

        if (self.id ==  ID_WORKER_UNAVIABLE):
            wx.MessageBox('请先刷脸签到!', '温馨提示', wx.OK)
            return

        self.open_logcat.Enable(False)
        self.close_logcat.Enable(True)

        # 加载数据库
        self.data.loadDataBase(2)  # 用一个列表返回数据库 不要赋值给self (data = xx.loadDataBase() )
        # 必须要变宽才能显示 scroll
        self.SetSize(980, 560)
        grid = wx.grid.Grid(self, pos=(320, 0), size=(640, 500))
        # 行数列数
        grid.CreateGrid(100, 4)
        # 画水平与垂直线
        for i in range(100):
            for j in range(4):
                grid.SetCellAlignment(i, j, wx.ALIGN_CENTER, wx.ALIGN_CENTER)
        # name of first row
        grid.SetColLabelValue(0, "工号")
        grid.SetColLabelValue(1, "姓名")
        grid.SetColLabelValue(2, "打卡时间")
        grid.SetColLabelValue(3, "是否迟到")
        # Size of each col
        grid.SetColSize(0, 120)
        grid.SetColSize(1, 120)
        grid.SetColSize(2, 150)
        grid.SetColSize(3, 150)

        grid.SetCellTextColour(wx.BLUE)

        # 建立请求连接
        host_ip = "47.96.157.49"
        host_usr = "******"
        host_psw = "123lalala"
        host_db = "inspurer"
        conn = mysql.connect(host_ip, host_usr, host_psw, host_db)
        mycursor = conn.cursor()
        sqlQuery = 'Select id, name, datetime, late from logcat where id = %s'
        val = self.id
        print(val)
        print(type(self.id), type(val))
        mycursor.execute(sqlQuery, val)
        origin = mycursor.fetchall()
        logcat_id = []
        logcat_name = []
        logcat_datetime = []
        logcat_late = []
        for row in origin:
            logcat_id.append(row[0])
            logcat_name.append(row[1])
            logcat_datetime.append(row[2])
            logcat_late.append(row[3])
        mycursor.close()
        conn.close()

        # for i, id in enumerate(self.data.logcat_id):
        for i, id in enumerate(logcat_id):
            grid.SetCellValue(i, 0, str(id))
            grid.SetCellValue(i, 1, logcat_name[i])
            grid.SetCellValue(i, 2, logcat_datetime[i])
            grid.SetCellValue(i, 3, logcat_late[i])
            grid.SetCellTextColour(i, 3, wx.RED) if logcat_late[i] == 'yes' else grid.SetCellTextColour(i, 3,wx.GREEN)
        # Not allowed to edit
        grid.EnableEditing(False)
        pass
예제 #15
0
파일: omaha.py 프로젝트: frankdeath/ooc
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, -1)

        self.hand_type = {0:'No Pair', 1:'One Pair', 2:'Two Pair', 3:'Three of a Kind', 4:'Straight', 5:'Flush', 6:'Full House', 7:'Four of a Kind', 8:'Straight Flush', 9:'Five of a Kind'}

        # Initialize the hand so that it's easier to implement active min hand calc
        #self.card_array = [12,11,51,50,10,9,8,7]
        self.card_array = [53] * 9

        self.right_clicked_card = -1
        self.right_click_selection = -1
        self.last_flop_array = [53] * 9
        self.last_turn_array = [53] * 9
        self.last_showdown_array = [53] * 9
        self.flop_turn_results = ()
        self.flop_river_results = ()
        self.flop_better_hands = []
        self.turn_river_results = ()
        self.turn_better_hands = []
        self.showdown_results = ()
        self.showdown_better_hands = []

        self.better = ()

        self.minipanel_is_open = 0
        self.minipanel = -1

        grid = wx.grid.Grid(self, -1, size = wx.Size(500, 347), style = wx.SIMPLE_BORDER)
        grid.CreateGrid(9, 5)
        grid.SetColLabelValue(0, "Hand")
        grid.SetColLabelValue(1, "Count")
        grid.SetColLabelValue(2, "Odds 1:x")
        grid.SetColLabelValue(3, "Probability")
        grid.SetColLabelValue(4, "# Better")
        grid.SetColSize(0, 160)
        grid.SetColSize(1, COL_SIZE)
        grid.SetColSize(2, COL_SIZE)
        grid.SetColSize(3, COL_SIZE)
        grid.SetColSize(4, COL_SIZE)
        grid.SetRowSize(0, ROW_SIZE)
        grid.SetRowSize(1, ROW_SIZE)
        grid.SetRowSize(2, ROW_SIZE)
        grid.SetRowSize(3, ROW_SIZE)
        grid.SetRowSize(4, ROW_SIZE)
        grid.SetRowSize(5, ROW_SIZE)
        grid.SetRowSize(6, ROW_SIZE)
        grid.SetRowSize(7, ROW_SIZE)
        grid.SetRowSize(8, ROW_SIZE)
        grid.SetColLabelSize(30)
        grid.SetRowLabelSize(0)
        grid.EnableEditing(False)
        grid.EnableDragColSize(False)
        grid.EnableDragRowSize(False)
        grid.EnableDragGridSize(False)
        grid.SetDefaultCellAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE)
        font = wx.Font(12, family = wx.ROMAN, style = wx.NORMAL, weight = wx.BOLD)
        grid.SetDefaultCellFont(font)
        # This is the magical line that turns off the scrollbars
        # Thank you: http://lists.wxwidgets.org/archive/wxPython-users/msg10178.html
        grid.SetMargins(-100,-100)

        self.grid = grid

        font = wx.Font(14, family = wx.MODERN, style = wx.NORMAL, weight = wx.BOLD)

        #self.title = wx.StaticText(self, -1, "", size=(250,25), style = wx.ST_NO_AUTORESIZE | wx.ALIGN_CENTRE | wx.SIMPLE_BORDER, name = "Title")
        self.title = wx.StaticText(self, -1, "", size=(250,25), style = wx.ST_NO_AUTORESIZE | wx.ALIGN_CENTRE, name = "Title")
        # font styles:
        # family = wx.DEFAULT, wx.DECORATIVE, wx.ROMAN, wx.SCRIPT, wx.SWISS, wx.MODERN
        # style = wx.NORMAL, wx.SLANT, wx.ITALIC
        # weight = wx.NORMAL, wx.LIGHT, wx.BOLD
        self.title.SetFont(font)

        title_sizer = wx.BoxSizer ( wx.HORIZONTAL )
        
        title_sizer.Add((30,30), 0, wx.ALIGN_CENTRE_VERTICAL)
        title_sizer.Add(self.title, 0, wx.ALIGN_CENTRE_VERTICAL)
        title_sizer.Add((30,30), 0, wx.ALIGN_CENTRE_VERTICAL)

        font = wx.Font(13, family = wx.MODERN, style = wx.NORMAL, weight = wx.BOLD)

        # call min_hand_eval here
        #current_h = self.MinHandEval()
        current_h = ""

        #self.hand_display = wx.StaticText(self, -1, current_h, size=(200,25), style = wx.ST_NO_AUTORESIZE | wx.ALIGN_CENTRE | wx.SIMPLE_BORDER)
        self.hand_display = wx.StaticText(self, -1, current_h, size=(200,25), style = wx.ST_NO_AUTORESIZE | wx.ALIGN_CENTRE)
        self.hand_display.SetFont(font)

        # hutchison index
        #h_index = hutchison(self.card_array[:4])
        h_index = ""
        #self.hutch_display = wx.StaticText(self, -1, h_index, size=(200,25), style = wx.ST_NO_AUTORESIZE | wx.ALIGN_CENTRE | wx.SIMPLE_BORDER)
        self.hutch_display = wx.StaticText(self, -1, h_index, size=(200,25), style = wx.ST_NO_AUTORESIZE | wx.ALIGN_CENTRE)
        self.hutch_display.SetFont(font)

        hand_disp_sizer = wx.BoxSizer( wx.HORIZONTAL )

        hand_disp_sizer.Add(self.hutch_display, 0 , wx.ALIGN_CENTER_VERTICAL)
        hand_disp_sizer.Add((30,50), 0, wx.ALIGN_CENTRE_VERTICAL)
        hand_disp_sizer.Add(self.hand_display, 0, wx.ALIGN_CENTRE_VERTICAL)
        #hand_disp_sizer.Add((30,50), 0, wx.ALIGN_CENTRE_VERTICAL)

        self.button1 = wx.Button(self, ID_BUTTON1, "Turn", size=(70,30))
        self.button2 = wx.Button(self, ID_BUTTON2, "River", size=(70,30))
        self.button3 = wx.Button(self, ID_BUTTON3, "River+", size=(70,30))
        self.button6 = wx.Button(self, ID_BUTTON6, "Showdown", size=(70,30))
        self.button4 = wx.Button(self, ID_BUTTON4, "Reset", size=(70,30))
        self.button5 = wx.Button(self, ID_BUTTON5, "Panel", size=(70,30))

        self.button1.Disable()
        self.button2.Disable()
        self.button3.Disable()
        self.button4.Disable()
        self.button6.Disable()

        button_sizer = wx.BoxSizer( wx.HORIZONTAL )

        LARGE_BUTTON_SPACE = (20, 40)
        MEDIUM_BUTTON_SPACE = (12, 40)
        SMALL_BUTTON_SPACE = (2, 40)

        button_sizer.Add(self.button5, 0, wx.ALIGN_CENTRE_VERTICAL)
        button_sizer.Add(LARGE_BUTTON_SPACE, 0, wx.ALIGN_CENTRE_VERTICAL)
        button_sizer.Add(self.button1, 0, wx.ALIGN_CENTRE_VERTICAL)
        button_sizer.Add(SMALL_BUTTON_SPACE, 0, wx.ALIGN_CENTRE_VERTICAL)
        button_sizer.Add(self.button2, 0, wx.ALIGN_CENTRE_VERTICAL)
        button_sizer.Add(MEDIUM_BUTTON_SPACE, 0, wx.ALIGN_CENTRE_VERTICAL)
        button_sizer.Add(self.button3, 0, wx.ALIGN_CENTRE_VERTICAL)
        button_sizer.Add(MEDIUM_BUTTON_SPACE, 0, wx.ALIGN_CENTRE_VERTICAL)
        button_sizer.Add(self.button6, 0, wx.ALIGN_CENTRE_VERTICAL)
        button_sizer.Add(LARGE_BUTTON_SPACE, 0, wx.ALIGN_CENTRE_VERTICAL)
        button_sizer.Add(self.button4, 0, wx.ALIGN_CENTRE_VERTICAL)

        # Initialize the cards
        self.card1 = wx.StaticBitmap(self, ID_CARD_1, catalog[index[self.card_array[0]]].getBitmap(), name = "Card1")
        self.card2 = wx.StaticBitmap(self, ID_CARD_2, catalog[index[self.card_array[1]]].getBitmap(), name = "Card2")
        self.card3 = wx.StaticBitmap(self, ID_CARD_3, catalog[index[self.card_array[2]]].getBitmap(), name = "Card3")
        self.card4 = wx.StaticBitmap(self, ID_CARD_4, catalog[index[self.card_array[3]]].getBitmap(), name = "Card4")
        self.card5 = wx.StaticBitmap(self, ID_CARD_5, catalog[index[self.card_array[4]]].getBitmap(), name = "Card5")
        self.card6 = wx.StaticBitmap(self, ID_CARD_6, catalog[index[self.card_array[5]]].getBitmap(), name = "Card6")
        self.card7 = wx.StaticBitmap(self, ID_CARD_7, catalog[index[self.card_array[6]]].getBitmap(), name = "Card7")
        self.card8 = wx.StaticBitmap(self, ID_CARD_8, catalog[index[self.card_array[7]]].getBitmap(), name = "Card8")
        self.card9 = wx.StaticBitmap(self, ID_CARD_9, catalog[index[self.card_array[8]]].getBitmap(), name = "Card9")

        self.cards = (self.card1, self.card2, self.card3, self.card4, self.card5, self.card6, self.card7, self.card8, self.card9)

        card_sizer1 = wx.BoxSizer( wx.HORIZONTAL )
        card_sizer2 = wx.BoxSizer( wx.HORIZONTAL )

        LITTLE_SPACER = (5,5)
        BIG_SPACER = (25,5)
        HOLE_SPACER = (5,125)

        card_sizer2.Add(self.card1, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer2.Add(HOLE_SPACER, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer2.Add(self.card2, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer2.Add(HOLE_SPACER, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer2.Add(self.card3, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer2.Add(HOLE_SPACER, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer2.Add(self.card4, 0, wx.ALIGN_CENTRE_VERTICAL)

        card_sizer1.Add(self.card5, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer1.Add(LITTLE_SPACER, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer1.Add(self.card6, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer1.Add(LITTLE_SPACER, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer1.Add(self.card7, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer1.Add(BIG_SPACER, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer1.Add(self.card8, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer1.Add(BIG_SPACER, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer1.Add(self.card9, 0, wx.ALIGN_CENTRE_VERTICAL)

        self.sizer = wx.BoxSizer( wx.VERTICAL )

        self.sizer.Add(title_sizer, 0, wx.ALIGN_CENTRE_HORIZONTAL)
        self.sizer.Add(grid, 0, wx.ALIGN_CENTRE_HORIZONTAL)
        self.sizer.Add(hand_disp_sizer, 0, wx.ALIGN_CENTRE_HORIZONTAL)
        self.sizer.Add(card_sizer1, 0, wx.ALIGN_CENTRE_HORIZONTAL)
        self.sizer.Add(card_sizer2, 0, wx.ALIGN_CENTRE_HORIZONTAL)

        self.sizer.Add(button_sizer, 0, wx.ALIGN_CENTRE_HORIZONTAL)
        
        self.SetSizer(self.sizer)
        self.SetAutoLayout(1)

        self.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK, self.OnCellRightClick, self.grid)
        self.Bind(wx.EVT_BUTTON, self.OnButton5, self.button5)
        self.Bind(wx.EVT_BUTTON, self.OnButton1, self.button1)
        self.Bind(wx.EVT_BUTTON, self.OnButton2, self.button2)
        self.Bind(wx.EVT_BUTTON, self.OnButton3, self.button3)
        self.Bind(wx.EVT_BUTTON, self.OnButton6, self.button6)
        self.Bind(wx.EVT_BUTTON, self.OnButton4, self.button4)
        self.card1.Bind(wx.EVT_LEFT_UP, self.LeftClick)
        self.card2.Bind(wx.EVT_LEFT_UP, self.LeftClick)
        self.card3.Bind(wx.EVT_LEFT_UP, self.LeftClick)
        self.card4.Bind(wx.EVT_LEFT_UP, self.LeftClick)
        self.card5.Bind(wx.EVT_LEFT_UP, self.LeftClick)
        self.card6.Bind(wx.EVT_LEFT_UP, self.LeftClick)
        self.card7.Bind(wx.EVT_LEFT_UP, self.LeftClick)
        self.card8.Bind(wx.EVT_LEFT_UP, self.LeftClick)
        self.card9.Bind(wx.EVT_LEFT_UP, self.LeftClick)
        self.card1.Bind(wx.EVT_RIGHT_UP, self.RightClick)
        self.card2.Bind(wx.EVT_RIGHT_UP, self.RightClick)
        self.card3.Bind(wx.EVT_RIGHT_UP, self.RightClick)
        self.card4.Bind(wx.EVT_RIGHT_UP, self.RightClick)
        self.card5.Bind(wx.EVT_RIGHT_UP, self.RightClick)
        self.card6.Bind(wx.EVT_RIGHT_UP, self.RightClick)
        self.card7.Bind(wx.EVT_RIGHT_UP, self.RightClick)
        self.card8.Bind(wx.EVT_RIGHT_UP, self.RightClick)
        self.card9.Bind(wx.EVT_RIGHT_UP, self.RightClick)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_2)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_3)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_4)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_5)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_6)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_7)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_8)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_9)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_T)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_J)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_Q)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_K)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_A)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_S)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_H)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_D)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_C)
예제 #16
0
 def __init__(self, parent):
    super(PanelDic, self).__init__(parent)
    grid = Diccionario_2(self)
    grid.AutoSize()
    grid.EnableEditing(False)
    grid.DisableDragGridSize()