def set_max_results(self, value=None): """ Set maximum amount of results to add to the result browser. Parameters ---------- value: int, optional Number of results. If None an input dialog will be used. Default is None. """ if value is None: # Create dialog dialog = QInputDialog(self) # Set dialog properties dialog.setModal(False) dialog.setWindowTitle(self.get_name()) dialog.setLabelText(_('Set maximum number of results: ')) dialog.setInputMode(QInputDialog.IntInput) dialog.setIntRange(1, 10000) dialog.setIntStep(1) dialog.setIntValue(self.get_option('max_results')) # Connect slot dialog.intValueSelected.connect( lambda value: self.set_option('max_results', value)) dialog.show() else: self.set_option('max_results', value)
def change_history_depth(self, value=None): """ Set history maximum entries. Parameters ---------- value: int or None, optional The valur to set the maximum history depth. If no value is provided, an input dialog will be launched. Default is None. """ if value is None: dialog = QInputDialog(self) # Set dialog properties dialog.setModal(False) dialog.setWindowTitle(_("History")) dialog.setLabelText(_("Maximum entries")) dialog.setInputMode(QInputDialog.IntInput) dialog.setIntRange(MIN_HISTORY_ENTRIES, MAX_HISTORY_ENTRIES) dialog.setIntStep(1) dialog.setIntValue(self.get_option("max_entries")) # Connect slot dialog.intValueSelected.connect( lambda value: self.set_option("max_entries", value)) dialog.show() else: self.set_option("max_entries", value)
def trim_records_dialog(self): logger, index = self.current_logger_and_index() if not logger: return d = QInputDialog(self) d.setInputMode(QInputDialog.IntInput) d.setIntRange( 0, 100000000) # because it sets intMaximum to 99 by default. why?? d.setLabelText('Keep this many records out of {}:'.format( logger.record_model.rowCount())) d.setWindowTitle('Trim tab records of "{}" logger'.format(logger.name)) d.intValueSelected.connect(self.trim_current_tab_records) d.open()
def max_capacity_dialog(self): logger, index = self.current_logger_and_index() if not logger: return d = QInputDialog(self) d.setInputMode(QInputDialog.IntInput) d.setIntRange( 0, 100000000) # because it sets intMaximum to 99 by default. why?? max_now = logger.record_model.max_capacity max_now = "not set" if max_now is None else max_now label_str = 'Set max capacity for "{}" logger\nCurrently {}. Set to 0 to disable:' d.setLabelText(label_str.format(logger.name, max_now)) d.setWindowTitle('Set max capacity') d.intValueSelected.connect(self.set_max_capacity) d.open()