Skip to content

Commit

Permalink
add missing docstrings and fix sphinx warnings (#75)
Browse files Browse the repository at this point in the history
* add missing dosctrings and fix sphinx warnings

* keep flake8 happy
  • Loading branch information
gillins committed Mar 5, 2024
1 parent b65ab93 commit bbcf2df
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# html_static_path = ['_static']

# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
Expand Down
2 changes: 1 addition & 1 deletion doc/source/tuiview_viewerstrings.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
viewerstrings
============
=============
.. automodule:: tuiview.viewerstrings
:members:
:undoc-members:
Expand Down
1 change: 1 addition & 0 deletions tuiview/geolinkedviewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class GeolinkedViewers(QObject):
# signals
newViewerCreated = pyqtSignal(viewerwindow.ViewerWindow,
name='newViewerCreated')
"signal emitted when a new viewer window is created"

def __init__(self, loadPlugins=True):
QObject.__init__(self)
Expand Down
1 change: 1 addition & 0 deletions tuiview/layerwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ class LayerWindow(QDockWidget):
"""
# signals
layerWindowClosed = pyqtSignal('QDockWidget', name='layerWindowClosed')
"signal emitted when window closed"

def __init__(self, parent, viewwidget):
QDockWidget.__init__(self, "Layers", parent)
Expand Down
1 change: 1 addition & 0 deletions tuiview/profilewindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class ProfileDockWidget(QDockWidget):
"""
# signals
profileClosed = pyqtSignal(QDockWidget, name='profileClosed')
"emitted when Window closed"

def __init__(self, parent, viewwidget):
QDockWidget.__init__(self, "Profile", parent)
Expand Down
2 changes: 2 additions & 0 deletions tuiview/querywindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ class ThematicVerticalHeader(QHeaderView):
otherwise behaves the same as the real thing.
"""
clicked = pyqtSignal(QMouseEvent, name='clicked')
"emitted when header clicked"

def __init__(self, parent):
QHeaderView.__init__(self, Qt.Vertical, parent)
Expand Down Expand Up @@ -711,6 +712,7 @@ class QueryDockWidget(QDockWidget):
"""
# signals
queryClosed = pyqtSignal(QDockWidget, name='queryClosed')
"emitted when window closed"

def __init__(self, parent, viewwidget):
QDockWidget.__init__(self, "Query", parent)
Expand Down
2 changes: 2 additions & 0 deletions tuiview/userexpressiondialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ class UserExpressionDialog(QDialog):
# signals
newExpression = pyqtSignal(['QString'], ['QString', int],
name='newExpression')
"emitted when a new expression is entered"
# not used?
undoEdit = pyqtSignal('QObject', int, name='undoEdit')
"emitted when user wants to undo"

def __init__(self, parent, col=None, undoObject=None):
QDialog.__init__(self, parent)
Expand Down
1 change: 1 addition & 0 deletions tuiview/vectorquerywindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class VectorQueryDockWidget(QDockWidget):
Dockable window that is a combined profile and ruler
"""
queryClosed = pyqtSignal(QDockWidget, name='queryClosed')
"emitted when window closed"

def __init__(self, parent):
QDockWidget.__init__(self, "Vector Query", parent)
Expand Down
3 changes: 3 additions & 0 deletions tuiview/viewerLUT.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,11 @@ class ViewerLUT(QObject):
"""
# signals
newProgress = pyqtSignal('QString', name='newProgress')
"emitted when a new progress bar is needed"
newPercent = pyqtSignal(int, name='newPercent')
"emitted when a new percent value is available"
endProgress = pyqtSignal(name='endProgress')
"emitted when progress finished"

def __init__(self):
QObject.__init__(self) # so we can emit signal
Expand Down
22 changes: 22 additions & 0 deletions tuiview/viewerlayers.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ def findBestOverview(self, imgpixperwinpix):


NOTSET_STRING = 'Not Set'
"Returned when one of the property items not set on the file"


class PropertyInfo(object):
Expand All @@ -195,6 +196,7 @@ def setSR(self, sr):
self.sr = sr

def getUTMZone(self):
"get the UTM zone, if set"
utmZone = NOTSET_STRING
if self.sr is not None:
zone = self.sr.GetUTMZone()
Expand All @@ -203,30 +205,35 @@ def getUTMZone(self):
return utmZone

def getProjection(self):
"get the projection, if set"
proj = NOTSET_STRING
if self.sr is not None:
proj = self.sr.GetAttrValue('PROJECTION')
return proj

def getDatum(self):
"get the datum, if set"
datum = NOTSET_STRING
if self.sr is not None:
datum = self.sr.GetAttrValue('DATUM')
return datum

def getSpheroid(self):
"get spheroid, if set"
spheroid = NOTSET_STRING
if self.sr is not None:
spheroid = self.sr.GetAttrValue('SPHEROID')
return spheroid

def getUnits(self):
"get the units, if set"
units = NOTSET_STRING
if self.sr is not None:
units = self.sr.GetLinearUnitsName()
return units

def getWKT(self):
"get the projection as a WKT"
wkt = NOTSET_STRING
if self.sr is not None:
wkt = self.sr.ExportToPrettyWkt()
Expand Down Expand Up @@ -1260,6 +1267,7 @@ def setSQL(self, sql=None):
self.sql = sql

def getSQL(self):
"returns the SQL used for this layer"
return self.sql

def hasSQL(self):
Expand All @@ -1279,21 +1287,27 @@ def setLineWidth(self, linewidth):
self.linewidth = linewidth

def getLineWidth(self):
"gets the current line width"
return self.linewidth

def setHalfCrossSize(self, halfCrossSize):
"set the half cross size (used for points)"
self.halfCrossSize = halfCrossSize

def getHalfCrossSize(self):
"get the half cross size (used for points)"
return self.halfCrossSize

def setFieldToLabel(self, field):
"set the field to label (None disables)"
self.fieldToLabel = field

def getFieldToLabel(self):
"get the field that is being used to label"
return self.fieldToLabel

def getColorAsRGBATuple(self):
"Returns the current color as a tuple"
rgba = []
for code in viewerLUT.RGBA_CODES:
lutindex = viewerLUT.CODE_TO_LUTINDEX[code]
Expand All @@ -1318,6 +1332,7 @@ def setLabelColor(self, color):
self.lut[2, lutindex] = value

def getLabelColorAsRGBATuple(self):
"Returns the current label color as a tuple"
rgba = []
for code in viewerLUT.RGBA_CODES:
lutindex = viewerLUT.CODE_TO_LUTINDEX[code]
Expand Down Expand Up @@ -1536,6 +1551,7 @@ def setSQL(self, sql=None):
raise NotImplementedError(msg)

def getSQL(self):
"unlike the base class we don't support SQL"
msg = "ViewerFeatureVectorLayer doesn't support SQL"
raise NotImplementedError(msg)

Expand All @@ -1552,11 +1568,17 @@ class LayerManager(QObject):
# use object rather than ViewerLayer for topLayerChanged
# so we can pass None
topLayerChanged = pyqtSignal(object, name='topLayerChanged')
"signal emitted when top layer changed"
layersChanged = pyqtSignal(name='layersChanged')
"signal emitted when layers have changed"
newProgressSig = pyqtSignal('QString', name='newProgress')
"signal emitted when a new progress bar is needed"
endProgressSig = pyqtSignal(name='endProgress')
"signal emitted when progress is finished"
newPercentSig = pyqtSignal(int, name='newPercent')
"signal emitted when a new progress percent is reached"
statusMessageSig = pyqtSignal('QString', name='statusMessage')
"signal emitted with a new status message needs to be shown to the user"

def __init__(self):
QObject.__init__(self)
Expand Down
9 changes: 9 additions & 0 deletions tuiview/viewerwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,31 @@ class ViewerWidget(QAbstractScrollArea):
"""
# signals
geolinkMove = pyqtSignal(GeolinkInfo, name='geolinkMove')
"viewer moved, geolink the others"
geolinkQueryPoint = pyqtSignal(GeolinkInfo,
name='geolinkQueryPoint')
"viewer queried"
# can't use ViewerWidget - use base class instead
layerAdded = pyqtSignal(QAbstractScrollArea, name='layerAdded')
"layer added"
showStatusMessage = pyqtSignal('QString',
name='showStatusMessage')
"show new status message"
activeToolChanged = pyqtSignal(ActiveToolChangedInfo,
name='activeToolChanged')
"active tool has changed"
polygonCollected = pyqtSignal(PolygonToolInfo,
name='polygonCollected')
"polygon has been collected"
polylineCollected = pyqtSignal(PolylineToolInfo,
name='polylineCollected')
"line has been collected"
vectorLocationSelected = pyqtSignal(list,
viewerlayers.ViewerVectorLayer,
name='vectorLocationSelected')
"a location on a vector as been selected"
locationSelected = pyqtSignal(QueryInfo, name='locationSelected')
"a location on a raster as been selected"

def __init__(self, parent):
QAbstractScrollArea.__init__(self, parent)
Expand Down
6 changes: 6 additions & 0 deletions tuiview/viewerwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,19 @@ class ViewerWindow(QMainWindow):
"""
# signals
newWindowSig = pyqtSignal(name='newWindow')
"new window created"
tileWindowsSig = pyqtSignal(int, int, object, name='tileWindows')
"user has requested that the windows are tiles"
newQueryWindowSig = pyqtSignal(querywindow.QueryDockWidget,
name='newQueryWindow')
"user has opened a new query window"
closeAllWindowsSig = pyqtSignal(name='closeAllWindows')
"close all tuiview windows"
# Don't know how to specify file objects...
writeViewersState = pyqtSignal(object, name='writeViewersState')
"write viewer state to a file"
readViewersState = pyqtSignal(object, name='readViewersState')
"read viewer state from a tile"

def __init__(self):
QMainWindow.__init__(self)
Expand Down

0 comments on commit bbcf2df

Please sign in to comment.