当前位置: 首页>>代码示例>>Python>>正文


Python ScrolledPanel.ref方法代码示例

本文整理汇总了Python中wx.lib.scrolledpanel.ScrolledPanel.ref方法的典型用法代码示例。如果您正苦于以下问题:Python ScrolledPanel.ref方法的具体用法?Python ScrolledPanel.ref怎么用?Python ScrolledPanel.ref使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wx.lib.scrolledpanel.ScrolledPanel的用法示例。


在下文中一共展示了ScrolledPanel.ref方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: OpenFile

# 需要导入模块: from wx.lib.scrolledpanel import ScrolledPanel [as 别名]
# 或者: from wx.lib.scrolledpanel.ScrolledPanel import ref [as 别名]
 def OpenFile(self, item):
     if item in self._opened_files:
         self._tabs_view.SetSelection(self._tabs_view.GetPageIndex(self._tabs[item]))
     elif not item.dir and not item in self._opened_files:
         self._opened_files.append(item)
         # then we create new tab in the tabs view
         if self._tabs_view:
             if item.type == "Context" or item.type == "Scale":
                 newtab = contextgrid.ContextGrid(self._tabs_view)
                 newtab.SetTable(contextgrid.ContextTable(item, self))
             elif item.type == "Many-valued context":
                 newtab = contextgrid.MVContextGrid(self._tabs_view)
                 newtab.SetTable(contextgrid.MVContextTable(item, self))
             elif item.type == "Image":
                 png = wx.Image(item.path, wx.BITMAP_TYPE_PNG).ConvertToBitmap()
                 newtab = ScrolledPanel(self._tabs_view, -1)
                 wx.StaticBitmap(newtab, -1, png, (10, 10), (png.GetWidth(), png.GetHeight()))
                 newtab.SetScrollRate(20,20)
                 newtab.SetVirtualSize((png.GetWidth() + 20, png.GetHeight() + 20))
             elif item.type == "Concepts":
                 dlg = wx.SingleChoiceDialog(
                         None, 'What do you want to do?', 'Choose variant',
                         ["View diagram", "View concepts", "Table"], 
                         wx.CHOICEDLG_STYLE
                         )
                 if dlg.ShowModal() == wx.ID_OK:
                     what = dlg.GetStringSelection()
                 else:
                     what = "Do nothing"
                 dlg.Destroy()
                     
                 if what == "View concepts":
                     newtab = wx.TextCtrl(self._tabs_view, -1, "", size=(200, 100), 
                                      style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_WORDWRAP)
                     newtab.SetFont(wx.Font(12, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL,
                                        wx.FONTWEIGHT_NORMAL))
                     cs = uread_xml(item.path)
                     for concept in cs:
                         s = u"[{0} : {1}] @ {2}\n".format(", ".join(concept.extent),
                                                          ", ".join(concept.intent),
                                                          concept.meta)
                         newtab.WriteText(s)
                 elif what == "View diagram":
                     newtab = diagramview.DiagramWindow(self._tabs_view, 
                                                        wx.NewId(),
                                                        filename=item.name,
                                                        path=item.path)
                 elif what == "Table":
                     table = conceptsystemgrid.ConceptSystemTable(uread_xml(item.path))
                     newtab = conceptsystemgrid.ConceptSystemGrid(self._tabs_view)
                     newtab.SetTable(table)
                 elif what == "Do nothing":
                     self._opened_files.pop()
                     return
             else:
                 newtab = wx.TextCtrl(self._tabs_view, -1, "", size=(200, 100), 
                                  style=wx.TE_MULTILINE|wx.TE_READONLY)
                 newtab.SetFont(wx.Font(14, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL,
                                    wx.FONTWEIGHT_NORMAL))
                 newtab.LoadFile(item.path)
             
             # TODO:
             newtab.ref = item
             self._tabs[item] = newtab
                 
             self._tabs_view.AddPage(newtab, item.name, True)
开发者ID:jupp,项目名称:meud-wx,代码行数:68,代码来源:tabsmodel.py


注:本文中的wx.lib.scrolledpanel.ScrolledPanel.ref方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。