Ejemplo n.º 1
0
    def __init__(self, parent, model):

        self.parent = parent
        self.model = model
        self.traduit = parent.traduit

        tID = wx.NewId()
        wx.Panel.__init__(self, parent, -1)
        self.tree = MyTreeCtrl(self, tID, wx.TR_HAS_BUTTONS)

        isz1 = (14, 14)
        isz2 = (10, 10)
        il = wx.ImageList(isz1[0], isz1[1])
        foldrid = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz1))
        foldropenid = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz1))
        fileid = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_REPORT_VIEW, wx.ART_OTHER, isz1))
        chekid = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_TICK_MARK, wx.ART_MENU, isz1))
        self.fileid = fileid
        self.chekid = chekid
        self.tree.SetImageList(il)

        self.il = il
        self.listItem = {}
        self.root = self.tree.AddRoot(self.traduit("VUE"))
        self.tree.SetPyData(self.root, None)
        self.tree.SetItemImage(self.root, foldrid, wx.TreeItemIcon_Normal)
        self.tree.SetItemImage(self.root, foldropenid,
                               wx.TreeItemIcon_Expanded)

        self.groupeTrad = []  # liste des groupes traduite
        self.itemTrad = [[], []]  # liste des items francais et traduits

        for groupe in self.getGlistK():
            self.groupeTrad.append(self.traduit(groupe))
            child = self.tree.AppendItem(self.root, self.traduit(groupe))
            self.tree.SetPyData(child, None)
            self.tree.SetItemImage(child, foldrid, wx.TreeItemIcon_Normal)
            self.tree.SetItemImage(child, foldropenid,
                                   wx.TreeItemIcon_Expanded)
            if groupe == '4.Organiques': self.treeRorg = child
            if groupe == '5.A_electrons': self.treeRmin = child
            if groupe == '6.rt3d': self.treeRt3d = child
            if groupe == '7.pht3d': self.treePht3d = child
            if groupe == '8.reactionIsot': self.treeRisot = child
            for item in self.model.getGlist()[groupe]:
                self.itemTrad[0].append(item)
                self.itemTrad[1].append(self.traduit(item))
                last = self.tree.AppendItem(child, self.traduit(item))
                self.tree.SetPyData(last, None)  #self.modelGetData(item))
                self.listItem[item] = [groupe, last]

        self.tree.Expand(self.root)
        self.tree.SortChildren(self.root)

        wx.EVT_TREE_ITEM_RIGHT_CLICK(self, tID, self.OnSelRClick)
        wx.EVT_TREE_ITEM_ACTIVATED(self, tID, self.OnActivate)
Ejemplo n.º 2
0
    def __init__(self, parent):
        """Constructor, creating the reader toolbar."""
        wx.ToolBar.__init__(self,
                            parent,
                            pos=wx.DefaultPosition,
                            size=wx.DefaultSize,
                            style=wx.SIMPLE_BORDER | wx.TB_HORIZONTAL
                            | wx.TB_FLAT | wx.TB_TEXT,
                            name='Reader Toolbar')

        # create bitmaps for toolbar
        tsize = (16, 16)
        if None != ICO_READER:
            bmpReader = wx.Bitmap(ICO_READER, wx.BITMAP_TYPE_ICO)
        else:
            bmpReader = wx.ArtProvider_GetBitmap(wx.ART_HELP_BOOK,
                                                 wx.ART_OTHER, isz)
        if None != ICO_SMARTCARD:
            bmpCard = wx.Bitmap(ICO_SMARTCARD, wx.BITMAP_TYPE_ICO)
        else:
            bmpCard = wx.ArtProvider_GetBitmap(wx.ART_HELP_BOOK, wx.ART_OTHER,
                                               isz)
        self.readercombobox = ReaderComboBox(self)

        # create and add controls
        self.AddSimpleTool(10, bmpReader, "Select smart card reader",
                           "Select smart card reader")
        self.AddControl(self.readercombobox)
        self.AddSeparator()
        self.AddSimpleTool(20, bmpCard, "Connect to smartcard",
                           "Connect to smart card")
        self.AddSeparator()

        self.Realize()
Ejemplo n.º 3
0
 def __init__(self):
     wx.Frame.__init__(self, None, title=u"树表控件", size=(400, 400))
     # 创建树表控件
     self.tree = gizmos.TreeListCtrl(self, -1, style = wx.TR_DEFAULT_STYLE | wx.TR_FULL_ROW_HIGHLIGHT)
     self.il = wx.ImageList(16, 16, True)
     # 给树表添加图标
     self.il.Add(wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, (16,16)))
     self.il.Add(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, (16,16)))
     self.il.Add(wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, (16,16)))
     self.tree.SetImageList(self.il)
     # 添加树表的列
     self.tree.AddColumn(u"第1列")
     self.tree.AddColumn(u"第2列")
     self.tree.AddColumn(u"第3列")
     self.tree.SetColumnWidth(0, 186)
     self.root = self.tree.AddRoot("root")
     self.tree.SetItemText(self.root, "", 1)             # 设置第2列第1行单元格的文本
     self.tree.SetItemText(self.root, "", 2)             # 设置第3列第1行单元格的文本
     for x in range(5):                                  # 设置子节点的文本和图标
         child = self.tree.AppendItem(self.root, str(x))
         self.tree.SetItemText(child, str(x), 0)
         self.tree.SetItemText(child, str(x), 1)
         self.tree.SetItemText(child, str(x), 2)
         self.tree.SetItemImage(child, 0, which = wx.TreeItemIcon_Normal)
         self.tree.SetItemImage(child, 1, which = wx.TreeItemIcon_Expanded)
         for y in range(5):
             last = self.tree.AppendItem(child, str(y))
             self.tree.SetItemText(last, str(x) + "-" + str(y), 0)
             self.tree.SetItemText(last, str(x) + "-" + str(y), 1)
             self.tree.SetItemText(last, str(x) + "-" + str(y), 2)
             self.tree.SetItemImage(last, 0, which = wx.TreeItemIcon_Normal)
             self.tree.SetItemImage(last, 1, which = wx.TreeItemIcon_Expanded)
     self.tree.Expand(self.root)       
