def __init__(self): QDialog.__init__(self, appdata.topwindow, Qt.WindowSystemMenuHint | Qt.WindowTitleHint) self.setWindowTitle(self.vis_label) self.source = FileBrowseButton(self) self.destionation = FileBrowseButton(self) grid = QGridLayout(self) grid.addWidget(QLabel(self.msg_source, self), 0, 0) grid.addWidget(self.source, 0, 1) grid.addWidget(QLabel(self.msg_destionation, self), 1, 0) grid.addWidget(self.destionation, 1, 1) self.btn_ok = QPushButton('Ok', self) self.btn_ok.setDefault(True) self.btn_cancel = QPushButton('Cancel', self) self.btn_ok.clicked.connect(self.accept) self.btn_cancel.clicked.connect(self.reject) layout_btn = QHBoxLayout() layout_btn.addStretch(1) layout_btn.addWidget(self.btn_ok) layout_btn.addWidget(self.btn_cancel) grid.addLayout(layout_btn, 2, 0, 1, 2) if self.exec_() == QDialog.Accepted: appconfig['paths.trans_sample_source'] = str(self.source.GetPath()) appconfig['paths.trans_sample_destination'] = str( self.destionation.GetPath()) appconfig.SaveSettings()
class Settings_PathsPage(QWidget): msg_part4 = tm.main.settings_part4 msg_pcardl = tm.main.settings_pcardl msg_p7tpl = tm.main.settings_p7tpl def __init__(self, parent): QWidget.__init__(self, parent) box = QGroupBox(tm.main.py_search_paths, self) self.pypath = QPlainTextEdit(box) self.pypath.setPlainText(os.pathsep.join(appconfig.get('sys.path', []))) layout = QVBoxLayout(self) layout.addWidget(box) box_layout = QVBoxLayout(box) box_layout.addWidget(self.pypath) box = QGroupBox(tm.main.settings_common_file_paths, self) self.part4_path = FileBrowseButton(box, appconfig.get('cfg://part4', '')) self.pcardl_path = FileBrowseButton(box, appconfig.get('cfg://pca_rdl', '')) self.p7tpl_path = FileBrowseButton(box, appconfig.get('cfg://p7tpl', '')) grid = QGridLayout(box) grid.addWidget(QLabel(self.msg_part4, self), 0, 0) grid.addWidget(self.part4_path, 0, 1) grid.addWidget(QLabel(self.msg_pcardl, self), 1, 0) grid.addWidget(self.pcardl_path, 1, 1) grid.addWidget(QLabel(self.msg_p7tpl, self), 2, 0) grid.addWidget(self.p7tpl_path, 2, 1) layout.addWidget(box) def Apply(self): newpaths = self.pypath.toPlainText().split(os.pathsep) sys.path = appdata.path for v in newpaths: site.addsitedir(v.encode(sys.getfilesystemencoding())) appconfig['sys.path'] = newpaths appconfig['cfg://part4'] = str(self.part4_path.GetPath()) appconfig['cfg://pca_rdl'] = str(self.pcardl_path.GetPath()) appconfig['cfg://p7tpl'] = str(self.p7tpl_path.GetPath()) appconfig.SaveSettings() return False
class DependenciesDialog(QDialog): def __init__(self): QDialog.__init__(self, appdata.topwindow, Qt.WindowSystemMenuHint | Qt.WindowTitleHint) self.setWindowTitle(tm.ext.setup_catalog_title) self.p7tpl = FileBrowseButton(self, appconfig.get('paths.p7tpl_catalog', '')) self.pcardl = FileBrowseButton(self, appconfig.get('paths.rdl_catalog', '')) self.proj_ns = QLineEdit( appconfig.get('catalog.proj_ns', 'http://example.org/rdl/'), self) value = True if appconfig.get('catalog.attr_inheritance', 'True') == 'True' else False self.attr_inheritance = QCheckBox(self) self.attr_inheritance.setText(tm.ext.attr_inheritance) self.attr_inheritance.setChecked(value) grid = QGridLayout(self) grid.addWidget(QLabel(tm.ext.template_set_field, self), 0, 0) grid.addWidget(self.p7tpl, 0, 1) grid.addWidget(QLabel(tm.ext.rdl_field, self), 1, 0) grid.addWidget(self.pcardl, 1, 1) grid.addWidget(QLabel(tm.ext.ns_for_new_field, self), 2, 0) grid.addWidget(self.proj_ns, 2, 1) grid.addWidget(self.attr_inheritance, 3, 0, 1, 2) self.btn_ok = QPushButton(tm.ext.ok, self) self.btn_ok.setDefault(True) self.btn_cancel = QPushButton(tm.ext.cancel, self) self.btn_ok.clicked.connect(self.accept) self.btn_cancel.clicked.connect(self.reject) layout_btn = QHBoxLayout() layout_btn.addStretch(1) layout_btn.addWidget(self.btn_ok) layout_btn.addWidget(self.btn_cancel) grid.addLayout(layout_btn, 4, 0, 1, 2) if self.exec_() == QDialog.Accepted: appconfig['paths.p7tpl_catalog'] = str(self.p7tpl.GetPath()) appconfig['paths.rdl_catalog'] = str(self.pcardl.GetPath()) appconfig['catalog.proj_ns'] = str(self.proj_ns.text()) appconfig['catalog.attr_inheritance'] = str( self.attr_inheritance.isChecked()) appconfig.SaveSettings()
class DependenciesDialog(QDialog): vis_label = 'Setup TabLan dependencies...' msg_p7tpl = "Template set:" msg_pcardl = "RDL:" msg_ns = "Namespace for new entities:" def __init__(self): QDialog.__init__(self, appdata.topwindow, Qt.WindowSystemMenuHint | Qt.WindowTitleHint) self.setWindowTitle(tm.ext.setup_tablan_title) self.p7tpl = FileBrowseButton(self, appconfig.get('paths.p7tpl_tablan', '')) self.pcardl = FileBrowseButton(self, appconfig.get('paths.rdl_tablan', '')) self.proj_ns = QLineEdit( appconfig.get('tablan.proj_ns', 'http://example.org/rdl/'), self) grid = QGridLayout(self) grid.addWidget(QLabel(tm.ext.template_set_field, self), 0, 0) grid.addWidget(self.p7tpl, 0, 1) grid.addWidget(QLabel(tm.ext.rdl_field, self), 1, 0) grid.addWidget(self.pcardl, 1, 1) grid.addWidget(QLabel(tm.ext.ns_for_new_field, self), 2, 0) grid.addWidget(self.proj_ns, 2, 1) self.btn_ok = QPushButton(tm.ext.ok, self) self.btn_ok.setDefault(True) self.btn_cancel = QPushButton(tm.ext.cancel, self) self.btn_ok.clicked.connect(self.accept) self.btn_cancel.clicked.connect(self.reject) layout_btn = QHBoxLayout() layout_btn.addStretch(1) layout_btn.addWidget(self.btn_ok) layout_btn.addWidget(self.btn_cancel) grid.addLayout(layout_btn, 4, 0, 1, 2) if self.exec_() == QDialog.Accepted: appconfig['paths.p7tpl_tablan'] = str(self.p7tpl.GetPath()) appconfig['paths.rdl_tablan'] = str(self.pcardl.GetPath()) appconfig['tablan.proj_ns'] = str(self.proj_ns.text()) appconfig.SaveSettings()
def __init__(self, parent): QWidget.__init__(self, parent) box = QGroupBox(tm.main.py_search_paths, self) self.pypath = QPlainTextEdit(box) self.pypath.setPlainText(os.pathsep.join(appconfig.get('sys.path', []))) layout = QVBoxLayout(self) layout.addWidget(box) box_layout = QVBoxLayout(box) box_layout.addWidget(self.pypath) box = QGroupBox(tm.main.settings_common_file_paths, self) self.part4_path = FileBrowseButton(box, appconfig.get('cfg://part4', '')) self.pcardl_path = FileBrowseButton(box, appconfig.get('cfg://pca_rdl', '')) self.p7tpl_path = FileBrowseButton(box, appconfig.get('cfg://p7tpl', '')) grid = QGridLayout(box) grid.addWidget(QLabel(self.msg_part4, self), 0, 0) grid.addWidget(self.part4_path, 0, 1) grid.addWidget(QLabel(self.msg_pcardl, self), 1, 0) grid.addWidget(self.pcardl_path, 1, 1) grid.addWidget(QLabel(self.msg_p7tpl, self), 2, 0) grid.addWidget(self.p7tpl_path, 2, 1) layout.addWidget(box)