def _append_items(self, item, deep, items=[]): sub_items = [] inc_item = None for inc_file in items: if inc_file.rec_depth == deep: if inc_item is not None: if sub_items: self._append_items(inc_item, deep + 1, sub_items) sub_items = [] item.appendRow(inc_item) inc_item = None if inc_item is None: pkg, _ = package_name(os.path.dirname(inc_file.inc_path)) size_color = 'gray' if inc_file.size == 0 or inc_file.size > 1000000: size_color = 'orange' itemstr = '%s <span style="color:%s;"><em>%s</em></span> [%s]' % (os.path.basename(inc_file.inc_path), size_color, sizeof_fmt(inc_file.size), pkg) inc_item = QStandardItem('%d: %s' % (inc_file.line_number, itemstr)) inc_item.setData(self.ITEM_TYPE_INC_FILE, self.ITEM_TYPE) inc_item.setData(inc_file.path_or_str, self.DATA_FILE) inc_item.setData(inc_file.line_number, self.DATA_LINE) inc_item.setData(inc_file.inc_path, self.DATA_INC_FILE) inc_item.setData(inc_file.rec_depth + 1, self.DATA_LEVEL) inc_item.setData(inc_file.size, self.DATA_SIZE) inc_item.setData(inc_file.raw_inc_path, self.DATA_RAW) inc_item.setData(inc_file.args, self.DATA_ARGS) inc_item.setData(inc_file.unset_default_args, self.DATA_DEF_ARGS_NOT_SET) # add included arguments if inc_file.unset_default_args or inc_file.args: arg_item = QStandardItem('arguments') arg_item.setData(self.ITEM_TYPE_INC_GROUP_ARG, self.ITEM_TYPE) if inc_file.unset_default_args: self.has_warnings = True arg_item.setIcon(self._info_icon) for da_name, da_value in inc_file.unset_default_args.items(): da_item = QStandardItem('<arg_not_set>%s: %s' % (da_name, da_value)) da_item.setData(self.ITEM_TYPE_INC_ARG, self.ITEM_TYPE) da_item.setData(inc_file.path_or_str, self.DATA_FILE) da_item.setData(inc_file.inc_path, self.DATA_INC_FILE) da_item.setData(da_name, self.DATA_ARG_NAME) da_item.setToolTip("This argument is definded as default, but no set while include.") arg_item.appendRow(da_item) if inc_file.args: for da_name, da_value in inc_file.args.items(): da_item = QStandardItem('<arg>%s: %s' % (da_name, da_value)) da_item.setData(self.ITEM_TYPE_INC_ARG, self.ITEM_TYPE) da_item.setData(inc_file.path_or_str, self.DATA_FILE) da_item.setData(inc_file.inc_path, self.DATA_INC_FILE) da_item.setData(da_name, self.DATA_ARG_NAME) arg_item.appendRow(da_item) inc_item.appendRow(arg_item) elif inc_file.rec_depth > deep: sub_items.append(inc_file) if inc_item is not None: if sub_items: self._append_items(inc_item, deep + 1, sub_items) sub_items = [] item.appendRow(inc_item) inc_item = None
def _get_data_items_for_path(self, slot_name, slot_type, slot_path, **kwargs): expression_item = QStandardItem('') expression_item.setToolTip( 'enter valid Python expression here, using "i" as counter and functions from math, random and time modules' ) return (ReadonlyItem(slot_name), ReadonlyItem(QStandardItem(slot_type)), expression_item)
def _get_data_items_for_path(self, slot_name, slot_type_name, slot_path, **kwargs): if slot_name.startswith('/'): return (CheckableItem(slot_name), ReadonlyItem(slot_type_name), QStandardItem(''), ReadonlyItem('')) expression_item = QStandardItem('') expression_item.setToolTip( 'enter valid Python expression here, using "i" as counter and functions from math, ' 'random and time modules') return (ReadonlyItem(slot_name), QStandardItem(slot_type_name), ReadonlyItem(''), expression_item)
def _get_data_items_for_path(self, slot_name, slot_type, slot_path, **kwargs): expression_item = QStandardItem('') expression_item.setToolTip('enter valid Python expression here, using "i" as counter and functions from math, random and time modules') return (ReadonlyItem(slot_name), ReadonlyItem(QStandardItem(slot_type)), expression_item)
def _get_data_items_for_path(self, slot_name, slot_type_name, slot_path, **kwargs): if slot_name.startswith('/'): return (CheckableItem(slot_name), ReadonlyItem(slot_type_name), QStandardItem(''), ReadonlyItem('')) expression_item = QStandardItem('') expression_item.setToolTip('enter valid Python expression here, using "i" as counter and functions from math, random and time modules') return (CheckableItem(slot_name), QStandardItem(slot_type_name), ReadonlyItem(''), expression_item)