Ejemplo n.º 4
0
    def __init__(self,
                 parent,
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize,
                 style=wx.LC_REPORT
                 | wx.BORDER_NONE
                 | wx.LC_SORT_ASCENDING):
        wx.ListCtrl.__init__(self, parent, -1, pos, size, style)
        listmix.ListCtrlAutoWidthMixin.__init__(self)

        isz = (16, 16)
        il = wx.ImageList(isz[0], isz[1])
        self.fldridx = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz))
        self.fldropenidx = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FOLDER_OPEN, wx.ART_OTHER, isz))
        #        fileidx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz))

        self.SetImageList(il, wx.IMAGE_LIST_SMALL)
        # self.InsertColumn(0, 'Bucket Name')

        info = wx.ListItem()
        info.m_mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE | wx.LIST_MASK_FORMAT
        info.m_image = -1
        info.m_format = 0
        info.m_text = 'Bucket Name'
        self.InsertColumnInfo(0, info)

        self.Bind(wx.EVT_COMMAND_RIGHT_CLICK, self.on_right_clicked)
Ejemplo n.º 5
0
def __init__(self, parent,id=wx.ID_ANY, pos=wx.DefaultPosition,
size=wx.DefaultSize,
style=wx.TR_DEFAULT_STYLE |
wx.NO_BORDER):
wx.TreeCtrl.__init__(self, parent, id, pos, size, style)
imglist = wx.ImageList(16, 16, True, 2)
imglist.Add(wx.ArtProvider_GetBitmap(wx.ART_FOLDER,
wx.ART_OTHER, wx.Size(16,16)))
imglist.Add(wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE,
wx.ART_OTHER, wx.Size(16,16)))
self.AssignImageList(imglist)

def populateTreeCtrl(self, datas):
self.datas = {'matrice':datas}
if self.datas['matrice'] == {}:
self.root = self.AddRoot("Root Demo Item")
item1 = self.AppendItem (self.root, "Item1",0)
item2 = self.AppendItem (self.root, "Item2",0)
self.Expand(self.root)
else:
pass


def TestProgram():
app = wx.App(0)
frame = MyFrame(None)
frame.Show()
app.MainLoop()

if __name__ == '__main__':
TestProgram()
Ejemplo n.º 6
0
    def __init__ (self, parent, id, pos=None, size=None, style=None, top=None):
        wx.TreeCtrl.__init__(self, parent, id, pos, size, style)
        self.top            = top
        self.selected       = None
        self.used_for_stalk = None

        # udraw sync class variables.
        self.cc                   = None
        self.udraw                = None
        self.udraw_last_color     = None
        self.udraw_last_color_id  = None
        self.udraw_last_selected  = None
        self.udraw_base_graph     = None
        self.udraw_current_graph  = None
        self.udraw_hit_funcs      = []
        self.udraw_in_function    = False

        # setup our custom target tree list control.
        self.icon_list        = wx.ImageList(16, 16)
        self.icon_folder      = self.icon_list.Add(wx.ArtProvider_GetBitmap(wx.ART_FOLDER,      wx.ART_OTHER, (16, 16)))
        self.icon_folder_open = self.icon_list.Add(wx.ArtProvider_GetBitmap(wx.ART_FOLDER_OPEN, wx.ART_OTHER, (16, 16)))
        self.icon_tag         = self.icon_list.Add(wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, (16, 16)))
        self.icon_selected    = self.icon_list.Add(wx.ArtProvider_GetBitmap(wx.ART_FIND,        wx.ART_OTHER, (16, 16)))
        self.icon_filtered    = self.icon_list.Add(wx.ArtProvider_GetBitmap(wx.ART_CUT,         wx.ART_OTHER, (16, 16)))

        self.SetImageList(self.icon_list)

        self.root = self.AddRoot("Available Targets")
        self.SetPyData(self.root, None)
        self.SetItemImage(self.root, self.icon_folder,      wx.TreeItemIcon_Normal)
        self.SetItemImage(self.root, self.icon_folder_open, wx.TreeItemIcon_Expanded)
Ejemplo n.º 7
0
 def __init__(self, parent):
     wx.TreeCtrl.__init__(self,
                          parent,
                          -1,
                          size=wx.Size(160, 250),
                          style=wx.TR_DEFAULT_STYLE | wx.NO_BORDER)
     root = self.AddRoot("AUI Project")
     items = []
     imglist = wx.ImageList(16, 16, True, 2)
     imglist.Add(
         wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER,
                                  wx.Size(16, 16)))
     imglist.Add(
         wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER,
                                  wx.Size(16, 16)))
     self.AssignImageList(imglist)
     items.append(self.AppendItem(root, "Item 1", 0))
     items.append(self.AppendItem(root, "Item 2", 0))
     items.append(self.AppendItem(root, "Item 3", 0))
     items.append(self.AppendItem(root, "Item 4", 0))
     items.append(self.AppendItem(root, "Item 5", 0))
     for ii in xrange(len(items)):
         id = items[ii]
         self.AppendItem(id, "Subitem 1", 1)
         self.AppendItem(id, "Subitem 2", 1)
         self.AppendItem(id, "Subitem 3", 1)
         self.AppendItem(id, "Subitem 4", 1)
         self.AppendItem(id, "Subitem 5", 1)
     self.root = root
     self.Expand(root)
Ejemplo n.º 8
0
    def __init__(self, *args, **kwargs):
        self.workspace = kwargs.pop('workspace')
        self.shell = kwargs.pop('shell')

        #wx.TreeCtrl.__init__(self, *args, **kwargs)
        VirtualTree.__init__(self, *args, **kwargs)

        isz = (16, 16)
        il = wx.ImageList(isz[0], isz[1])
        self.fldridx = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz))
        self.fldropenidx = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz))
        self.fileidx = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz))

        self.SetImageList(il)
        self.il = il

        self.AddColumn("Name")
        self.AddColumn("Class")
        self.AddColumn("Repr")
        self.SetMainColumn(0)  # the one with the tree in it...
        self.SetColumnWidth(0, 175)

        self.GetMainWindow().Bind(wx.EVT_RIGHT_UP, self.OnRightUp)

        try:
            #this bails on windows - but also doesn't seem to be required
            #under windows - so let it fail quietly
            self.ExpandAllChildren(self.GetRootItem())
        except:
            pass
        self.RefreshItems()
Ejemplo n.º 9
0
    def createTreeView(self, parent, tree):
        tv = CT.CustomTreeCtrl(parent, style =
                         wx.SUNKEN_BORDER | CT.TR_HAS_BUTTONS | CT.TR_HAS_VARIABLE_ROW_HEIGHT
                         | wx.TR_FULL_ROW_HIGHLIGHT
                         | wx.TR_HIDE_ROOT
                         )
        tv.EnableSelectionVista(True)

        isz = (16,16)
        il = wx.ImageList(isz[0], isz[1])
        self.fldridx     = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz))
        self.fldropenidx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FOLDER_OPEN, wx.ART_OTHER, isz))
        self.fileidx     = il.Add(wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz))
        tv.SetImageList(il)

        self.root = tv.AddRoot("Root")

        tv.SetItemImage(self.root, self.fldridx, which = wx.TreeItemIcon_Normal)
        tv.SetItemImage(self.root, self.fldropenidx, which = wx.TreeItemIcon_Expanded)

        for elt in tree[1:]:
            self._rec_createTreeView(tv, elt, self.root)

        tv.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.treeView_DoubleClicked)
        tv.Bind(CT.EVT_TREE_ITEM_CHECKED, self.treeView_Checked)

        tv.SetImageList(il) # redo it (cf a few lines above) as a workaround for a bug on linux
#
# 12/09/08: if you want to have all element tree directly accessible, uncomment the next line: tv.ExpandAll
#
#        tv.ExpandAll()
        return tv
Ejemplo n.º 10
0
    def __init__(self, parent, st):
        wx.TreeCtrl.__init__(self,
                             parent,
                             -1,
                             style=wx.TR_DEFAULT_STYLE | wx.TR_HAS_BUTTONS
                             | wx.TR_HIDE_ROOT)
        self.parent = parent
        if icons:
            isz = (16, 16)
            il = wx.ImageList(isz[0], isz[1])
            self.images = [
                wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz),
                wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz),
                wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz)
            ]

            for icf in ('icons/green.png', 'icons/yellow.png',
                        'icons/red.png'):
                icf = os.path.join(_pype.runpath, icf)
                self.images.append(wx.BitmapFromImage(wx.Image(icf)))

            for i in self.images:
                il.Add(i)
            self.SetImageList(il)
            self.il = il
        self.SORTTREE = st

        self.root = self.AddRoot("Unseen Root")
Ejemplo n.º 11
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, -1)

        self.list = wx.ListCtrl(
            self,
            -1,
            style=wx.LC_LIST
            #| wx.BORDER_SUNKEN
            #| wx.BORDER_NONE
            #| wx.LC_EDIT_LABELS
            #| wx.LC_SORT_ASCENDING
            #| wx.LC_NO_HEADER
            #| wx.LC_VRULES
            #| wx.LC_HRULES
            | wx.LC_SINGLE_SEL)

        self.imagelist = wx.ImageList(16, 16)
        self.imagelist.Add(
            wx.ArtProvider_GetBitmap(wx.ART_NEW, wx.ART_OTHER, (16, 16)))
        self.imagelist.Add(
            wx.ArtProvider_GetBitmap(wx.ART_QUESTION, wx.ART_OTHER, (16, 16)))
        self.imagelist.Add(
            wx.ArtProvider_GetBitmap(wx.ART_REDO, wx.ART_OTHER, (16, 16)))

        self.list.SetImageList(self.imagelist, wx.IMAGE_LIST_SMALL)

        self.list.InsertImageStringItem(0, 'Global', 0)
        self.list.InsertImageStringItem(1, 'Each User', 0)
        self.list.InsertImageStringItem(2, 'Each Iteration', 0)

        import Layout
        Layout.SingleLayout(self, self.list)
Ejemplo n.º 12
0
 def __init__(self):
     wx.Frame.__init__(self, None, -1, "DMS View", size=(500,800))
     self.Bind(wx.EVT_CLOSE, self.OnClose)
     
     mb = wx.MenuBar()
     bookmarks = wx.Menu()
     
     isz = (16,16)
     il = wx.ImageList(isz[0], isz[1])
     il.fldridx     = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FOLDER,      wx.ART_OTHER, isz))
     il.fldropenidx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN,   wx.ART_OTHER, isz))
     il.fileidx     = il.Add(wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz))
     
     mb.Append(bookmarks, "Bookmarks")
     self.SetMenuBar(mb)
     
     self.session = DMSSession([self.OnWorking])
     
     self.notebook = wx.Notebook(self, -1)
     
     self.tree_view = TreeView(self.notebook, self.session, il)
     self.search_view = SearchView(self.notebook, self.session, il)
     
     self.notebook.AddPage(self.tree_view, "Browse Documents")
     self.notebook.AddPage(self.search_view, "Search")
Ejemplo n.º 13
0
    def Reload(self):
        def Load(tree, root, items):
            for item in items:
                if isinstance(item, dict):
                    folder = item.keys()[0]
                    child = tree.AppendItem(root, folder)
                    tree.SetPyData(child, item)
                    tree.SetItemImage(child, self.fldridx,
                                      wx.TreeItemIcon_Normal)
                    tree.SetItemImage(child, self.fldropenidx,
                                      wx.TreeItemIcon_Expanded)
                    Load(tree, child, item[folder])
                elif isinstance(item, tuple):
                    child = tree.AppendItem(root, item[2])
                    tree.SetPyData(child, item)
                    tree.SetItemImage(child, self.fileidx,
                                      wx.TreeItemIcon_Normal)

        self.tree.DeleteAllItems()

        isz = (16, 16)
        il = wx.ImageList(isz[0], isz[1])
        self.fldridx = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz))
        self.fldropenidx = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz))
        self.fileidx = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz))
        self.tree.SetImageList(il)
        self.il = il

        root = self.tree.AddRoot("root")
        self.tree.SetPyData(root, None)
        Load(self.tree, root, self.items)
        self.tree.ExpandAll()
Ejemplo n.º 14
0
    def __init__(self, parent, controller, project=None, **kwargs):
        """

        :param parent:
        :param controller:
        :param project:
        :param kwargs:
        :return:
        """
        id = kwargs.get('id', -1)
        ct.CustomTreeCtrl.__init__(self,
                                   parent,
                                   size=kwargs.get('size', wx.Size(200, 150)),
                                   id=id,
                                   agwStyle=wx.TR_DEFAULT_STYLE)

        self.controller = TreeController(controller, self)

        # Create an image list to add icons next to an item
        self.il = wx.ImageList(16, 16)
        self.fldridx = self.il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, (16, 16)))
        self.fldropenidx = self.il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, (16, 16)))
        self.fileidx = self.il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER,
                                     (16, 16)))

        self.SetImageList(self.il)

        self.controller.do_layout()
Ejemplo n.º 15
0
    def __init__(self, parent, name, pnlitems=[]):
        """
        Keyword arguments:
        parent : parent panel (guiWidgets.PnLTabPanel)
        pnlitems : pandas.DataFrame consisting of all PnL items (FrontPnL > DailyPnL.pnlitems)
        """
        wx.Panel.__init__(self, parent, wx.ID_ANY)#-1
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.pnlitems=pnlitems
        self.parent=parent
        self.name = name 

        self.tree = gizmos.TreeListCtrl(self, wx.ID_ANY)

        isz = (16,16)
        il = wx.ImageList(isz[0], isz[1])
        self.fldridx     = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FOLDER,      wx.ART_OTHER, isz))
        self.fldropenidx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN,   wx.ART_OTHER, isz))
        self.fileidx     = il.Add(wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz))
        #smileidx    = il.Add(images.Smiles.GetBitmap())

        self.tree.SetImageList(il)
        self.il = il

        # create some columns
        self.tree.AddColumn("Book / item")  #0
        self.tree.AddColumn("Total USD P&L")#1
        self.tree.AddColumn("SOD pos.")     #2
        self.tree.AddColumn("EOD pos.")     #3
        self.tree.AddColumn("P(yday)")      #4
        self.tree.AddColumn("P(tday)")      #5
        self.tree.AddColumn("SOD P&L")      #6
        self.tree.AddColumn("Trade P&L")    #7
        for i in range(1,8):
            self.tree.SetColumnAlignment(i,wx.ALIGN_RIGHT)
        self.tree.SetMainColumn(0) # self.the one wiself.th self.the tree in it...
        self.tree.SetColumnWidth(0, 175)

        self.root = self.tree.AddRoot("Total")


        self.treeKeyDc={}
        self.treeCountryDc={}
        self.treeIssuerDc={}
        self.treeBookDc={}



        #self.onFillTree()
        self.onUpdateTree()

        self.tree.Expand(self.root)

        self.tree.GetMainWindow().Bind(wx.EVT_RIGHT_UP, self.OnRightUp)
        self.tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnActivate)

        if self.name == 'live':
            pub.subscribe(self.onRefreshTree, "REFRESH_TREE")
        else:
            pass
Ejemplo n.º 16
0
    def __init__(self,
                  parent,
                  ID=wx.NewId(),
                  pos=wx.DefaultPosition,
                  size=wx.DefaultSize,
                  style=0,
                  clientpanel=None):
        """Constructor. Initializes a smartcard or reader tree control."""
        wx.TreeCtrl.__init__(
            self, parent, ID, pos, size, wx.TR_SINGLE | wx.TR_NO_BUTTONS)

        self.clientpanel = clientpanel
        self.parent = parent

        isz = (16, 16)
        il = wx.ImageList(isz[0], isz[1])
        self.capindex = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_HELP_BOOK, wx.ART_OTHER, isz))
        self.fldrindex = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz))
        self.fldropenindex = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz))
        if None != ICO_SMARTCARD:
            self.cardimageindex = il.Add(
                wx.Bitmap(ICO_SMARTCARD, wx.BITMAP_TYPE_ICO))
        if None != ICO_READER:
            self.readerimageindex = il.Add(
                wx.Bitmap(ICO_READER, wx.BITMAP_TYPE_ICO))
        self.il = il
        self.SetImageList(self.il)
Ejemplo n.º 17
0
    def CreateTreeCtrl(self):
        tree = wx.TreeCtrl(self, -1, wx.Point(0, 0), wx.Size(160, 250),
                           wx.TR_DEFAULT_STYLE | wx.NO_BORDER)

        root = tree.AddRoot("AUI Project")
        items = []

        imglist = wx.ImageList(16, 16, True, 2)
        imglist.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER,
                                     wx.Size(16, 16)))
        imglist.Add(
            wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER,
                                     wx.Size(16, 16)))
        tree.AssignImageList(imglist)

        items.append(tree.AppendItem(root, "Users", 0))
        items.append(tree.AppendItem(root, "Items", 0))
        items.append(tree.AppendItem(root, "Exits", 0))

        for ii in xrange(len(items)):

            id = items[ii]
            tree.AppendItem(id, "Subitem 1", 1)
            tree.AppendItem(id, "Subitem 2", 1)
            tree.AppendItem(id, "Subitem 3", 1)
            tree.AppendItem(id, "Subitem 4", 1)
            tree.AppendItem(id, "Subitem 5", 1)

        tree.Expand(root)

        return tree
