commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

r6301 - in trunk/gnue-forms/src/uidrivers: gtk2 html win32 wx


From: johannes
Subject: r6301 - in trunk/gnue-forms/src/uidrivers: gtk2 html win32 wx
Date: Thu, 16 Sep 2004 08:36:38 -0500 (CDT)

Author: johannes
Date: 2004-09-16 08:36:37 -0500 (Thu, 16 Sep 2004)
New Revision: 6301

Removed:
   trunk/gnue-forms/src/uidrivers/gtk2/ErrorHandler.py
   trunk/gnue-forms/src/uidrivers/html/ErrorHandler.py
   trunk/gnue-forms/src/uidrivers/win32/ErrorHandler.py
   trunk/gnue-forms/src/uidrivers/wx/ErrorHandler.py
Modified:
   trunk/gnue-forms/src/uidrivers/gtk2/README
   trunk/gnue-forms/src/uidrivers/gtk2/__init__.py
   trunk/gnue-forms/src/uidrivers/html/__init__.py
   trunk/gnue-forms/src/uidrivers/win32/UILoginHandler.py
   trunk/gnue-forms/src/uidrivers/win32/__init__.py
   trunk/gnue-forms/src/uidrivers/wx/__init__.py
Log:
Removed obsolete ErrorHandler.py and it's functions


Deleted: trunk/gnue-forms/src/uidrivers/gtk2/ErrorHandler.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/gtk2/ErrorHandler.py 2004-09-16 13:22:40 UTC 
(rev 6300)
+++ trunk/gnue-forms/src/uidrivers/gtk2/ErrorHandler.py 2004-09-16 13:36:37 UTC 
(rev 6301)
@@ -1,103 +0,0 @@
-# GNU Enterprise Forms - GTK UI driver - Errorhandler
-#
-# Copyright 2001-2004 Free Software Foundation
-#
-# This file is part of GNU Enterprise
-#
-# GNU Enterprise is free software; you can redistribute it
-# and/or modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; either
-# version 2, or (at your option) any later version.
-#
-# GNU Enterprise is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with program; see the file COPYING. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place
-# - Suite 330, Boston, MA 02111-1307, USA.
-#
-# $Id$
-
-import gtk
-import sys
-import types
-import string
-import traceback
-
-from gnue.common.apps import i18n
-
-
-
-# -----------------------------------------------------------------------------
-# Handle an error on startup of an application
-# -----------------------------------------------------------------------------
-
-def handleStartupError (errortext):
-  text = "%s" % errortext
-  if isinstance (text, types.StringType):
-    text = unicode (text, i18n.encoding)
-  print
-  print '-' * 60
-  print o(u_("Error: %s") % text)
-  print '-' * 60
-
-  _StartupErrorDisplay (text)
-
-  sys.exit ()
-
-
-def handleUncaughtException (extype, exvalue, traceback):
-  print "Catch the uncaught"
-  # If we throw an exception, we don't want circular calls
-  sys.excepthook = sys.__excepthook__
-
-  _ExceptionDisplay (extype, exvalue, traceback)
-
-  # Restore exception handler
-  sys.excepthook = handleUncaughtException
-
-
-# =============================================================================
-# This class provides a message box for startup errors
-# =============================================================================
-
-class _StartupErrorDisplay (gtk.MessageDialog):
-  def __init__(self, errortext):
-    message = u_('Unable to start GNUe Forms:\n\n%s') % errortext
-    
-    gtk.MessageDialog.__init__ (self, None,
-                gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
-                gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE, message)
-
-    self.show_all ()
-    self.connect ('response', lambda dialog, response: gtk.mainquit ())
-
-    gtk.main ()
-
-
-# =============================================================================
-# This class provides a message box for uncaught exceptions
-# =============================================================================
-
-class _ExceptionDisplay (gtk.MessageDialog):
-  def __init__(self, exType, exValue, tbObject):
-    sType  = unicode ("%s" % exType, i18n.encoding)
-    sValue = unicode ("%s" % exValue, i18n.encoding)
-    tLines = traceback.format_exception (exType, exValue, tbObject)
-    sTrace = unicode (string.join (tLines), i18n.encoding)
-
-    message = u_("Exception occured in GNUe Forms:\n"
-                 "%(exType)s\n%(exValue)s\n\n%(trace)s") \
-              % {'exType' : sType,
-                 'exValue': sValue,
-                 'trace'  : sTrace}
-   
-    gtk.MessageDialog.__init__ (self, None,
-                gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
-                gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE, message)
-
-    self.show_all ()
-    self.connect ('response', lambda dialog, response: dialog.destroy ())

