本文整理汇总了Python中matplotlib.backends.backend_qt5agg.NavigationToolbar2QT.update方法的典型用法代码示例。如果您正苦于以下问题:Python NavigationToolbar2QT.update方法的具体用法?Python NavigationToolbar2QT.update怎么用?Python NavigationToolbar2QT.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_qt5agg.NavigationToolbar2QT
的用法示例。
在下文中一共展示了NavigationToolbar2QT.update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Calibrlogger
# 需要导入模块: from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg.NavigationToolbar2QT import update [as 别名]
class Calibrlogger(qgis.PyQt.QtWidgets.QMainWindow, Calibr_Ui_Dialog): # An instance of the class Calibr_Ui_Dialog is created same time as instance of calibrlogger is created
@fn_timer
def __init__(self, parent, settingsdict1={}, obsid=''):
utils.start_waiting_cursor()#show the user this may take a long time...
self.obsid = obsid
self.log_pos = None
self.y_pos = None
self.meas_ts = None
self.head_ts = None
self.head_ts_for_plot = None
self.level_masl_ts = None
self.loggerpos_masl_or_offset_state = 1
self.settingsdict = settingsdict1
qgis.PyQt.QtWidgets.QDialog.__init__(self, parent)
self.setAttribute(qgis.PyQt.QtCore.Qt.WA_DeleteOnClose)
self.setupUi(self) # Required by Qt4 to initialize the UI
self.setWindowTitle(ru(QCoreApplication.translate('Calibrlogger', "Calculate water level from logger"))) # Set the title for the dialog
self.INFO.setText(ru(QCoreApplication.translate('Calibrlogger', "Select the observation point with logger data to be adjusted.")))
self.log_calc_manual.setText("<a href=\"https://github.com/jkall/qgis-midvatten-plugin/wiki/4.-Edit-data\">Midvatten manual</a>")
# Create a plot window with one single subplot
self.calibrplotfigure = plt.figure()
self.axes = self.calibrplotfigure.add_subplot( 111 )
self.canvas = FigureCanvas( self.calibrplotfigure )
self.mpltoolbar = NavigationToolbar( self.canvas, self.widgetPlot )
self.layoutplot.addWidget( self.canvas )
self.layoutplot.addWidget( self.mpltoolbar )
self.show()
self.cid =[]
self.pushButtonSet.clicked.connect(lambda x: self.set_logger_pos())
self.pushButtonAdd.clicked.connect(lambda x: self.add_to_level_masl())
self.pushButtonFrom.clicked.connect(lambda x: self.set_from_date_from_x())
self.pushButtonTo.clicked.connect(lambda x: self.set_to_date_from_x())
self.L1_button.clicked.connect(lambda x: self.set_adjust_data('L1_date', 'L1_level'))
self.L2_button.clicked.connect(lambda x: self.set_adjust_data('L2_date', 'L2_level'))
self.M1_button.clicked.connect(lambda x: self.set_adjust_data('M1_date', 'M1_level'))
self.M2_button.clicked.connect(lambda x: self.set_adjust_data('M2_date', 'M2_level'))
self.pushButton_from_extent.clicked.connect(lambda: self.FromDateTime.setDateTime(num2date(self.axes.get_xbound()[0])))
self.pushButton_to_extent.clicked.connect(lambda: self.ToDateTime.setDateTime(num2date(self.axes.get_xbound()[1])))
self.pushButtonupdateplot.clicked.connect(lambda x: self.update_plot())
self.pushButtonLpos.clicked.connect(lambda x: self.catch_old_level())
self.pushButtonMpos.clicked.connect(lambda x: self.catch_new_level())
self.pushButtonMpos.setEnabled(False)
self.pushButtonCalcBestFit.clicked.connect(lambda x: self.logger_pos_best_fit())
self.pushButtonCalcBestFit.setToolTip(ru(QCoreApplication.translate('Calibrlogger', 'This will calibrate all values inside the chosen period\nusing the mean difference between head_cm and w_levels measurements.\n\nThe search radius is the maximum time distance allowed\n between a logger measurement and a w_level measurement.')))
self.pushButtonCalcBestFit2.clicked.connect(lambda x: self.level_masl_best_fit())
self.pushButtonCalcBestFit2.setToolTip(ru(QCoreApplication.translate('Calibrlogger', 'This will calibrate all values inside the chosen period\nusing the mean difference between level_masl and w_levels measurements.\n\nThe search radius is the maximum time distance allowed\n between a logger measurement and a w_level measurement.')))
self.pushButton_delete_logger.clicked.connect(lambda: self.delete_selected_range('w_levels_logger'))
self.adjust_trend_button.clicked.connect(lambda x: self.adjust_trend_func())
self.get_search_radius()
# Populate combobox with obsid from table w_levels_logger
self.load_obsid_from_db()
utils.stop_waiting_cursor()#now this long process is done and the cursor is back as normal
@property
def selected_obsid(self):
uncalibrated_str = ' (uncalibrated)'
return str(self.combobox_obsid.currentText().replace(uncalibrated_str, ''))
@fn_timer
def load_obsid_from_db(self):
self.combobox_obsid.clear()
res = db_utils.sql_load_fr_db("""SELECT DISTINCT obsid, (CASE WHEN level_masl IS NULL AND head_cm IS NOT NULL THEN 'uncalibrated' ELSE 'calibrated' END) AS status FROM w_levels_logger ORDER BY obsid""")[1]
all_obsids = {}
for row in res:
all_obsids.setdefault(row[0], []).append(row[1])
self.combobox_obsid.addItems(sorted(all_obsids))
obsids_with_uncalibrated_data = [_obsid for _obsid, status in all_obsids.items() if 'uncalibrated' in status]
self.update_combobox_with_calibration_info(_obsids_with_uncalibrated_data=obsids_with_uncalibrated_data)
@fn_timer
def update_combobox_with_calibration_info(self, obsid=None, _obsids_with_uncalibrated_data=None):
"""
Adds an " (uncalibrated)" suffix after each obsid containing NULL-values in the column level_masl or removes it
if there is no NULL-values.
:param obsid: If obsid is given, only that obsid is checked. If not given then all obsids are checked.
:param _obsids_with_uncalibrated_data: A list of obsids which are uncalibrated.
If only obsid is given, calibration status will be read from database for that obsid.
If only _obsids_with_uncalibrated_data is given, all obsids will update status based on that list.
If both obsid and _obsids_with_uncalibrated_data are given, only status for that obsid will be updated based _obsids_with_uncalibrated_data.
If none is given, all obsids will update status based on result from database.
:return:
"""
uncalibrated_str = ' (uncalibrated)'
num_entries = self.combobox_obsid.count()
if obsid is None and _obsids_with_uncalibrated_data is None:
obsids_with_uncalibrated_data = [row[0] for row in db_utils.sql_load_fr_db("""SELECT DISTINCT obsid FROM w_levels_logger WHERE level_masl IS NULL""")[1]]
elif _obsids_with_uncalibrated_data is not None:
#.........这里部分代码省略.........