def initPages(self, files): loader = QtUiTools.QUiLoader() for i in files: file = QtCore.QFile(str(i)) if file.open(QtCore.QFile.ReadOnly): page = loader.load(file) self.addPage(page)
def _init_ui(self): try: # Do a stat check to make sure the UI file can be accessed, error if not because we need it. os.stat(PANEL_UI_PATH) except OSError: msg = "UI file necessary for Gapframes was not found. Is the tool installed correctly?" COMMUNICATOR.report_message_with_error(msg, error_type=OSError) self.ui = QtUiTools.QUiLoader().load(PANEL_UI_PATH) self.ui.node_selection_button_group = QtWidgets.QButtonGroup() for button_name in NODE_SELECTION_RADIO_BUTTONS: button = getattr(self.ui, button_name) self.ui.node_selection_button_group.addButton(button) # This is necessary so that this class can override the closeEvent from the UI. self.setCentralWidget(self.ui) self.setMaximumSize(self.ui.maximumSize()) self.setMinimumSize(self.ui.minimumSize()) self._toggle_window_stays_on_top(force_state=True, force_show=False) self._setup_input_sanitization() self._pass_signal_connections() self.restore_preferences() self._add_hotkeys()
def __init__(self, parent=None, csvInPath=None, csvDelimiter = '|' ): #super(dlgBomImport, self).__init__(parent) self.dlg = QtWidgets.QDialog(parent) loader = QtUiTools.QUiLoader() self.dlg.ui = loader.load('gui/bomImport.ui') self.dlg.ui.setAttribute(QtCore.Qt.WA_DeleteOnClose); self.dlg.ui.setModal(1); self.dlg.ui.show() #csvInPath = '..\\boms\\funksonde2\\sg04_btmodul\\bom.txt' self.quoter = Quote(csvInPath,csvDelimiter,self) fileext = os.path.splitext(csvInPath) csvOutPath = fileext[0]+datetime.datetime.now().strftime('%d_%m_%Y')+'.bomQuote' print(csvOutPath) if os.path.exists(csvOutPath): newFile = csvOutPath; counter = 0; fileext = os.path.splitext(csvOutPath) newFile = fileext[0]+'_backup_'+str(counter).zfill(3)+'.bomQuote' while os.path.exists(newFile): counter += 1; newFile = fileext[0]+'_backup_'+str(counter).zfill(3)+'.bomQuote' print(newFile) os.rename(csvOutPath,newFile) self.dlg.ui.btnBox.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(0) self.quoter.doQuote(csvOutPath) self.dlg.ui.btnBox.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(1)
def __init__(self, main_handler): self.window = QtUiTools.QUiLoader().load("./uis/scripts/ui_main.ui") self.window.setWindowTitle("Task Management App") self.window.setWindowIcon(QtGui.QIcon("./res/icons/squiggle3.png")) self.window.toggle_menu_btn.setIcon( QtGui.QIcon("./res/icons/burger.png")) self.window.create_task_btn.setIcon( QtGui.QIcon("./res/icons/plus.png")) self.window.create_project_btn.setIcon( QtGui.QIcon("./res/icons/circled-plus.png")) self.window.create_project_btn.setIconSize(QtCore.QSize(50, 50)) self.window.toggle_menu_btn.clicked.connect( lambda: self.toggle_menu(55, 300)) self.window.timeline_area.hide() self.window.projects_scroll.setVerticalScrollBarPolicy( QtCore.Qt.ScrollBarAlwaysOff) self.window.projects_scroll.setHorizontalScrollBarPolicy( QtCore.Qt.ScrollBarAlwaysOff) self.timeline = UiTimeline(self.window.timeline_area, main_handler) self.projects_bar = UiProjectsBar(self.window.projects_area)
def pyside(): import PySide from PySide import QtGui, QtCore, QtUiTools remap(PySide, "QtWidgets", QtGui) remap(QtCore, "QSortFilterProxyModel", QtGui.QSortFilterProxyModel) remap(QtCore, "QStringListModel", QtGui.QStringListModel) remap(QtCore, "QItemSelection", QtGui.QItemSelection) remap(QtCore, "QItemSelectionModel", QtGui.QItemSelectionModel) remap(QtCore, "QAbstractProxyModel", QtGui.QAbstractProxyModel) try: from PySide import QtWebKit remap(PySide, "QtWebKitWidgets", QtWebKit) except ImportError: # QtWebkit is optional in Qt , therefore might not be available pass add(PySide, "__wrapper_version__", __version__) add(PySide, "__binding__", "PySide") add(PySide, "__binding_version__", PySide.__version__) add(PySide, "__qt_version__", PySide.QtCore.qVersion()) add(PySide, "__added__", __added__) add(PySide, "__remapped__", __remapped__) add(PySide, "__modified__", __modified__) add(PySide, "load_ui", lambda fname: QtUiTools.QUiLoader().load(fname)) add(PySide, "convert", convert) add(PySide, "translate", lambda context, sourceText, disambiguation, n: QtCore.QCoreApplication( context, sourceText, disambiguation, None, n)) return PySide
def __init__(self): QWidget.__init__(self, parent=None) telacheia = ctypes.windll.user32 file = QtCore.QFile('TiraPeças.ui') file.open(QFile.ReadOnly) carregador = QtUiTools.QUiLoader() self.ui = carregador.load(file) grid_layout = QGridLayout() grid_layout.addWidget(self.ui) grid_layout.setMargin(0) self.setLayout(grid_layout) self.setMaximumSize(QtCore.QSize(telacheia.GetSystemMetrics(0), telacheia.GetSystemMetrics(1))) self.setGeometry(telacheia.GetSystemMetrics(0) - telacheia.GetSystemMetrics(0)+8 , telacheia.GetSystemMetrics(1) - telacheia.GetSystemMetrics(1) + 31, telacheia.GetSystemMetrics(0) - 16, telacheia.GetSystemMetrics(1) - 77) self.servidor = "MACROSUL-BTESTE\SQLEXPRESS" self.banco = "DB_desm" self.login = "******" self.senha = "m@crosul" self.servidorof = "Driver={SQL Server Native Client 11.0};Server=" + self.servidor + ';Database=' + self.banco + ';UID=' + \ self.login + ';PWD=' + self.senha self.connection = pyodbc.connect(self.servidorof)