Modified: trunk/gnue-forms/src/uidrivers/gtk2/README
===================================================================
--- trunk/gnue-forms/src/uidrivers/gtk2/README  2004-09-16 13:22:40 UTC (rev 
6300)
+++ trunk/gnue-forms/src/uidrivers/gtk2/README  2004-09-16 13:36:37 UTC (rev 
6301)
@@ -1,19 +1,10 @@
-TODO: 
-  - Move this description into global forms documentation directory, or
-    to installation manual
-    
 GTK2 UI driver.
 
 To get this driver running i installed these packages (under Debian):
-  python2.2, python2.2-gtk2, python2.2-xmlbase, python2.2-xml,
-  python2.2-pgsql, python2.2-popy, python2.2-psycopg
+  python-gtk2
 as well as their dependencies.
 
-At least on my system i was unable to get wxPython for python2.2 working
-so could not have both wx and gtk2 based on python2.2 interfaces running.
 
-<works for debian unstable (May/2003)>
-
 To get this driver running on win32, install:
   1. GTK-Runtime-Environment from http://prdownloads.sourceforge.net/gtk-win/
     (don't forget to append c:\Program Files\Common Files\Gtk\2.0\lib to your 
path)

Modified: trunk/gnue-forms/src/uidrivers/gtk2/__init__.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/gtk2/__init__.py     2004-09-16 13:22:40 UTC 
(rev 6300)
+++ trunk/gnue-forms/src/uidrivers/gtk2/__init__.py     2004-09-16 13:36:37 UTC 
(rev 6301)
@@ -1,4 +1,3 @@
 from UIdriver import GFUserInterface
 from UILoginHandler import *
-from ErrorHandler import handleStartupError, handleUncaughtException
 from GFApp import getApp

Deleted: trunk/gnue-forms/src/uidrivers/html/ErrorHandler.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/html/ErrorHandler.py 2004-09-16 13:22:40 UTC 
(rev 6300)
+++ trunk/gnue-forms/src/uidrivers/html/ErrorHandler.py 2004-09-16 13:36:37 UTC 
(rev 6301)
@@ -1,40 +0,0 @@
-#
-# This file is part of GNU Enterprise.
-#
-# GNU Enterprise is free software; you can redistribute it
-# and/or modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; either
-# version 2, or (at your option) any later version.
-#
-# GNU Enterprise is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with program; see the file COPYING. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place
-# - Suite 330, Boston, MA 02111-1307, USA.
-#
-# Copyright 2000-2004 Free Software Foundation
-#
-# FILE:
-# uidrivers/html/ErrorHandler.py
-#
-# DESCRIPTION:
-#
-# NOTES:
-#
-
-import sys
-
-
-def handleStartupError(errortext):
-  print
-  print '-' * 60
-  print o (u_("Error: %s") % errortext)
-  print '-' * 60
-
-  print
-
-  sys.exit()

Modified: trunk/gnue-forms/src/uidrivers/html/__init__.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/html/__init__.py     2004-09-16 13:22:40 UTC 
(rev 6300)
+++ trunk/gnue-forms/src/uidrivers/html/__init__.py     2004-09-16 13:36:37 UTC 
(rev 6301)
@@ -1,3 +1,2 @@
 from UIdriver import GFUserInterface
 from UILoginHandler import *
-from ErrorHandler import handleStartupError

Deleted: trunk/gnue-forms/src/uidrivers/win32/ErrorHandler.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/win32/ErrorHandler.py        2004-09-16 
13:22:40 UTC (rev 6300)
+++ trunk/gnue-forms/src/uidrivers/win32/ErrorHandler.py        2004-09-16 
13:36:37 UTC (rev 6301)
@@ -1,45 +0,0 @@
-#
-# This file is part of GNU Enterprise.
-#
-# GNU Enterprise is free software; you can redistribute it
-# and/or modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; either
-# version 2, or (at your option) any later version.
-#
-# GNU Enterprise is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with program; see the file COPYING. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place
-# - Suite 330, Boston, MA 02111-1307, USA.
-#
-# Copyright 2000-2004 Free Software Foundation
-#
-# FILE:
-# win32/ErrorHandler.py
-#
-# DESCRIPTION:
-# A PyWin32 based user interface driver for GNUe forms.
-#
-# NOTES:
-#
-
-import sys
-import win32gui, win32con
-
-
-def handleStartupError(errortext):
-  print
-  print '-' * 60
-  print o (u_("Error: %s") % errortext)
-  print '-' * 60
-
-  print
-
-  flags = win32con.MB_OK | win32con.MB_ICONERROR | win32con.MB_TASKMODAL
-  win32gui.MessageBox(0, _('Unable to start GNUe Forms:') + '\n\n %s' % 
errortext , 'GNUe Forms' , flags )
-
-  sys.exit()

Modified: trunk/gnue-forms/src/uidrivers/win32/UILoginHandler.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/win32/UILoginHandler.py      2004-09-16 
13:22:40 UTC (rev 6300)
+++ trunk/gnue-forms/src/uidrivers/win32/UILoginHandler.py      2004-09-16 
13:36:37 UTC (rev 6301)
@@ -31,9 +31,8 @@
 import os, struct
 
 from gnue.common.datasources import GLoginHandler
-from gnue.common.apps import GConfig
+from gnue.common.apps import GConfig, errors
 from gnue.forms.uidrivers.win32.common import getNextId, centerWindow
-from gnue.forms.uidrivers.win32.ErrorHandler import handleStartupError
 
 g_registeredClass = 0
 
@@ -84,7 +83,8 @@
         imageFile = images_dir+gConfigForms('loginBMP')
 
       if not imageFile[-3:].upper() == 'BMP':
-        handleStartupError(_("The win32 forms driver supports only BMP format 
logo files!"))
+        raise errors.AdminError, \
+            _("The win32 forms driver supports only BMP format logo files!")
 
       self._bmp = win32gui.LoadImage(0, imageFile, win32con.IMAGE_BITMAP, 
                                           0, 0, win32con.LR_LOADFROMFILE | 
win32con.LR_DEFAULTSIZE)

Modified: trunk/gnue-forms/src/uidrivers/win32/__init__.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/win32/__init__.py    2004-09-16 13:22:40 UTC 
(rev 6300)
+++ trunk/gnue-forms/src/uidrivers/win32/__init__.py    2004-09-16 13:36:37 UTC 
(rev 6301)
@@ -1,3 +1,2 @@
 from UIdriver import GFUserInterface
 from UILoginHandler import *
-from ErrorHandler import handleStartupError

Deleted: trunk/gnue-forms/src/uidrivers/wx/ErrorHandler.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx/ErrorHandler.py   2004-09-16 13:22:40 UTC 
(rev 6300)
+++ trunk/gnue-forms/src/uidrivers/wx/ErrorHandler.py   2004-09-16 13:36:37 UTC 
(rev 6301)
@@ -1,292 +0,0 @@
-#
-# This file is part of GNU Enterprise.
-#
-# GNU Enterprise is free software; you can redistribute it
-# and/or modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; either
-# version 2, or (at your option) any later version.
-#
-# GNU Enterprise is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with program; see the file COPYING. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place
-# - Suite 330, Boston, MA 02111-1307, USA.
-#
-# Copyright 2000-2004 Free Software Foundation
-#
-# FILE:
-# UIwxpython.py
-#
-# DESCRIPTION:
-# A wxPython based user interface driver for GNUe forms.
-#
-# NOTES:
-#
-
-import string, sys
-
-from wxPython.wx import *
-from GFwxApp import getWxApp
-
-def handleStartupError(errortext):
-  print
-  print '-' * 60
-  print o(u_("Error: %s") % errortext)
-  print '-' * 60
-
-  print
-
-  _StartupErrorDisplay(str(errortext).replace('\t','    ')).ShowModal()
-  sys.exit()
-
-
-def handleUncaughtException(extype, exvalue, traceback):
-  # If we throw an exception, we don't want circular calls
-  sys.excepthook = sys.__excepthook__
-
-  _ExceptionDisplay(extype, exvalue, traceback).ShowModal()
-
-  # Restore exception handler
-  sys.excepthook = handleUncaughtException
-
-
-#
-#
-#
-class _StartupErrorDisplay(wxMessageDialog):
-  def __init__(self, errortext):
-    self._wxapp = getWxApp()
-    wxMessageDialog.__init__(self, None, _('Unable to start GNUe Forms:') + 
'\n\n %s' % errortext,
-                     'GNUe Forms', wxICON_ERROR|wxCENTRE|wxOK)
-
-#
-#
-#
-class _ExceptionDisplay(wxDialog):
-
-  def getLogin(self, loginData, errortext=None):#"Invalid username/password"):
-    if 1: # TODO: This is left here to prevent me from having to unindent this 
code
-          # TODO: Since the UI stuff is currently being gutted I'm not wasting 
the time
-          # TODO: to do the right thing
-      if len(loginData[1]):
-        loginMesg = _('Login required for\n"%s"') % (loginData[1])
-      else:
-        loginMesg = _('Login required for %s') % (loginData[0])
-
-      self.dlg = wxDialog(NULL, -1, _("GNU Enterprise: Login to %s") % 
loginData[0])
-      self.dlg.SetAutoLayout(true)
-
-      if os.path.isabs(gConfigForms('loginPNG')):
-        imageFile = gConfigForms('loginPNG')
-      else:
-        imageFile = images_dir+gConfigForms('loginPNG')
-
-      bmp = wxImage(imageFile, wxBITMAP_TYPE_PNG).ConvertToBitmap()
-
-      messageField = WrappedStaticText(self.dlg, -1, str(loginMesg), 300, 
style=wxALIGN_CENTER)
-
-      self.textctrlList = []
-      labelList = []
-
-      dlgWidth = max(bmp.GetWidth(), messageField.GetSize().GetWidth()+20)
-
-      dlgHeight = bmp.GetHeight() + messageField.GetSize().GetHeight() + 80
-
-      xSpacing = 0
-      ySpacing = 0
-      fieldLabelWidth = 0
-
-      for prompt in loginData[2]:
-        s = wxStaticText(self.dlg, -1, '%s:' % prompt[1])
-        labelList.append(s)
-        if prompt[2]:
-          t = wxTextCtrl(self.dlg, -1,"",wxPoint(1, 1), wxSize(150, 20),
-                         style=wxTE_PASSWORD|wxTE_PROCESS_ENTER)
-        else:
-          t = wxTextCtrl(self.dlg, -1,"",wxPoint(1, 1), wxSize(150, 20),
-                         style=wxTE_PROCESS_ENTER)
-
-        myID = len(self.textctrlList)
-        self.textctrlList.append(t)
-        EVT_CHAR(t, LoginFieldHandler(self, myID).loginFieldEventTrap)
-
-        fieldLabelWidth = max(fieldLabelWidth,
-                  s.GetSize().GetWidth() + t.GetSize().GetWidth() + 10)
-
-        dlgWidth = max(dlgWidth, \
-                       s.GetSize().GetWidth() + t.GetSize().GetWidth() + 20)
-
-        xSpacing = max(xSpacing, s.GetSize().GetWidth())
-        ySpacing = max(ySpacing, s.GetSize().GetHeight())
-        ySpacing = max(ySpacing, t.GetSize().GetHeight())
-
-
-      loginId = wxNewId()
-      cancelId = wxNewId()
-
-      loginButton = wxButton(self.dlg,loginId,_('Login'))
-      cancelButton = wxButton(self.dlg,cancelId,_('Cancel'))
-
-      EVT_BUTTON(self.dlg, loginId, self.loginButtonEventTrap)
-      EVT_BUTTON(self.dlg, cancelId, self.loginCancelEventTrap)
-      dlgWidth = max(dlgWidth, loginButton.GetSize().GetWidth() +
-                            cancelButton.GetSize().GetWidth() + 6) + 20
-
-      dlgHeight += max(loginButton.GetSize().GetHeight(),
-                       cancelButton.GetSize().GetHeight()) - 6
-
-      if errortext:
-        errorField = WrappedStaticText(self.dlg, -1, str(errortext), 300,
-                                       style=wxALIGN_CENTER)
-        errorField.SetForegroundColour(wxColour(223,0,0))
-
-        dlgWidth = max(dlgWidth, errorField.GetSize().width+10)
-        dlgHeight += errorField.GetSize().height + 6
-
-
-      firstY = bmp.GetHeight() + messageField.GetSize().GetHeight() + 50
-      lastY = firstY
-      xSpacing += 10   # Add whitespace between widgets
-      ySpacing += 6    # Add whitespace between widgets
-      xPos = dlgWidth/2 - fieldLabelWidth/2
-
-
-      # Move the fields and labels into position
-      for i in range(0, len(self.textctrlList)):
-        dlgHeight = dlgHeight + ySpacing
-        labelList[i].SetPosition(wxPoint(xPos, lastY))
-        self.textctrlList[i].SetPosition(wxPoint(xPos + xSpacing, lastY))
-        lastY = lastY + ySpacing
-
-      if errortext:
-        errorField.SetPosition(
-          wxPoint(dlgWidth/2 - errorField.GetSize().width/2,
-                lastY+3))
-
-      # Set the focus to the first text entry field
-      self.textctrlList[0].SetFocus()
-
-      # Create and position the logo
-      wxStaticBitmap(self.dlg,-1, bmp,
-                     wxPoint((dlgWidth-bmp.GetWidth())/2, 12),
-                     wxSize(bmp.GetWidth(), bmp.GetHeight()))
-
-      # Move the various widgets into position
-      messageField.SetPosition(
-        wxPoint(dlgWidth/2 - messageField.GetSize().GetWidth()/2,
-                30 + bmp.GetHeight()))
-
-      cancelButton.SetPosition(
-        wxPoint(dlgWidth - 10 - cancelButton.GetSize().GetWidth(),
-                dlgHeight - 10 - max(loginButton.GetSize().GetHeight(),
-                                            
cancelButton.GetSize().GetHeight())))
-      loginButton.SetPosition(
-        wxPoint(dlgWidth - 16 - cancelButton.GetSize().GetWidth() - \
-                loginButton.GetSize().GetWidth(),
-                dlgHeight - 10 - max(loginButton.GetSize().GetHeight(),
-                                            
cancelButton.GetSize().GetHeight())))
-
-      self.loginButton = loginButton
-
-      self.dlg.SetSize(wxSize(dlgWidth, dlgHeight))
-
-      self.dlg.Refresh()
-      self.dlg.Fit()
-      self.dlg.Raise()
-      self.dlg.CenterOnScreen()
-
-    # If user cancels, this will be set to 0
-    self._completed = 0
-    self.dlg.ShowModal()
-
-    if not self._completed:
-      raise GLoginHandler.UserCanceledLogin
-
-    rv = {}
-    for i in range(0, len(loginData[2])):
-      rv[loginData[2][i][0]] = self.textctrlList[i].GetValue()
-
-    return rv
-
-  #
-  # Login is completed, for whatever reason
-  #
-  def loginCompleted(self, successful):
-    self._completed = successful
-    self.dlg.EndModal(1)
-
-  #
-  # Called when user clicks "login"
-  #
-  def loginButtonEventTrap(self, event):
-    self.loginCompleted(1)
-
-  #
-  # Called when user clicks "cancel"
-  #
-  def loginCancelEventTrap(self, event):
-    self.loginCompleted(0)
-
-  #
-  # TODO: This is a hack required because windows
-  # TODO: seems to have issues with wxWidgets dialogs
-  #
-  def destroyLoginDialog(self):
-    self.dlg.Destroy()
-
-#
-# LoginFieldHandler
-#
-# Used by the login handler
-# enables the user to press return and have it jump to the next box
-#
-class LoginFieldHandler:
-  def __init__(self, app, seq):
-    self.app = app
-    self.seq = seq
-
-  def loginFieldEventTrap(self, event):
-     if event.KeyCode() in (WXK_RETURN, WXK_TAB):
-       if self.seq < len(self.app.textctrlList) - 1:
-         self.app.textctrlList[self.seq+1].SetFocus()
-       else:
-         if event.KeyCode() == WXK_TAB:
-           if event.ShiftDown():
-             self.app.textctrlList[self.seq-1].SetFocus()
-           else:
-             self.app.loginButton.SetFocus()
-         else:
-           self.app.loginCompleted(1)
-     else:
-      event.Skip()
-
-
-
-class WrappedStaticText(wxStaticText):
-  def __init__(self, parent, id, label, width, *args, **params):
-    wxStaticText.__init__(self, parent, id, "bah!", *args, **params)
-
-
-    textSoFar = ""
-    thisLine = ""
-    for part in string.split(label,'\n'):
-      for word in string.split(part):
-        self.SetLabel(thisLine + word)
-        if self.GetSize().width > width:
-          textSoFar += thisLine + " \n"
-          thisLine = word + " "
-        else:
-          thisLine += word + " "
-
-      textSoFar += thisLine + " \n"
-      thisLine = ""
-
-    if len(textSoFar):
-      self.SetLabel(string.replace(textSoFar,' \n','\n')[:-1])
-    else:
-      self.SetLabel("")
-

Modified: trunk/gnue-forms/src/uidrivers/wx/__init__.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx/__init__.py       2004-09-16 13:22:40 UTC 
(rev 6300)
+++ trunk/gnue-forms/src/uidrivers/wx/__init__.py       2004-09-16 13:36:37 UTC 
(rev 6301)
@@ -1,3 +1,2 @@
 from UIdriver import GFUserInterface
 from UILoginHandler import *
-from ErrorHandler import handleStartupError, handleUncaughtException





reply via email to

[Prev in Thread] Current Thread [Next in Thread]