RockTableEditor.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:GRIPy 作者: giruenf 项目源码 文件源码
def __init__(self, *args, **kwargs):
        if 'size' not in kwargs:
            kwargs['size'] = (640, 480)

        super(Dialog, self).__init__(*args, **kwargs)

        self._OM = ObjectManager(self)

        self.currentwellindex = 0
        self.currentrocktableindex = 0

        self.tables = []

        self.rocktablemap = [rocktable.uid for rocktable in self._OM.list('rocktable')]
        work_table = []
        for rocktable in self._OM.list('rocktable'):
            work_table.append(RockTable(rocktable.uid))
        self.tables.append(work_table)
        self.grid = wx.grid.Grid(self)
        self.grid.SetDefaultColSize(100)

#        else:
        self.grid.SetTable(self.tables[self.currentwellindex][self.currentrocktableindex])
        self.grid.Bind(wx.grid.EVT_GRID_CELL_LEFT_DCLICK, self.on_cell_dlclick)
        self.grid.Bind(wx.grid.EVT_GRID_LABEL_LEFT_DCLICK, self.on_label_dlclick)

        toolbar_sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.rocktable_choice = wx.Choice(self)
        self.rocktable_choice.AppendItems([self._OM.get(rocktableuid).name for rocktableuid in self.rocktablemap])
        self.rocktable_choice.SetSelection(self.currentrocktableindex)
        self.rocktable_choice.Bind(wx.EVT_CHOICE, self.on_rocktable_choice)

        add_rocktype_button = wx.Button(self, label='ADD ROCK TYPE')
        add_rocktype_button.Bind(wx.EVT_BUTTON, self.on_add_rocktype)

        remove_rocktype_button = wx.Button(self, label='REM ROCK TYPE')
        remove_rocktype_button.Bind(wx.EVT_BUTTON, self.on_remove_rocktype)

        toolbar_sizer.Add(self.rocktable_choice, 1, wx.ALIGN_LEFT)
        toolbar_sizer.Add(add_rocktype_button, 0, wx.ALIGN_LEFT)
        toolbar_sizer.Add(remove_rocktype_button, 0, wx.ALIGN_LEFT)

        main_sizer = wx.BoxSizer(wx.VERTICAL)
        main_sizer.Add(toolbar_sizer, proportion=0, flag=wx.EXPAND)
        main_sizer.Add(self.grid, proportion=1, flag=wx.EXPAND)

        self.SetSizer(main_sizer)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号