76 |
|
|
77 |
class GFwxApp(wxApp): |
class GFwxApp(wxApp): |
78 |
_mainLoop= None |
_mainLoop= None |
79 |
|
|
80 |
def OnInit(self): |
def OnInit(self): |
81 |
GDebug.printMesg(7,"WxApp initializing") |
GDebug.printMesg(7,"WxApp initializing") |
82 |
wxInitAllImageHandlers() |
wxInitAllImageHandlers() |
83 |
return true |
return true |
84 |
|
|
85 |
def MainLoop (self): |
def MainLoop (self): |
86 |
# just to launch one wx's mainloop |
# just to launch one wx's mainloop |
87 |
# otherwise, the app does not finishes cleanly when several windows are open |
# otherwise, the app does not finishes cleanly when several windows are open |
128 |
_PROMPTFORRECORD = self.promptForRecordNumber |
_PROMPTFORRECORD = self.promptForRecordNumber |
129 |
|
|
130 |
self.forms = {} |
self.forms = {} |
131 |
|
|
132 |
self._windowId= wId |
self._windowId= wId |
133 |
self.init() |
self.init() |
134 |
|
|
621 |
menuBar.Append( helpMenu, _("&Help") ) |
menuBar.Append( helpMenu, _("&Help") ) |
622 |
|
|
623 |
window.SetMenuBar( menuBar ) |
window.SetMenuBar( menuBar ) |
624 |
|
|
625 |
return menuBar |
return menuBar |
626 |
|
|
627 |
class UIMainToolBar (UIHelper, UIWidget): |
class UIMainToolBar (UIHelper, UIWidget): |
628 |
def _createWidget (self, event, spacer): |
def _createWidget (self, event, spacer): |
629 |
window= event.interface.mainWindow |
window= event.interface.mainWindow |
630 |
eventBase= event.interface._windowId*1000 |
eventBase= event.interface._windowId*1000 |
631 |
|
|
632 |
# |
# |
633 |
# There has got to be better way to call events to ride off the EVT_MENU |
# There has got to be better way to call events to ride off the EVT_MENU |
634 |
# Ok if i give buttons same id as menu's they share events |
# Ok if i give buttons same id as menu's they share events |
657 |
mainToolBar.AddSimpleTool(eventBase+102, wxImage(images_dir+gConfig('tb_rollback'), wxBITMAP_TYPE_PNG).ConvertToBitmap(), _("Clear Form"), _('Clear Form')) |
mainToolBar.AddSimpleTool(eventBase+102, wxImage(images_dir+gConfig('tb_rollback'), wxBITMAP_TYPE_PNG).ConvertToBitmap(), _("Clear Form"), _('Clear Form')) |
658 |
mainToolBar.AddSimpleTool(eventBase+101, wxImage(images_dir+gConfig('tb_exit'), wxBITMAP_TYPE_PNG).ConvertToBitmap(), _("Exit Form"), _('Exit Form')) |
mainToolBar.AddSimpleTool(eventBase+101, wxImage(images_dir+gConfig('tb_exit'), wxBITMAP_TYPE_PNG).ConvertToBitmap(), _("Exit Form"), _('Exit Form')) |
659 |
mainToolBar.Realize() |
mainToolBar.Realize() |
660 |
|
|
661 |
return mainToolBar |
return mainToolBar |
662 |
|
|
663 |
|
|
717 |
10305: 3, # page down |
10305: 3, # page down |
718 |
10303: 4 # line down |
10303: 4 # line down |
719 |
} |
} |
720 |
|
|
721 |
def _createWidget(self, event, spacer): |
def _createWidget(self, event, spacer): |
722 |
object = event.object |
object = event.object |
723 |
self._page= object.page |
self._page= object.page |
740 |
block.registerScrollBar (self) |
block.registerScrollBar (self) |
741 |
|
|
742 |
return self._widget |
return self._widget |
743 |
|
|
744 |
def scroll (self, event): |
def scroll (self, event): |
745 |
try: |
try: |
746 |
action = GFEvent('requestSCROLL', (self.wxToScroll[event.GetEventType()], self._page)) |
action = GFEvent('requestSCROLL', (self.wxToScroll[event.GetEventType()], self._page)) |
749 |
# ignore; it's not a event we want to handle |
# ignore; it's not a event we want to handle |
750 |
# e.g., click on the sb's handle |
# e.g., click on the sb's handle |
751 |
pass |
pass |
752 |
|
|
753 |
# int position, int thumbSize, int range, int pageSize, const bool refresh = TRUE |
# int position, int thumbSize, int range, int pageSize, const bool refresh = TRUE |
754 |
def update (self, pos, range): |
def update (self, pos, range): |
755 |
# print pos, range |
# print pos, range |
756 |
self._widget.SetScrollbar (pos, 1, range, self._page-1) |
self._widget.SetScrollbar (pos, 1, range, self._page-1) |
757 |
|
|
758 |
|
|
759 |
# |
# |
760 |
# UIButton |
# UIButton |
866 |
value = "" |
value = "" |
867 |
|
|
868 |
newWidget = wxTextCtrl(event.container, -1, value, defaultPoint, defaultSize, styles) |
newWidget = wxTextCtrl(event.container, -1, value, defaultPoint, defaultSize, styles) |
869 |
|
if object.readonly: |
870 |
|
# set the font color to some shade of gray |
871 |
|
# newWidget.SetForegroundColour (wxColour (255, 127, 127)) |
872 |
|
# almost there. |
873 |
|
# newWidget.SetDefaultStyle (wxTextAttr (wxColour (191, 191, 191))) |
874 |
|
pass |
875 |
|
|
876 |
self._eventHandler = event.eventHandler |
self._eventHandler = event.eventHandler |
877 |
_setDefaultEventHandlers(newWidget, event.eventHandler, event.initialize) |
_setDefaultEventHandlers(newWidget, event.eventHandler, event.initialize) |
990 |
message = lineWrap(message,60) |
message = lineWrap(message,60) |
991 |
wxMessageDialog.__init__(self, interface, message, caption, style=wxOK|wxICON_EXCLAMATION) |
wxMessageDialog.__init__(self, interface, message, caption, style=wxOK|wxICON_EXCLAMATION) |
992 |
|
|
993 |
|
|
994 |
# |
# |
995 |
# UIGenericBox |
# UIGenericBox |
996 |
# |
# |
1030 |
idx += 1 |
idx += 1 |
1031 |
|
|
1032 |
button[0].SetDefault() |
button[0].SetDefault() |
1033 |
dlgWidth = max(dlgWidth, buttonSetWidth + 15 * (buttonCount- 1) + 40) |
dlgWidth = max(dlgWidth, buttonSetWidth + 15 * (buttonCount- 1) + 40) |
1034 |
|
|
1035 |
dlgHeight += maxButtonHeight - 6 |
dlgHeight += maxButtonHeight - 6 |
1036 |
|
|
1048 |
if buttonCount > 1: |
if buttonCount > 1: |
1049 |
incr = incr / (buttonCount - 1) |
incr = incr / (buttonCount - 1) |
1050 |
|
|
1051 |
if buttonCount > 1: |
if buttonCount > 1: |
1052 |
currentX = 15 |
currentX = 15 |
1053 |
else: |
else: |
1054 |
currentX = (dlgWidth - buttonSetWidth) / 2 |
currentX = (dlgWidth - buttonSetWidth) / 2 |
1055 |
|
|
1056 |
for buttonLabel in buttonSet: |
for buttonLabel in buttonSet: |
1057 |
button[idx].SetPosition(wxPoint(currentX, dlgHeight - 10 - maxButtonHeight)) |
button[idx].SetPosition(wxPoint(currentX, dlgHeight - 10 - maxButtonHeight)) |
1058 |
currentX += button[idx].GetSize().GetWidth() + incr |
currentX += button[idx].GetSize().GetWidth() + incr |
1069 |
self._result = 0 |
self._result = 0 |
1070 |
|
|
1071 |
return dlg |
return dlg |
1072 |
|
|
1073 |
def getResult(self): |
def getResult(self): |
1074 |
return self._result |
return self._result |
1075 |
|
|
1180 |
not event.ControlDown() and \ |
not event.ControlDown() and \ |
1181 |
not event.AltDown() and \ |
not event.AltDown() and \ |
1182 |
int (gConfig('enterIsNewLine')) and \ |
int (gConfig('enterIsNewLine')) and \ |
1183 |
object.height > 1: |
object.height and object._type != 'GFButton'> 1: |
1184 |
|
|
1185 |
command = 'NEWLINE' |
command = 'NEWLINE' |
1186 |
|
|
1316 |
|
|
1317 |
firstY = bmp.GetHeight() + messageField.GetSize().GetHeight() + 50 |
firstY = bmp.GetHeight() + messageField.GetSize().GetHeight() + 50 |
1318 |
lastY = firstY |
lastY = firstY |
1319 |
xSpacing += 10 # Add whitespace between widgets |
xSpacing += 10 # Add whitespace between widgets |
1320 |
ySpacing += 6 # Add whitespace between widgets |
ySpacing += 6 # Add whitespace between widgets |
1321 |
xPos = dlgWidth/2 - fieldLabelWidth/2 |
xPos = dlgWidth/2 - fieldLabelWidth/2 |
1322 |
|
|
1323 |
|
|