~jpeddicord/jobsadmin/trunk

« back to all changes in this revision

Viewing changes to JobsAdmin/settings.py

  • Committer: Jacob Peddicord
  • Date: 2010-08-03 21:01:53 UTC
  • Revision ID: git-v1:bef38c12c32a7a98ba0d55f86b7947ac9aee2a61
Implement exec fallback lists. Example in cups.xml.in in jobservice.

Show diffs side-by-side

added added

removed removed

Lines of Context:
107
107
                        index += 1
108
108
            
109
109
            elif stype == 'exec':
110
 
                widget = gtk.Button(_("_Launch"))
111
 
                widget.connect('clicked', run_action, val)
112
 
                p = Popen(['which', val.split()[0]])
113
 
                if p.wait() != 0:
114
 
                    widget.props.sensitive = False
115
 
                    widget.props.label = _("Unavailable")
116
 
            
 
110
                widget = gtk.Button(_("_Unavailable"))
 
111
                # static value
 
112
                if val:
 
113
                    # check for existence
 
114
                    p = Popen(['which', val.split()[0]])
 
115
                    if p.wait() != 0:
 
116
                        widget.props.sensitive = False
 
117
                    else:
 
118
                        widget.connect('clicked', run_action, val)
 
119
                        widget.props.label = _("Launch")
 
120
                # fallback list
 
121
                else:
 
122
                    for vname, vdesc in vals:
 
123
                        # check to see if it exists
 
124
                        p = Popen(['which', vname.split()[0]])
 
125
                        if p.wait() != 0:
 
126
                            continue
 
127
                        # take the first valid action
 
128
                        widget.connect('clicked', run_action, vname)
 
129
                        widget.props.label = vdesc
 
130
                        break
 
131
                        
117
132
            elif stype == 'label':
118
133
                widget = gtk.Label()
119
134
                widget.props.xalign = 0