~ubuntu-branches/ubuntu/wily/system-config-printer/wily

« back to all changes in this revision

Viewing changes to options.py

  • Committer: Package Import Robot
  • Author(s): Till Kamppeter
  • Date: 2014-08-05 23:59:59 UTC
  • mfrom: (256.1.1 utopic-proposed)
  • Revision ID: package-import@ubuntu.com-20140805235959-v1yzis5mo1nkxo2m
Tags: 1.5.0+20140805-0ubuntu2
debian/control: Build-depend on Python 3 (python3-all-dev).

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
        cls.UNITS_DEFAULT = cups.IPP_RES_PER_INCH
35
35
 
36
36
        cls.UNITS_BY_STR = {}
37
 
        for v, s in cls.UNITS_BY_VAL.iteritems ():
 
37
        for v, s in cls.UNITS_BY_VAL.items ():
38
38
            cls.UNITS_BY_STR[s] = v
39
39
 
40
40
        if isinstance (values, str):
54
54
        return self
55
55
 
56
56
    def __init__ (self, values):
57
 
        return tuple.__init__ (self, (self.xres, self.yres, self.units))
 
57
        return tuple.__init__ ((self.xres, self.yres, self.units))
58
58
 
59
59
    def __str__ (self):
60
60
        return "%sx%s%s" % (self.xres, self.yres,
68
68
            for vv in v + s:
69
69
                if not isinstance(vv, str): raise ValueError
70
70
            return OptionSelectMany(name, v, s, on_change)
71
 
        print v, s
 
71
        print(v, s)
72
72
        raise NotImplementedError
73
73
    else:
74
74
        if (isinstance(s, int) or
140
140
 
141
141
        if (type(self.widget) == Gtk.ComboBox and
142
142
            self.widget.get_model () == None):
143
 
            print "No ComboBox model for %s" % self.name
 
143
            print("No ComboBox model for %s" % self.name)
144
144
            model = Gtk.ListStore (str)
145
145
            self.widget.set_model (model)
146
146
 
257
257
        elif t == Gtk.CheckButton:
258
258
            return self.widget.set_active (ipp_value)
259
259
        else:
260
 
            raise NotImplementedError, (t, self.name)
 
260
            raise NotImplementedError(t, self.name)
261
261
 
262
262
    def get_widget_value(self):
263
263
        t = type(self.widget)
290
290
        elif t == Gtk.CheckButton:
291
291
            return self.ipp_type (self.widget.get_active ())
292
292
 
293
 
        print t, self.widget, self.ipp_type
 
293
        print(t, self.widget, self.ipp_type)
294
294
        raise NotImplementedError
295
295
 
296
296
    def get_current_value(self):
419
419
        if selected is not None:
420
420
            self.selector.set_active(selected)
421
421
        else:
422
 
            print "Unknown value for %s: %s" % (name, value)
423
 
            print "Choices:", supported
 
422
            print("Unknown value for %s: %s" % (name, value))
 
423
            print("Choices:", supported)
424
424
            if len(supported) > 0:
425
 
                print "Selecting from choices:", supported[0]
 
425
                print("Selecting from choices:", supported[0])
426
426
                self.selector.set_active(0)
427
427
        self.selector.connect("changed", self.changed)
428
428
 
437
437
                              cups.IPP_RES_PER_CM: "dpc" }
438
438
        self.UNITS_DEFAULT = cups.IPP_RES_PER_INCH
439
439
        self.UNITS_BY_STR = {}
440
 
        for v, s in self.UNITS_BY_VAL.iteritems ():
 
440
        for v, s in self.UNITS_BY_VAL.items ():
441
441
            self.UNITS_BY_STR[s] = v
442
442
 
443
443
        value = self.string (value)
444
 
        supported = map (self.string, supported)
 
444
        supported = list(map (self.string, supported))
445
445
        OptionSelectOne.__init__ (self, name, value, supported, on_change)
446
446
 
447
447
    def string(self, value):