Back to index

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

List of all members.

Public Member Functions

def __init__
def get_current_value
def enable
def disable
def is_enabled
def is_changed
def writeback
def checkConflicts
def on_change
def on_btnConflict_clicked

Public Attributes

 selector
 label
 option
 ppd
 gui
 enabled
 tab_label
 btnConflict
 conflictIcon
 constraints
 conflicts
 conflict_message

Static Public Attributes

string widget_name = "OptionPickMany"

Detailed Description

Definition at line 233 of file optionwidgets.py.


Constructor & Destructor Documentation

def optionwidgets.OptionPickMany.__init__ (   self,
  option,
  ppd,
  gui,
  tab_label = None 
)

Reimplemented from optionwidgets.OptionPickOne.

Definition at line 236 of file optionwidgets.py.

00236 
00237     def __init__(self, option, ppd, gui, tab_label=None):
00238         raise NotImplemented
00239         Option.__init__(self, option, ppd, gui, tab_label=tab_label)
00240         

Member Function Documentation

def optionwidgets.Option.checkConflicts (   self,
  update_others = True 
) [inherited]

Definition at line 98 of file optionwidgets.py.

00098 
00099     def checkConflicts(self, update_others=True):
00100         value = self.get_current_value()
00101         for constraint in self.constraints:
00102             if constraint.option1 == self.option.keyword:
00103                 option2 = self.gui.options.get(constraint.option2, None)
00104                 choice1 = constraint.choice1
00105                 choice2 = constraint.choice2
00106             else:
00107                 option2 = self.gui.options.get(constraint.option1, None)
00108                 choice1 = constraint.choice2
00109                 choice2 = constraint.choice1
00110 
00111             if option2 is None: continue
00112 
00113             def matches (constraint_choice, value):
00114                 if constraint_choice != '':
00115                     return constraint_choice == value
00116                 return value not in ['None', 'False', 'Off']
00117 
00118             if (matches (choice1, value) and
00119                 matches (choice2, option2.get_current_value())):
00120                 # conflict
00121                 self.conflicts.add(constraint)
00122                 if update_others:
00123                     option2.checkConflicts(update_others=False)
00124             elif constraint in self.conflicts:
00125                 # remove conflict
00126                 self.conflicts.remove(constraint)
00127                 option2.checkConflicts(update_others=False)
00128 
00129 
00130         tooltip = [_("Conflicts with:")]
00131         conflicting_options = dict()
00132         for c in self.conflicts:
00133             if c.option1 == self.option.keyword:
00134                 option = self.gui.options.get(c.option2)
00135             else:
00136                 option = self.gui.options.get(c.option1)
00137 
00138             conflicting_options[option.option.keyword] = option
00139 
00140         for option in conflicting_options.values ():
00141             opt = option.option.text
00142             val = option.get_current_value ()
00143             for choice in option.option.choices:
00144                 if choice['choice'] == val:
00145                     val = ppdippstr.ppd.get (choice['text'])
00146 
00147             tooltip.append ("%s: %s" % (opt, val))
00148             
00149         tooltip = "\n".join(tooltip)
00150 
00151         self.conflict_message = tooltip # XXX more verbose
00152             
00153         if self.conflicts:
00154             self.btnConflict.set_tooltip_text (tooltip)
00155             self.btnConflict.show()
00156         else:
00157             self.btnConflict.hide()
00158 
00159         self.gui.option_changed(self)
00160         return self.conflicts
            

Here is the call graph for this function:

Here is the caller graph for this function:

def optionwidgets.Option.disable (   self) [inherited]

Definition at line 81 of file optionwidgets.py.

00081 
00082     def disable(self):
00083         self.enable (False)

Here is the call graph for this function:

def optionwidgets.Option.enable (   self,
  enabled = True 
) [inherited]

Definition at line 77 of file optionwidgets.py.

00077 
00078     def enable(self, enabled=True):
00079         self.selector.set_sensitive (enabled)
00080         self.enabled = enabled

Here is the caller graph for this function:

Reimplemented from optionwidgets.Option.

Definition at line 228 of file optionwidgets.py.

00228 
00229     def get_current_value(self):
00230         return self.option.choices[self.selector.get_active()]['choice']
00231         
00232 # ---------------------------------------------------------------------------

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

Definition at line 90 of file optionwidgets.py.

00090 
00091     def is_changed(self):
00092         return self.get_current_value()!= self.option.defchoice
    

Here is the call graph for this function:

def optionwidgets.Option.is_enabled (   self) [inherited]

Definition at line 84 of file optionwidgets.py.

00084 
00085     def is_enabled(self):
00086         return self.enabled

def optionwidgets.Option.on_btnConflict_clicked (   self,
  button 
) [inherited]

Definition at line 164 of file optionwidgets.py.

00164 
00165     def on_btnConflict_clicked(self, button):
00166         parent = self.btnConflict
00167         while parent != None and not isinstance (parent, gtk.Window):
00168             parent = parent.get_parent ()
00169 
00170         dialog = gtk.MessageDialog (parent,
00171                                     gtk.DIALOG_DESTROY_WITH_PARENT |
00172                                     gtk.DIALOG_MODAL,
00173                                     gtk.MESSAGE_WARNING,
00174                                     gtk.BUTTONS_CLOSE,
00175                                     self.conflict_message)
00176         dialog.run()
00177         dialog.destroy()
00178         
00179 # ---------------------------------------------------------------------------

def optionwidgets.Option.on_change (   self,
  widget 
) [inherited]

Definition at line 161 of file optionwidgets.py.

00161 
00162     def on_change(self, widget):
00163         self.checkConflicts()

Here is the call graph for this function:

def optionwidgets.Option.writeback (   self) [inherited]

Definition at line 93 of file optionwidgets.py.

00093 
00094     def writeback(self):
00095         #print repr(self.option.keyword), repr(self.get_current_value())
00096         if self.enabled:
00097             self.ppd.markOption(self.option.keyword, self.get_current_value())

Here is the call graph for this function:


Member Data Documentation

Definition at line 55 of file optionwidgets.py.

Definition at line 75 of file optionwidgets.py.

Definition at line 63 of file optionwidgets.py.

Definition at line 74 of file optionwidgets.py.

Definition at line 68 of file optionwidgets.py.

Definition at line 50 of file optionwidgets.py.

Definition at line 49 of file optionwidgets.py.

Definition at line 212 of file optionwidgets.py.

Definition at line 47 of file optionwidgets.py.

Definition at line 48 of file optionwidgets.py.

Definition at line 206 of file optionwidgets.py.

Definition at line 51 of file optionwidgets.py.

string optionwidgets.OptionPickMany.widget_name = "OptionPickMany" [static]

Reimplemented from optionwidgets.OptionPickOne.

Definition at line 234 of file optionwidgets.py.


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