commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r8807 - trunk/gnue-forms/src/uidrivers/qt3/widgets


From: johannes
Subject: [gnue] r8807 - trunk/gnue-forms/src/uidrivers/qt3/widgets
Date: Tue, 17 Oct 2006 04:11:19 -0500 (CDT)

Author: johannes
Date: 2006-10-17 04:11:19 -0500 (Tue, 17 Oct 2006)
New Revision: 8807

Modified:
   trunk/gnue-forms/src/uidrivers/qt3/widgets/scrollbar.py
Log:
Added ScrollBar widget


Modified: trunk/gnue-forms/src/uidrivers/qt3/widgets/scrollbar.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/qt3/widgets/scrollbar.py     2006-10-17 
09:00:05 UTC (rev 8806)
+++ trunk/gnue-forms/src/uidrivers/qt3/widgets/scrollbar.py     2006-10-17 
09:11:19 UTC (rev 8807)
@@ -1,6 +1,9 @@
+# GNU Enterprise Forms - QT3 UI driver - ScrollBar widgets
 #
-# This file is part of GNU Enterprise.
+# Copyright 2001-2006 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
@@ -16,50 +19,63 @@
 # write to the Free Software Foundation, Inc., 59 Temple Place
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
-# Copyright 2000-2006 Free Software Foundation
-#
-# FILE:
-# UIqt.py
-#
-# DESCRIPTION:
-# A QT-based user interface driver for GNUe forms.
-#
-# NOTES:
-#
-from qt import *
+# $Id$
 
-## from gnue.forms import VERSION
-## from gnue.forms.GFForm import *
-## from gnue.forms.uidrivers._base.UIdriver import *
+import qt
 
-## from gnue.forms.uidrivers.qt.GFwxApp import *
-## from gnue.forms.uidrivers.qt.UIWXSplashScreen import *
 from gnue.forms.uidrivers.qt3.widgets._base import UIHelper
-## from gnue.common import *
 
+# =============================================================================
+# The scrollbar widget
+# =============================================================================
 
-#
-# UIScrollBar
-#
-# Widget set specific function that creates a single instance of a scroll bar 
used
-# to navigate multiple records
-#
 class UIScrollBar(UIHelper):
-  def _create_widget(self, event, spacer):
-    object = event.object
-    
-    # Create a vertical scrollbar..
-    newWidget =QScrollBar(event.container)
+    """
+    Implementation of the <scrollbar> tag
+    """
 
-    # ..move it to it's proper place..
-    newWidget.setGeometry(object.Char__x*event.widgetWidth,
-                          
(object.Char__y+spacer+(spacer*object._gap))*event.widgetHeight, 
-                          self.itemWidth,self.itemHeight)
+    # -------------------------------------------------------------------------
+    # Create a new widget
+    # -------------------------------------------------------------------------
 
-    return newWidget
+    def _create_widget_(self, event, spacer):
 
+        parent = event.container
+
+        self.widget = qt.QScrollBar(qt.Qt.Vertical, parent)
+        self.getParent().add_widgets(self, spacer)
+
+        self.widget.connect(self.widget, qt.SIGNAL('valueChanged(int)'),
+                self.__on_value_changed)
+
+        return self.widget
+
+
+    # -------------------------------------------------------------------------
+    # Handle changes of the current value 
+    # -------------------------------------------------------------------------
+
+    def __on_value_changed(self, value):
+
+        self._gfObject._event_scrollToRecord(value)
+
+
+    # -------------------------------------------------------------------------
+    # Adjust the scrollbar to a new position
+    # -------------------------------------------------------------------------
+
+    def _ui_adjust_scrollbar_(self, position, size, count):
+
+        self.widget.setMaxValue(count)
+        self.widget.setPageStep(size)
+        self.widget.setValue(position)
+
+# =============================================================================
+# Configuration
+# =============================================================================
+
 configuration = {
-    'baseClass'  : UIScrollBar,
-    'provides'   : 'GFScrollBar',
-    'container'  : 0,
-    }
+  'baseClass': UIScrollBar,
+  'provides' : 'GFScrollBar',
+  'container': 0,
+}





reply via email to

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