Ejemplo n.º 18
0
 def createImageList(self):
     size = (16, 16)
     self.imageList = wx.ImageList(16, 16)
     self.imgDb3 = self.imageList.Add(wx.ArtProvider_GetBitmap('DB3', wx.ART_OTHER, size))
     self.imgTable = self.imageList.Add(wx.ArtProvider_GetBitmap('TABLE', wx.ART_OTHER, size))
     self.imgIndex = self.imageList.Add(wx.ArtProvider_GetBitmap('INDEX', wx.ART_OTHER, size))
     self.SetImageList(self.imageList)
Ejemplo n.º 19
0
    def CreateTree(self):
        def Create(tree, root, items):
            for item in items:
                if isinstance(item, dict) and item is not self.source:
                    folder = item.keys()[0]
                    child = tree.AppendItem(root, folder)
                    tree.SetPyData(child, item[folder])
                    tree.SetItemImage(child, self.fldridx,
                                      wx.TreeItemIcon_Normal)
                    tree.SetItemImage(child, self.fldropenidx,
                                      wx.TreeItemIcon_Expanded)
                    Create(tree, child, item[folder])

        isz = (16, 16)
        il = wx.ImageList(isz[0], isz[1])
        self.fldridx = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz))
        self.fldropenidx = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz))
        self.tree.SetImageList(il)
        self.il = il

        root = self.tree.AddRoot(u'หลัก')
        self.tree.SetPyData(root, self.items)
        Create(self.tree, root, self.items)
        self.tree.ExpandAll()
Ejemplo n.º 20
0
    def __init__(self, parent, id, pos=None, size=None, style=None, top=None):
        wx.TreeCtrl.__init__(self, parent, id, pos, size, style)
        self.top = top
        self.selected = None
        self.used_for_stalk = None

        # setup our custom tree list control.
        self.icon_list = wx.ImageList(16, 16)
        self.icon_folder = self.icon_list.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, (16, 16)))
        self.icon_folder_open = self.icon_list.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FOLDER_OPEN, wx.ART_OTHER,
                                     (16, 16)))
        self.icon_tag = self.icon_list.Add(
            wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER,
                                     (16, 16)))
        self.icon_selected = self.icon_list.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FIND, wx.ART_OTHER, (16, 16)))
        self.icon_filtered = self.icon_list.Add(
            wx.ArtProvider_GetBitmap(wx.ART_CUT, wx.ART_OTHER, (16, 16)))

        self.SetImageList(self.icon_list)

        self.root = self.AddRoot("Modules")
        self.SetPyData(self.root, None)
        self.SetItemImage(self.root, self.icon_folder, wx.TreeItemIcon_Normal)
        self.SetItemImage(self.root, self.icon_folder_open,
                          wx.TreeItemIcon_Expanded)
Ejemplo n.º 21
0
    def __init__(self, parent):
        wx.TreeCtrl.__init__(self,
                             parent,
                             style=wx.TR_HAS_BUTTONS | wx.TR_HIDE_ROOT
                             | wx.TR_NO_LINES)
        self.parent = parent.GetParent()

        isz = (16, 16)
        il = wx.ImageList(isz[0], isz[1])
        self.img0 = fldridx = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz))
        self.img1 = fldropenidx = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz))
        i = wx.EmptyImage(*isz)
        i.SetData(isz[0] * isz[1] * 3 * '\xff')
        self.img2 = fileidx = il.Add(wx.BitmapFromImage(i))

        self.SetImageList(il)
        self.il = il

        self.root = self.AddRoot("The hidden root item")
        self.SetItemImage(self.root, fldridx, wx.TreeItemIcon_Normal)
        self.SetItemImage(self.root, fldropenidx, wx.TreeItemIcon_Expanded)

        self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnActivate, self)

        self.last = ''
        self.lasti = None
        self.pattern = None
Ejemplo n.º 22
0
 def __init__(self, parent, dato_packages=None, idioma=None):
     '''Constructor de clase'''
     # Llamamos al constructor del padre.
     panel_packages.__init__(self, parent)
     # Idioma.
     self.l = idioma
     # Cambiamos idioma de widgets generados con wxFB.
     self.m_button_add_file.SetToolTipString(t(u'Añadir módulo', self.l))
     self.m_button_package.SetToolTipString(t(u'Añadir directorio', self.l))
     self.m_button_eliminar.SetToolTipString(
         t(u'Eliminar módulo / directorio seleccionado', self.l))
     # Configuramos imágenes (iconos) de la jerarquía del árbol.
     isz = (16, 16)
     il = wx.ImageList(isz[0], isz[1])
     self.fldridx = il.Add(
         wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz))
     self.fldropenidx = il.Add(
         wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz))
     self.fileidx = il.Add(
         wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz))
     self.m_treeCtrl_packages.SetImageList(il)
     self.il = il
     # Datos de packages a cargar.
     if dato_packages is not None:
         self.__cargar_datos(dato_packages)
Ejemplo n.º 23
0
    def __init__(self, fs):

        wx.Frame.__init__(self, None, size=(1000, 600))

        self.fs = fs
        self.SetTitle("FS Browser - "+str(fs))

        self.tree = wx.gizmos.TreeListCtrl(self, -1, style=wx.TR_DEFAULT_STYLE | wx.TR_HIDE_ROOT)
        self.tree.AddColumn("File System", 300)
        self.tree.AddColumn("Description", 250)
        self.tree.AddColumn("Size", 150)
        self.tree.AddColumn("Created", 250)
        self.root_id = self.tree.AddRoot('root', data=wx.TreeItemData( {'path':"/", 'expanded':False} ))

        rid = self.tree.GetItemData(self.root_id)

        isz = (16, 16)
        il = wx.ImageList(isz[0], isz[1])
        self.fldridx     = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FOLDER,      wx.ART_OTHER, isz))
        self.fldropenidx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN,   wx.ART_OTHER, isz))
        self.fileidx     = il.Add(wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz))

        self.tree.SetImageList(il)
        self.il = il

        self.tree.SetItemImage(self.root_id, self.fldridx, wx.TreeItemIcon_Normal)
        self.tree.SetItemImage(self.root_id, self.fldropenidx, wx.TreeItemIcon_Expanded)

        self.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.OnItemExpanding)
        self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnItemActivated)


        wx.CallAfter(self.OnInit)
Ejemplo n.º 24
0
    def update_tree(self, top_cell):
        self.top_cell = top_cell
        self.tree.DeleteAllItems()
        
        isz = (16,16)
        il = wx.ImageList(isz[0], isz[1])
        fldridx     = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FOLDER,      wx.ART_OTHER, isz))
        fldropenidx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN,   wx.ART_OTHER, isz))
        fileidx     = il.Add(wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz))

        self.tree.SetImageList(il)
        self.il = il
        
        #helper function to parse cell data into nice string
        def parse_cell(cell, adress):
            if cell.name == '':
                cell_str = 'Unnamed, '
            else:
                cell_str = cell.name + ', '
            
            cell_str += 'id: ' + str(cell.id) + ', adress: ('
            c = 0
            for ad in adress:
                if c == 1:
                    cell_str += ', '
                cell_str += str(ad)
                c = 1
            cell_str += ')'
            return cell_str
        
        self.tree_items = {}
        
        #set top cell (root item in tree)
        self.tree_items[(0,)] = self.tree.AddRoot(parse_cell(self.top_cell, (0,)))
        self.tree.SetPyData(self.tree_items[(0,)], (0,))
        self.tree.SetItemImage(self.tree_items[(0,)], fldridx, wx.TreeItemIcon_Normal)
        self.tree.SetItemImage(self.tree_items[(0,)], fldropenidx, wx.TreeItemIcon_Expanded)
        self.tree.SelectItem(self.tree_items[(0,)])
        
        def add_sub_cells(cell, previous_adress):
            for ind in cell.cells.keys():
                subcell = cell.cells[ind]
                #change adress
                adress = list(previous_adress)
                adress.append(subcell.id)
                adress = tuple(adress)
                
                #add item to tree
                self.tree_items[adress] = self.tree.AppendItem(self.tree_items[previous_adress], parse_cell(subcell, adress))
                self.tree.SetPyData(self.tree_items[adress], adress)
                self.tree.SetItemImage(self.tree_items[adress], fldridx, wx.TreeItemIcon_Normal)
                self.tree.SetItemImage(self.tree_items[adress], fldropenidx, wx.TreeItemIcon_Expanded)
                
                #call function recursively to catch all cells
                add_sub_cells(subcell, adress)
        
        add_sub_cells(self.top_cell, (0,))
        
        self.tree.ExpandAll()
Ejemplo n.º 25
0
    def __init__(self,
                 parent,
                 id=wx.ID_ANY,
                 title="ButtonPanel wxPython Demo ;-)",
                 pos=wx.DefaultPosition,
                 size=(640, 400),
                 style=wx.DEFAULT_FRAME_STYLE):

        wx.Frame.__init__(self, parent, id, title, pos, size, style)

        self.useredited = False
        self.hassettingpanel = False

        #         self.SetIcon(images.Mondrian.GetIcon())
        self.CreateMenuBar()

        self.statusbar = self.CreateStatusBar(2, wx.ST_SIZEGRIP)
        self.statusbar.SetStatusWidths([-2, -1])
        # statusbar fields
        statusbar_fields = [
            ("ButtonPanel wxPython Demo, Andrea Gavana @ 02 Oct 2006"),
            ("Welcome To wxPython!")
        ]

        for i in range(len(statusbar_fields)):
            self.statusbar.SetStatusText(statusbar_fields[i], i)

        self.mainPanel = wx.Panel(self, -1)
        self.logtext = wx.TextCtrl(self.mainPanel,
                                   -1,
                                   "",
                                   style=wx.TE_MULTILINE | wx.TE_READONLY)

        vSizer = wx.BoxSizer(wx.VERTICAL)
        self.mainPanel.SetSizer(vSizer)

        self.alignments = [
            bp.BP_ALIGN_LEFT, bp.BP_ALIGN_RIGHT, bp.BP_ALIGN_TOP,
            bp.BP_ALIGN_BOTTOM
        ]

        self.alignment = bp.BP_ALIGN_LEFT
        self.agwStyle = bp.BP_USE_GRADIENT

        self.titleBar = bp.ButtonPanel(self.mainPanel,
                                       -1,
                                       "A Simple Test & Demo",
                                       agwStyle=self.agwStyle,
                                       alignment=self.alignment)

        self.created = False
        self.pngs = [
            (wx.ArtProvider_GetBitmap(wx.ART_GO_BACK), 'label1'),
            (wx.ArtProvider_GetBitmap(wx.ART_GO_BACK), 'label2'),
            (wx.ArtProvider_GetBitmap(wx.ART_GO_BACK), 'label3'),
            (wx.ArtProvider_GetBitmap(wx.ART_GO_BACK), 'label4'),
        ]
        self.CreateButtons()
        self.SetProperties()
