Package mcbase :: Package libs :: Package designeditor :: Module textdrawtoolbar
[hide private]
[frames] | no frames]

Source Code for Module mcbase.libs.designeditor.textdrawtoolbar

 1  # -*- coding: utf-8 -*- 
 2   
 3  ########################################################################## 
 4  # textdrawtoolbar.py 
 5  # 
 6  # Text raporları için çizgi karakterlerini gösterir. 
 7  # 
 8  # (C) 2007 Likya Yazılım ve Bilişim Hizmetleri Ltd. Şti. 
 9  ########################################################################## 
10   
11  from PyQt4.QtCore import * 
12  from PyQt4.QtGui import * 
13   
14  from toolbar import ToolBar 
15  from editor import Editor 
16   
17 -class TextDrawToolBar(ToolBar):
18
19 - def preInitToolBar(self):
20 ''' 21 ToolBar ile ilgili ilk ayarları yapar. 22 ''' 23 self._actionCodes = [ 24 '250C', # ┌ 25 '2500', # ─ 26 '2510', # ┐ 27 '2502', # │ 28 '2514', # └ 29 '2518', # ┘ 30 '2524', # ┤ 31 '2534', # ┴ 32 '252C', # ┬ 33 '251C', # ├ 34 '253C', # ┼ 35 ]
36
37 - def initToolBar(self):
38 ''' 39 ToolBar ile ilgili özel ayarları yapar. 40 ''' 41 group = QActionGroup(self) 42 group.setExclusive(True) 43 44 for actionCode in self._actionCodes: 45 action = self.getAction('character%s' % actionCode) 46 action.setCheckable(True) 47 action.setData(QVariant(unichr(int(actionCode, 16)))) 48 49 group.addAction(action) 50 51 self.connect(self._editor, SIGNAL('editorModeChanged(int)'), self.editorModeChanged) 52 self.connect(group, SIGNAL('triggered(QAction *)'), self.characterPressed)
53
54 - def editorModeChanged(self, newMode):
55 ''' 56 Editör modu değiştiğinde gerekli düğmelerdeki ayarlar yapılır. 57 ''' 58 if newMode != Editor.MODE_ADDLINECHARACTER: 59 for actionCode in self._actionCodes: 60 action = self.getAction('character%s' % actionCode) 61 action.setChecked(False)
62
63 - def characterPressed(self, action):
64 ''' 65 Herhangi bir çizgi karaktere basıldığında çalışır. 66 ''' 67 if action.isChecked(): 68 self._editor.setMode(Editor.MODE_ADDLINECHARACTER) 69 self._editor.setAddLineCharacter(unicode(action.data().toString())) 70 71 else: 72 self._editor.resetMode()
73
74 - def getToolbarItems(self):
75 ''' 76 Toolbar'da nelerin olacağını belirler. 77 ''' 78 toolbarItems = [] 79 80 for actionCode in self._actionCodes: 81 item = ('character%s' % actionCode, tr('Çizgi karakterini ekle'), '', tr('İlgili çizgi karakterini, editöre ekler.')) 82 83 toolbarItems.append(item) 84 85 return toolbarItems
86