File: helpShortcutsDialog.py

package info (click to toggle)
spe 0.8.2a%2Brepack-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,812 kB
  • ctags: 6,555
  • sloc: python: 45,491; makefile: 146; sh: 2
file content (75 lines) | stat: -rwxr-xr-x 2,780 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#Boa:Dialog:wxDialog1

#(c)www.stani.be                                                                
import _spe.info
INFO=_spe.info.copy()

INFO['description']=\
"""Help dialog showing all the shortcuts."""

__doc__=INFO['doc']%INFO
#_______________________________________________________________________________

import os

#---Boa generated
from wxPython.wx import *

def create(parent,path=''):
    return wxDialog1(parent,path)

[wxID_WXDIALOG1, wxID_WXDIALOG1LISTCTRL1, 
] = map(lambda _init_ctrls: wxNewId(), range(2))

class wxDialog1(wxDialog):
    def _init_coll_listCtrl1_Columns(self, parent):
        # generated method, don't edit

        parent.InsertColumn(col=0, format=wxLIST_FORMAT_LEFT, heading='Key',
              width=170)
        parent.InsertColumn(col=1, format=wxLIST_FORMAT_LEFT,
              heading='Description', width=500)

    def _init_utils(self):
        # generated method, don't edit
        pass

    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wxDialog.__init__(self, id=wxID_WXDIALOG1, name='', parent=prnt,
              pos=wxPoint(119, 108), size=wxSize(486, 376),
              style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxMAXIMIZE_BOX,
              title='Spe - Shorcuts - www.stani.be')
        self._init_utils()
        self.SetClientSize(wxSize(478, 349))

        self.listCtrl1 = wxListCtrl(id=wxID_WXDIALOG1LISTCTRL1,
              name='listCtrl1', parent=self, pos=wxPoint(0, 0), size=wxSize(478,
              349), style=wxLC_REPORT, validator=wxDefaultValidator)
        self._init_coll_listCtrl1_Columns(self.listCtrl1)

    def __init__(self, parent, path):
        #wxImage_AddHandler(wxPNGHandler())
        self._init_ctrls(parent)
        self.init_listCtrl1(path)

    def init_listCtrl1(self,path):
        f=open(os.path.join(path,'dialogs','shortcuts.txt'))
        lines=f.read().split('\n')
        f.close()
        ln=0
        self.il=wxImageList(16, 16)
        self.key = self.il.Add(wxBitmap(os.path.join(path,'images','keyboard.png'),wxBITMAP_TYPE_PNG))
        self.keys = self.il.Add(wxBitmap(os.path.join(path,'images','key_bindings.png'),wxBITMAP_TYPE_PNG))
        self.listCtrl1.SetImageList(self.il, wxIMAGE_LIST_SMALL)

        for line in lines:
            data=line.split('\t')
            if len(data)>2:
                if data[0].replace('SHIFT','').replace('CTRL','').replace('ALT','')==data[0]:
                    self.listCtrl1.InsertImageStringItem(ln,data[0],self.key)
                else:
                    self.listCtrl1.InsertImageStringItem(ln,data[0],self.keys)
                self.listCtrl1.SetStringItem(ln, 1, data[2])
                ln+=1