def grid_layout_creation_1(self) -> None: self.group_box_1 = QGroupBox("Files") row = -1 d = cfg.PLATFORM_SETTINGS # pprint(d) layout = QGridLayout() row += 1 layout.addWidget(QLabel(bold("preferences.ini:")), row, 0) fname = cfg.PREFERENCES_INI layout.addWidget(QLabel(fname), row, 1) btn = QPushButton("Open") btn.clicked.connect(partial(opener.open_file_with_editor, self, fname)) layout.addWidget(btn, row, 2) row += 1 layout.addWidget(QLabel(bold("categories.yaml:")), row, 0) fname = cfg.categories_file() layout.addWidget(QLabel(fname), row, 1) btn = QPushButton("Open") btn.clicked.connect(partial(opener.open_file_with_editor, self, fname)) layout.addWidget(btn, row, 2) row += 1 layout.addWidget(QLabel(bold("settings.json:")), row, 0) fname = cfg.SETTINGS_FILE layout.addWidget(QLabel(fname), row, 1) btn = QPushButton("Open") btn.clicked.connect(partial(opener.open_file_with_editor, self, fname)) layout.addWidget(btn, row, 2) self.group_box_1.setLayout(layout)
def read(self): categories = cfg.categories_file() try: with open(categories) as f: log.info(f"{categories} was read") return yaml.safe_load(f) except Exception as e: log.warning("couldn't read {0}".format(categories)) log.warning(e) return {}
def read() -> Dict[str, List[str]]: categories = cfg.categories_file() try: with open(categories) as f: log.info(f"{categories} was read") result: Dict[str, List[str]] = yaml.safe_load(f) return result except Exception as e: log.warning("couldn't read {0}".format(categories)) log.warning(e) return {}