Back to index

system-config-printer  1.3.9+20120706
Public Member Functions | Public Attributes | Static Public Attributes
options.OptionNumeric Class Reference
Inheritance diagram for options.OptionNumeric:
Inheritance graph
[legend]
Collaboration diagram for options.OptionNumeric:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def get_current_value
def is_changed
def changed
def get_default

Public Attributes

 is_float
 selector
 name
 value
 supported
 on_change
 is_new
 label

Static Public Attributes

 conflicts = None

Detailed Description

Definition at line 465 of file options.py.


Constructor & Destructor Documentation

def options.OptionNumeric.__init__ (   self,
  name,
  value,
  supported,
  on_change 
)

Reimplemented from options.Option.

Definition at line 466 of file options.py.

00466 
00467     def __init__(self, name, value, supported, on_change):
00468         self.is_float = (isinstance(supported, float) or
00469                          (isinstance(supported, tuple) and
00470                           isinstance(supported[0], float)))
00471         if self.is_float:
00472             digits = 2
00473         else:
00474             digits = 0
00475 
00476         if not isinstance(supported, tuple):
00477             supported = (0, supported)
00478         Option.__init__(self, name, value, supported, on_change)
00479         adj = gtk.Adjustment(value, supported[0], supported[1], 1.0, 5.0, 0.0)
00480         self.selector = gtk.SpinButton(adj, climb_rate=1.0, digits=digits)
00481         if not self.is_float:
00482             self.selector.set_numeric(True)
00483         self.selector.connect("changed", self.changed)


Member Function Documentation

def options.Option.changed (   self,
  widget,
  args 
) [inherited]

Definition at line 378 of file options.py.

00378 
00379     def changed(self, widget, *args):
00380         self.on_change(self)
00381     
00382 # ---------------------------------------------------------------------------

Reimplemented from options.Option.

Definition at line 484 of file options.py.

00484 
00485     def get_current_value(self):
00486         if self.is_float:
00487             return self.selector.get_value()
00488         return self.selector.get_value_as_int()
00489 
00490 # ---------------------------------------------------------------------------

Here is the caller graph for this function:

def options.OptionInterface.get_default (   self) [inherited]

Reimplemented in options.OptionAlwaysShown.

Definition at line 109 of file options.py.

00109 
00110     def get_default(self):
00111         return None

def options.Option.is_changed (   self) [inherited]

Reimplemented from options.OptionInterface.

Definition at line 374 of file options.py.

00374 
00375     def is_changed(self):
00376         return (self.is_new or
00377                 str (self.get_current_value()) != str (self.value))

Here is the call graph for this function:


Member Data Documentation

options.Option.conflicts = None [static, inherited]

Definition at line 356 of file options.py.

Definition at line 467 of file options.py.

options.Option.is_new [inherited]

Definition at line 363 of file options.py.

options.Option.label [inherited]

Definition at line 368 of file options.py.

options.Option.name [inherited]

Definition at line 359 of file options.py.

Definition at line 362 of file options.py.

Definition at line 479 of file options.py.

Definition at line 361 of file options.py.

options.Option.value [inherited]

Definition at line 360 of file options.py.


The documentation for this class was generated from the following file: