querywindow

Module that contains the QueryDockWidget

class tuiview.querywindow.ContinuousTableModel(*args: Any, **kwargs: Any)[source]

This class is the ‘model’ that drives the continuous table. QTableView asks it for the data etc

columnCount(parent)[source]

number of columns

data(index, role)[source]

Gets the actual data. A variety of Qt.ItemDataRole’s are passed, but we only use DisplayRole for the text and Qt.BackgroundRole for the highlight role

doUpdate(updateHorizHeader=False)[source]

Called by the parent window when the data has changed. Emits the appropriate signal.

headerData(section, orientation, role)[source]

returns the header labels for either vertical or horizontal

rowCount(parent)[source]

returns the number of rows

class tuiview.querywindow.QueryDockWidget(*args: Any, **kwargs: Any)[source]

Dock widget that contains the query window. Follows query tool clicks (can be disabled) and can change query point color. Image values for point are displayed thanks to locationSelected signal from ViewerWidget.

activeToolChanged(obj)[source]

Called in response to the activeToolChanged signal from the widget. If it wasn’t called by us, unset our tools

addColumn()[source]

User wants to add a column

changeCursorColor()[source]

User wishes to change cursor color

changeHighlightColor()[source]

User wishes to change highlight color

changeLabel(checked)[source]

State of display labels check has been changed. Redisplay plot.

closeEvent(event)[source]

Window is being closed - inform parent window

decreaseCursorSize()[source]

increase the cursor size

displayCoordsModeChanged(index)[source]

The mode of the coords display has changed

editColor()[source]

Change the colour of the selected rows

editColumn(col)[source]

User has requested to edit a column

geogLineSelect(checked)[source]

Turn on the polyline tool so we can select the area

geogPointSelect(checked)[source]

Turn on the query tool so we can select a point

geogSelect(checked)[source]

Turn on the polygon tool so we can select the area

getColorIcon(color)[source]

Returns the icon for the change color tool which is based on the current color

highlight(state)[source]

Highlight the currently selected rows on the map state contains whether we are enabling this or not

increaseCursorSize()[source]

increase the cursor size

keyPressEvent(event)[source]

User has pressed a key. See if we are recording keystrokes and updating attribute columns

layersChanged()[source]

Called in response to layersChanged signal from viewerlayers. We check to see if our lastLayer has been removed and if so, close.

locationSelected(qi)[source]

The ViewerWidget has told us it has a new coordinate from the query tool.

moveColumn(col, code)[source]

Move column left or right in the display based on code.

newEditUserExpression(expression, col)[source]

Called in reponse to signal from UserExpressionDialog for editing

newLineGeogSelect(lineInfo)[source]

New polyline just been selected as part of a geographical select

newPolyGeogSelect(polyInfo)[source]

New polygon just been selected as part of a geographical select

newSelectUserExpression(expression)[source]

Called in reponse to signal from UserExpressionDialog for selection

nextSelected()[source]
onPlotScaling()[source]

Allows the user to change the Y axis scaling of the plot

previousSelected()[source]
removeSelection()[source]

Remove the current selection from the table widget

saveColOrder()[source]

Get the layer to save the current order of columns into the GDAL metadata

savePlot()[source]

Save the plot as a file. Either .pdf or .ps QPrinter chooses format based on extension.

scrollToFirstSelected()[source]

scroll to the first selected row

selectAll()[source]

Select all the rows in the table

setColumnAsLookup(colName)[source]

Allows the user to specify a column to be used to lookup the color table

setColumnDecimalPlaces(colName)[source]

Allows the user to set the number of decimal places for float columns

setColumnKeyboardEdit(colName)[source]

set column to receive keyboard events if col already sets, toggles off

setToolBarState(thematic)[source]

Set tool bar state to either thematic (True) or continuous (False). This enables/disables some of the toolbar buttons and the table header contect menu

setUIUpdateState(state)[source]

Update the bits of the UI that change when the update state changes.

setupActions()[source]

Create the actions to be shown on the toolbar

setupTableContinuous(data, layer)[source]