Ejemplo n.º 26
0
 def __init__(self, mainwindow, parent, id, style):
     wx.TreeCtrl.__init__(self, parent, id, style=style)
     self.parent=parent
     self.mainwindow=mainwindow
     wx.EVT_TREE_ITEM_EXPANDED(self, id, self.OnItemExpanded)
     wx.EVT_TREE_SEL_CHANGED(self,id, self.OnItemSelected)
     self.dirmenu=wx.Menu()
     self.dirmenu.Append(guihelper.ID_FV_NEWSUBDIR, "Make subdirectory ...")
     self.dirmenu.Append(guihelper.ID_FV_NEWFILE, "New File ...")
     self.dirmenu.AppendSeparator()
     self.dirmenu.Append(guihelper.ID_FV_BACKUP, "Backup directory ...")
     self.dirmenu.Append(guihelper.ID_FV_BACKUP_TREE, "Backup entire tree ...")
     self.dirmenu.Append(guihelper.ID_FV_RESTORE, "Restore ...")
     self.dirmenu.AppendSeparator()
     self.dirmenu.Append(guihelper.ID_FV_REFRESH, "Refresh")
     self.dirmenu.AppendSeparator()
     self.dirmenu.Append(guihelper.ID_FV_DELETE, "Delete")
     self.dirmenu.AppendSeparator()
     self.dirmenu.Append(guihelper.ID_FV_TOTAL_REFRESH, "Refresh Filesystem")
     self.dirmenu.Append(guihelper.ID_FV_OFFLINEPHONE, "Offline Phone")
     self.dirmenu.Append(guihelper.ID_FV_REBOOTPHONE, "Reboot Phone")
     self.dirmenu.Append(guihelper.ID_FV_MODEMMODE, "Go to modem mode")
     # generic menu
     self.genericmenu=wx.Menu()
     self.genericmenu.Append(guihelper.ID_FV_TOTAL_REFRESH, "Refresh Filesystem")
     self.genericmenu.Append(guihelper.ID_FV_OFFLINEPHONE, "Offline Phone")
     self.genericmenu.Append(guihelper.ID_FV_REBOOTPHONE, "Reboot Phone")
     self.genericmenu.Append(guihelper.ID_FV_MODEMMODE, "Go to modem mode")
     wx.EVT_MENU(self.genericmenu, guihelper.ID_FV_TOTAL_REFRESH, self.OnRefresh)
     wx.EVT_MENU(self.genericmenu, guihelper.ID_FV_OFFLINEPHONE, parent.OnPhoneOffline)
     wx.EVT_MENU(self.genericmenu, guihelper.ID_FV_REBOOTPHONE, parent.OnPhoneReboot)
     wx.EVT_MENU(self.genericmenu, guihelper.ID_FV_MODEMMODE, parent.OnModemMode)
     wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_NEWSUBDIR, self.OnNewSubdir)
     wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_NEWFILE, self.OnNewFile)
     wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_DELETE, self.OnDirDelete)
     wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_BACKUP, self.OnBackupDirectory)
     wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_BACKUP_TREE, self.OnBackupTree)
     wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_RESTORE, self.OnRestore)
     wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_REFRESH, self.OnDirRefresh)
     wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_TOTAL_REFRESH, self.OnRefresh)
     wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_OFFLINEPHONE, parent.OnPhoneOffline)
     wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_REBOOTPHONE, parent.OnPhoneReboot)
     wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_MODEMMODE, parent.OnModemMode)
     wx.EVT_RIGHT_DOWN(self, self.OnRightDown)
     wx.EVT_RIGHT_UP(self, self.OnRightUp)
     self.image_list=wx.ImageList(16, 16)
     self.img_dir=self.image_list.Add(wx.ArtProvider_GetBitmap(guihelper.ART_FOLDER,
                                                          wx.ART_OTHER,
                                                          (16, 16)))
     self.img_dir_open=self.image_list.Add(wx.ArtProvider_GetBitmap(guihelper.ART_FOLDER_OPEN,
                                                          wx.ART_OTHER,
                                                          (16, 16)))
     self.SetImageList(self.image_list)
     self.add_files=[]
     self.add_target=""
     self.droptarget=fileview.MyFileDropTarget(self, True, True)
     self.SetDropTarget(self.droptarget)
     self.ResetView()
