From: Jens Steinhauser Date: Wed, 12 Nov 2014 04:01:49 +0000 (+0100) Subject: Import the sigrok module under a different name. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=efdef4fa65383cb6642ba3220710ea821db0540d;p=sigrok-meter.git Import the sigrok module under a different name. --- diff --git a/sigrok-meter b/sigrok-meter index fcf5eb4..4c74e73 100755 --- a/sigrok-meter +++ b/sigrok-meter @@ -22,31 +22,31 @@ from multiprocessing import Process, Queue from gi.repository import Gtk, GObject -from sigrok.core import * +import sigrok.core as sr def init_and_run(queue): def datafeed_in(device, packet): - if packet.type == PacketType.ANALOG: + if packet.type == sr.PacketType.ANALOG: data = packet.payload.data unit, unit_str = packet.payload.unit, "" - if unit == Unit.VOLT: + if unit == sr.Unit.VOLT: unit_str = " V" - elif unit == Unit.OHM: + elif unit == sr.Unit.OHM: unit_str = " Ohm" - elif unit == Unit.AMPERE: + elif unit == sr.Unit.AMPERE: unit_str = " A" mqflags, mqflags_str = packet.payload.mq_flags, "" - if QuantityFlag.AC in mqflags: + if sr.QuantityFlag.AC in mqflags: mqflags_str = " AC" - elif QuantityFlag.DC in mqflags: + elif sr.QuantityFlag.DC in mqflags: mqflags_str = " DC" for i in range(packet.payload.num_samples): dev = "%s %s" % (device.vendor, device.model) val = "%f%s%s" % (data[0][i], unit_str, mqflags_str) queue.put((dev, val)) - context = Context_create() - context.log_level = LogLevel.SPEW + context = sr.Context_create() + context.log_level = sr.LogLevel.SPEW drivers_to_use = ['tecpel-dmm-8061-ser'] drivers = [context.drivers[d] for d in drivers_to_use] devices = [d.scan(conn="/dev/ttyUSB0")[0] for d in drivers] @@ -88,7 +88,7 @@ class SigrokMeter: def on_about(self, action): about = self.builder.get_object("aboutdialog") - context = Context_create() + context = sr.Context_create() sr_pkg = context.package_version sr_lib = context.lib_version s = "Using libsigrok %s (lib version %s)." % (sr_pkg, sr_lib)