setup the table for displaying Continuous data. This is a row per band with the pixel values for each band shown The current red, green and blue bands have an icon

setupTableThematic(data, layer)[source]

For a single band dataset with attributes. Displays the attributes as a table and highlights the current value in the table.

setupToolbar()[source]

Add the actions to the toolbar

showUserExpression()[source]

Allow user to enter expression to select rows

storeLastSelection()[source]

Take a copy of self.selectionArray and store it

unlockDataset(state)[source]

User wants to lock or unlock dataset

updateColorTableInWidget()[source]

Call this when the color table changed and the LUT will be reloaded and redisplayed

updatePlot(qi, color)[source]

Updates the plot widget with new data/color

updateToolTip()[source]

When in thematic mode we set a toolip over the attributes that tells the user how many items selected

userNewCoord()[source]

User has pressed enter on one of the coord boxes Tell widget we want to move

queryClosed

emitted when window closed

class tuiview.querywindow.QueryTableView(*args: Any, **kwargs: Any)[source]

A hack to ensure all keypresses are redirected to the parent window for processing by the keyboard input handler rather than the default which tries to do some searching thing.

keyPressEvent(event)[source]
wheelEvent(e)[source]
class tuiview.querywindow.ThematicHorizontalHeader(*args: Any, **kwargs: Any)[source]

Same as a horizontal QHeaderView but responds to context menu requests when setThematicMode(True)

contextMenuEvent(event)[source]

Respond to context menu event

setThematicMode(mode)[source]

Set the mode (True or False) for context menu

class tuiview.querywindow.ThematicItemDelegate(*args: Any, **kwargs: Any)[source]

Because we can’t override the isSelected method of the modelselection we draw the selected state via the item delegate paint method as needed

paint(painter, option, index)[source]

Paint method - paint as selected if needed

class tuiview.querywindow.ThematicTableModel(*args: Any, **kwargs: Any)[source]

This class is the ‘model’ that drives the thematic table. QTableView asks it for the data etc

columnCount(parent)[source]

number of columns

createColorIcon(row)[source]

Returns the colour icon for the given row

data(index, role)[source]

Gets the actual data. A variety of Qt.ItemDataRole’s are passed, but we only use DisplayRole for the text and Qt.BackgroundRole for the highlight role

doUpdate(updateHorizHeader=False, updateVertHeader=False)[source]

Called by the parent window when the attributes have changed. Emits the appropriate signal.

geomChanged()[source]

size of window changed

headerData(section, orientation, role)[source]

returns the header labels for either vertical or horizontal

index(row, column, parent=None)[source]

Create a new QModelIndex for the specified row and column. The base class implementation just creates a new QModelIndex but we override this so we can set the “internalId” parameter which is available to clients to store more info. We use this parameter to store the current slider position. For most operations we could just obtain this by calling self.scroll.sliderPosition() again, but for selection this doesn’t work as they may have started the selection then scrolled down and ended the selection so we need to know the slider position for each index. This is espcially useful for the ItemDelegate which otherwise has no way of knowing what the scroll position was

The other obvious thing to do is to add the slider position onto the current row, but things get weird as sometimes Qt passes me a row with the position already added on…

rowClicked(e)[source]

handle signal sent from our vertical header saying that the

rowCount(parent)[source]

returns the number of rows

scrollChanged(value)[source]

Position in scroll changed

scrollToNextSelected()[source]
scrollToPreviousSelected()[source]
setHighlightRow(row)[source]

Called by setupTableThematic to indicate the row that should be highlighted

class tuiview.querywindow.ThematicVerticalHeader(*args: Any, **kwargs: Any)[source]

Our own vertical header that forwards the event on to the model to handle selection. In thematic mode only, otherwise behaves the same as the real thing.

mousePressEvent(e)[source]
setThematicMode(mode)[source]

Set the mode (True or False) for selection behaviour

clicked

emitted when header clicked

tuiview.querywindow.safeCreateColor(r, g, b, a=255)[source]

Same as QColor constructor but ensures vales all between 0 and 255 to avoid annoying warnings from Qt