X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=mainwindow.py;h=26f1005bdbe5558c68edbd212d8d2768b1afcccf;hb=0b63748bf0df16561324cd77938425d2f9b7b040;hp=be39a4ec59f31a5ffb23efb51412d07682a1493b;hpb=c46081ed1105799f5e0d7c789a2cfbeb4a8186d8;p=sigrok-meter.git diff --git a/mainwindow.py b/mainwindow.py index be39a4e..26f1005 100644 --- a/mainwindow.py +++ b/mainwindow.py @@ -15,8 +15,7 @@ ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +## along with this program; if not, see . ## import acquisition @@ -38,7 +37,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 +192,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 +377,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 +398,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 +413,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 +425,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 +452,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 +487,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: