From: Uwe Hermann Date: Mon, 4 Jan 2016 20:35:37 +0000 (+0100) Subject: Minor cosmetics and typo fixes. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=911ab26ebbbc1021f35643e92150cf12895c2574;p=sigrok-meter.git Minor cosmetics and typo fixes. --- diff --git a/acquisition.py b/acquisition.py index fdb1658..6e9a3d4 100644 --- a/acquisition.py +++ b/acquisition.py @@ -131,7 +131,7 @@ class Acquisition(QtCore.QObject): if not len(packet.payload.channels): return - # TODO: find a device with multiple channels in one packet + # TODO: Find a device with multiple channels in one packet. channel = packet.payload.channels[0] # The most recent value. diff --git a/datamodel.py b/datamodel.py index a90cbc7..83d5ef6 100644 --- a/datamodel.py +++ b/datamodel.py @@ -52,7 +52,7 @@ class MeasurementDataModel(QtGui.QStandardItemModel): '''Role used to store the device vendor and model.''' descRole = QtCore.Qt.UserRole + 2 - '''Role used to store a dictionary with the traces''' + '''Role used to store a dictionary with the traces.''' tracesRole = QtCore.Qt.UserRole + 3 '''Role used to store the color to draw the graph of the channel.''' @@ -235,7 +235,7 @@ class MultimeterDelegate(QtGui.QStyledItemDelegate): 'Choose new color for channel') if c.isValid(): # False if cancel is pressed (resulting in a black - # color) + # color). item = model.itemFromIndex(index) item.setData(c, MeasurementDataModel.colorRole) diff --git a/mainwindow.py b/mainwindow.py index be39a4e..560dfd3 100644 --- a/mainwindow.py +++ b/mainwindow.py @@ -38,7 +38,7 @@ QtGui = qtcompat.QtGui pyqtgraph = qtcompat.pyqtgraph class EmptyMessageListView(QtGui.QListView): - '''List view that shows a message if the model im empty.''' + '''List view that shows a message if the model is empty.''' def __init__(self, message, parent=None): super(self.__class__, self).__init__(parent) @@ -193,17 +193,17 @@ class MainWindow(QtGui.QMainWindow): actionPreferences.setIcon(icons.preferences) actionPreferences.triggered.connect(self.showPreferencesPage) - # make the buttons at the top exclusive + # Make the buttons at the top exclusive. self.actionGroup = QtGui.QActionGroup(self) self.actionGroup.addAction(actionGraph) #self.actionGroup.addAction(actionAdd) self.actionGroup.addAction(actionLog) self.actionGroup.addAction(actionPreferences) - # show graph at startup + # Show graph at startup. actionGraph.setChecked(True) - # fill space between buttons on the top and on the bottom + # Fill space between buttons on the top and on the bottom. fill = QtGui.QWidget(self) fill.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) self.sideBar.addWidget(fill) @@ -378,14 +378,14 @@ class MainWindow(QtGui.QMainWindow): if unit in self._plots: return self._plots[unit] - # create a new plot for the unit + # Create a new plot for the unit. plot = self.plotwidget.addPlot() plot.yaxis.setLabel(util.quantity_from_unit(unit), units=util.format_unit(unit)) plot.view.setXRange(-settings.graph.backlog.value(), 0, update=False) plot.view.setYRange(-1, 1) plot.view.enableAutoRange(axis=pyqtgraph.ViewBox.YAxis) - # lock to the range calculated by the view using additional padding, - # looks nicer this way + # Lock to the range calculated by the view using additional padding, + # looks nicer this way. r = plot.view.viewRange() plot.view.setLimits(xMin=r[0][0], xMax=r[0][1]) @@ -399,7 +399,7 @@ class MainWindow(QtGui.QMainWindow): if key in self._curves: return self._curves[key] - # create a new curve + # Create a new curve. curve = pyqtgraph.PlotDataItem( antialias=True, symbolPen=pyqtgraph.mkPen(QtGui.QColor(QtCore.Qt.black)), @@ -414,7 +414,7 @@ class MainWindow(QtGui.QMainWindow): def _updatePlots(self): '''Updates all plots.''' - # loop over all devices and channels + # Loop over all devices and channels. for row in range(self.model.rowCount()): idx = self.model.index(row, 0) deviceID = self.model.data(idx, @@ -426,7 +426,7 @@ class MainWindow(QtGui.QMainWindow): for unit, trace in traces.items(): now = time.time() - # remove old samples + # Remove old samples. l = now - settings.graph.backlog.value() while trace.samples and trace.samples[0][0] < l: trace.samples.pop(0) @@ -453,7 +453,7 @@ class MainWindow(QtGui.QMainWindow): # Mark all traces of all devices/channels with the same unit as the # plot as "old" ('trace.new = False'). As soon as a new sample arrives - # on one trace, the plot will be shown again + # on one trace, the plot will be shown again. for row in range(self.model.rowCount()): idx = self.model.index(row, 0) traces = self.model.data(idx, datamodel.MeasurementDataModel.tracesRole) @@ -488,7 +488,7 @@ class MainWindow(QtGui.QMainWindow): self.actionStartStop.setText('Start Acquisition') self.actionStartStop.setIcon(icons.start) else: - # before starting (again), remove all old samples and old curves + # Before starting (again), remove all old samples and old curves. self.model.clear_samples() for key in self._curves: diff --git a/multiplotwidget.py b/multiplotwidget.py index f7c3de9..7729489 100755 --- a/multiplotwidget.py +++ b/multiplotwidget.py @@ -24,7 +24,7 @@ QtCore = qtcompat.QtCore QtGui = qtcompat.QtGui pyqtgraph = qtcompat.pyqtgraph -# black foreground on white background +# Black foreground on white background. pyqtgraph.setConfigOption('background', 'w') pyqtgraph.setConfigOption('foreground', 'k') @@ -103,7 +103,7 @@ class MultiPlotItem(pyqtgraph.GraphicsWidget): def _rowNumber(self, plot): '''Returns the number of the first row a plot occupies.''' - # Every plot takes up two rows + # Every plot takes up two rows. return 2 * self._plots.index(plot) @QtCore.Slot() diff --git a/sigrok-meter b/sigrok-meter index 63415f7..a56233d 100755 --- a/sigrok-meter +++ b/sigrok-meter @@ -101,7 +101,7 @@ if __name__ == '__main__': import sigrok.core as sr except Exception as e: QtGui.QMessageBox.critical(None, 'Error starting sigrok-meter', - 'Unable to use the sigrok python bindings:\n{}'.format(e)) + 'Unable to use the sigrok Python bindings:\n{}.'.format(e)) sys.exit(1) # Initialize modules that need a QApplication to exist.