Permalink
Browse files

display AUTO instead of 0 in the mask and version chooser spinnbutton

  • Loading branch information...
1 parent 615c14e commit 83b2be32d86b6ff19270243aa9d10f93127ddda4 @schoeggu committed Feb 23, 2011
Showing with 18 additions and 6 deletions.
  1. +1 −1 src/pyqrgen/pyqrgen.c
  2. +17 −5 src/pyqrgen/pyqrgen.py
View
@@ -45,7 +45,7 @@ static PyObject* pyqrgen_generate(PyObject *self, PyObject *args)
cairo_t* cr = PycairoContext_GET(pycr);
if (!cr) { printf ("cr is NULL\n"); }
- bool ret = qrgen_generate((byte*)data, dataLen, version, encMode, ecLevel, mask, cr, pixSize);
+ qrgen_generate((byte*)data, dataLen, version, encMode, ecLevel, mask, cr, pixSize);
Py_INCREF(Py_None);
return Py_None;
View
@@ -70,6 +70,7 @@ def changed(self, widget):
if widget == self.button1:
self.generated = True
+
if self.generated:
e = self.get_active_text(self.ec)
@@ -93,7 +94,18 @@ def changed(self, widget):
md = 2
- self.screen.generate(self.entry.get_text(), (int)(self.verspinner.get_adjustment().get_value()), md, ecl, (int)(self.maskspinner.get_adjustment().get_value()))
+ self.screen.generate(self.entry.get_text(), (int)(self.verspinner.props.value), md, ecl, (int)(self.maskspinner.props.value - 1))
+
+
+ def output(self, widget):
+ if widget == self.verspinner and self.verspinner.props.value == 0:
+ self.verspinner.props.text = "Auto"
+ return True
+
+ if widget == self.maskspinner and self.maskspinner.props.value == 0:
+ self.maskspinner.props.text = "Auto"
+ return True
+
def addDetailsConfs(self):
detailstable = gtk.Table(4, 2, False)
@@ -105,8 +117,8 @@ def addDetailsConfs(self):
versalign.add(versionlabel)
versadj = gtk.Adjustment(0, 0, 40, 1, 0 ,0)
self.verspinner = gtk.SpinButton(versadj, 0.1, 0)
- self.verspinner.set_numeric(True)
self.verspinner.connect("value-changed", self.changed)
+ self.verspinner.connect("output", self.output)
detailstable.attach(versalign, 0, 1, 0, 1, gtk.FILL, gtk.FILL, 2, 0)
detailstable.attach(self.verspinner, 1, 2, 0, 1, gtk.EXPAND|gtk.FILL, gtk.EXPAND|gtk.FILL, 0, 0)
@@ -138,11 +150,11 @@ def addDetailsConfs(self):
masklabel = gtk.Label("Mask")
maskalign = gtk.Alignment(0.0, 0.5, 0.0, 0.0)
maskalign.add(masklabel)
- maskadj = gtk.Adjustment(0, 0, 7, 1, 0 ,0)
+ maskadj = gtk.Adjustment(0, 0, 8, 1, 0 ,0)
self.maskspinner = gtk.SpinButton(maskadj, 0.1, 0)
- self.maskspinner.set_numeric(True)
self.maskspinner.set_wrap(True)
self.maskspinner.connect("value-changed", self.changed)
+ self.maskspinner.connect("output", self.output)
detailstable.attach(maskalign, 0, 1, 3, 4, gtk.FILL, gtk.FILL, 2, 0)
detailstable.attach(self.maskspinner, 1, 2, 3, 4, gtk.EXPAND|gtk.FILL, gtk.EXPAND|gtk.FILL, 0, 0)
@@ -194,4 +206,4 @@ def run(Widget):
run(Win)
-
+

0 comments on commit 83b2be3

Please sign in to comment.