Ejemplo n.º 27
0
        def __init__(self, parent, orientation=wx.HORIZONTAL, show_images=1):
            TreebookDialog.__init__(self, parent, wx.Size(500, 400),
                                    orientation)

            #create some panels...
            MyAboutPanel = AboutPanel(self, str_about + "---" + str_version)
            MyHowPanel = AboutPanel(self, str_how)
            MyTodoPanel = AboutPanel(self, str_todo)
            MyEmptyPanel = ColorPanel(self)  #Will appear twice in the treebook
            MyRedPanel = ColorPanel(self, "red")
            MyGreenPanel = ColorPanel(self, "green")
            MyBluePanel = ColorPanel(self, "blue")
            MyYellowPanel = ColorPanel(self, "yellow")

            items = []  #will be used for adding icons to the treectrl items
            child = self.AddPage(self.root, "About", MyAboutPanel)
            items.append(child)
            items.append(self.AddPage(child, "How", MyHowPanel))
            items.append(self.AddPage(child, "Todo", MyTodoPanel))
            child = self.AddPage(self.root, "Colour panels", MyEmptyPanel)
            items.append(child)
            items.append(self.AddPage(child, "Red", MyRedPanel))
            items.append(self.AddPage(child, "Green", MyGreenPanel))
            child = self.AddPage(self.root, "More panels", MyEmptyPanel)
            items.append(child)
            items.append(self.AddPage(child, "Blue", MyBluePanel))
            items.append(self.AddPage(child, "Yellow", MyYellowPanel))

            self.ShowPage(items[0])  #show (and select) the "about" page
            #caution, the following is only safe if the item has children!
            self.tree.Expand(items[0])  #expand the "about" children

            #Add a few images to the treectrl (if show_images is true)
            if show_images:
                isz = (16, 16)
                il = wx.ImageList(isz[0], isz[1])
                fld = il.Add(
                    wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz))
                fldo = il.Add(
                    wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER,
                                             isz))
                file = il.Add(
                    wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER,
                                             isz))
                self.tree.SetImageList(il)
                for it in items:
                    if self.tree.ItemHasChildren(it):  #use a folder icon
                        self.tree.SetItemImage(it, fld, wx.TreeItemIcon_Normal)
                        self.tree.SetItemImage(it, fldo,
                                               wx.TreeItemIcon_Expanded)
                    else:  #use a file icon
                        self.tree.SetItemImage(it, file,
                                               wx.TreeItemIcon_Normal)

                self.tree.il = il  #This prevents the imagelist from being lost
    def LoadItems(self, fonttree, fontdb):
        # NOTE:  For some reason tree items have to have a data object in
        #        order to be sorted.  Since our compare just uses the labels
        #        we don't need any real data, so we'll just use None below for
        #        the item data.

        def LoadFontTree(atree, current_root):
            def AddFontInfo(wxitem, treenode):
                self.tree.SetItemText(wxitem, "AaBbCcDdEe")
                f = wx.Font(30, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False)
                (_, fontface) = flist[treenode.ptr]
                f.SetFaceName(fontface)
                self.tree.SetItemFont(wxitem, f)
                self.tree.SetPyData(wxitem, None)

            if TREE_LEAF == atree.type():
                item = self.tree.AppendItem(current_root, "rhubarb")
                AddFontInfo(item, atree)
            else:
                child = self.tree.AppendItem(current_root, "")
                self.tree.SetPyData(child, None)
                self.tree.SetItemImage(child, fldridx, wx.TreeItemIcon_Normal)
                self.tree.SetItemImage(child, fldropenidx,
                                       wx.TreeItemIcon_Expanded)
                if TREE_LEAF == atree.lt.type():
                    AddFontInfo(child, atree.lt)
                    LoadFontTree(atree.rt, child)
                elif TREE_LEAF == atree.rt.type():
                    AddFontInfo(child, atree.rt)
                    LoadFontTree(atree.lt, child)
                else:
                    LoadFontTree(atree.lt, child)
                    LoadFontTree(atree.rt, child)
                self.tree.Expand(child)

        il = self.il
        isz = self.isz
        fldridx = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz))
        fldropenidx = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz))
        fileidx = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz))

        self.root = self.tree.AddRoot("The Root Item")
        self.tree.SetPyData(self.root, None)
        self.tree.SetItemImage(self.root, fldridx, wx.TreeItemIcon_Normal)
        self.tree.SetItemImage(self.root, fldropenidx,
                               wx.TreeItemIcon_Expanded)

        flist = fontdb.GetFontList()

        LoadFontTree(fonttree, self.root)

        self.tree.Expand(self.root)
Ejemplo n.º 29
0
    def __init__(self,
                 parent,
                 id=-1,
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize,
                 style=wx.TAB_TRAVERSAL | wx.NO_BORDER,
                 name=wx.PanelNameStr):
        """Initialize the HTML viewer"""
        NbookPanel.__init__(self, parent, id, pos, size, style, name)
        self.Tag = "ImgView"
        self.Title = _("Image Library")
        self.icon = wx.ArtProvider_GetBitmap(str(ed_glob.ID_DECA_IMAGES),
                                             wx.ART_MENU, wx.Size(16, 16))

        bSizer = wx.BoxSizer(wx.VERTICAL)

        self.mtb = aui.AuiToolBar(self, -1, agwStyle=aui.AUI_TB_HORZ_LAYOUT)
        self.mtb.SetToolBitmapSize(wx.Size(16, 16))
        tbmp = wx.ArtProvider_GetBitmap(str(ed_glob.ID_ADD), wx.ART_MENU,
                                        wx.Size(16, 16))
        self.mtb.AddTool(wx.ID_ADD, '', tbmp, tbmp, wx.ITEM_NORMAL,
                         _("Add image"), _("Import image into the library"),
                         None)
        tbmp = wx.ArtProvider_GetBitmap(str(ed_glob.ID_REMOVE), wx.ART_MENU,
                                        wx.Size(16, 16))
        self.mtb.AddTool(wx.ID_REMOVE, '', tbmp, tbmp, wx.ITEM_NORMAL,
                         _("Remove image"),
                         _("Remove imeage from the library"), None)
        tbmp = wx.ArtProvider_GetBitmap(str(ed_glob.ID_REFRESH), wx.ART_MENU,
                                        wx.Size(16, 16))
        self.mtb.AddTool(wx.ID_REFRESH, '', tbmp, tbmp, wx.ITEM_NORMAL,
                         _("Refresh"), _("Reload library contents"), None)
        self.mtb.Realize()

        bSizer.Add(self.mtb, proportion=0, flag=wx.EXPAND, border=5)
        self.view = wx.ListCtrl(self,
                                wx.ID_ANY,
                                style=wx.LC_ICON | wx.LC_AUTOARRANGE)
        #self.view = libul.UltimateListCtrl( self, agwStyle=wx.LC_ICON|wx.LC_AUTOARRANGE| libul.ULC_AUTOARRANGE)
        #self.view.InsertColumn(0, heading="", width= 220)
        #self.view.InsertColumn(1, heading="", width= 220)

        bSizer.Add(self.view, proportion=1, flag=wx.EXPAND, border=0)

        self.SetSizer(bSizer)
        self.Layout()

        self.items = []

        self.Bind(wx.EVT_MENU, self.OnAddImage, id=wx.ID_ADD)
        self.Bind(wx.EVT_MENU, self.OnDelete, id=wx.ID_REMOVE)
        self.Bind(wx.EVT_MENU, self.UpdateView, id=wx.ID_REFRESH)
        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected, self.view)

        wx.CallAfter(self.UpdateView)
Ejemplo n.º 30
0
 def __create_image_list(self):
     """Setup our image list for the tree control"""
     isz = (16, 16)
     il = wx.ImageList(*isz)
     self.folder_idx = il.Add(
         wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz))
     self.folder_open_idx = il.Add(
         wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz))
     self.file_idx = il.Add(
         wx.ArtProvider_GetBitmap(wx.ART_REPORT_VIEW, wx.ART_OTHER, isz))
     self.il = il