def resizeEvent(self, event): """ Re-implemented to re-calculate the grid size to provide scaling icons Parameters ---------- event : QtCore.QEvent """ width = self.viewport().width() - 30 # The minus 30 above ensures we don't end up with an item width that # can't be drawn the expected number of times across the view without # being wrapped. Without this, the view can flicker during resize tileWidth = width / VIEW_COLUMNS iconWidth = int(tileWidth * 0.8) self.setGridSize(QtCore.QSize(tileWidth, tileWidth)) self.setIconSize(QtCore.QSize(iconWidth, iconWidth)) return super(self.__class__, self).resizeEvent(event)
def create_tree_widget(self): self.files_queue_tree_widget = QtGui.QTreeWidget() self.files_queue_tree_widget.setMinimumSize(QtCore.QSize(300, 0)) self.files_queue_tree_widget.setRootIsDecorated(False) self.files_queue_tree_widget.setHeaderHidden(True) self.files_queue_tree_widget.setObjectName('files_queue_tree_widget') self.files_queue_tree_widget.setSelectionMode( QtGui.QAbstractItemView.ExtendedSelection) self.files_queue_tree_widget.setStyleSheet(gf.get_qtreeview_style()) self.main_layout.addWidget(self.files_queue_tree_widget)
def create_ui(self): self.customize_ui() self.controls_actions() # limiting available search characters self.setValidator(Qt4Gui.QRegExpValidator(QtCore.QRegExp('\w+'), self)) self.setFocusPolicy(QtCore.Qt.StrongFocus) self.setFrame(False)
def create_status_color_line(self): self.process_color_line = QtGui.QFrame(self) self.process_color_line.setMaximumSize(QtCore.QSize(2, 32)) self.process_color_line.setStyleSheet( 'QFrame { border: 0px; background-color: grey;}') self.process_color_line.setFrameShadow(QtGui.QFrame.Plain) self.process_color_line.setFrameShape(QtGui.QFrame.VLine) self.process_color_line.setLineWidth(2) self.process_color_line.setObjectName('status_color_line') self.main_layout.addWidget(self.process_color_line, 0, 0, 1, 1)
def resizeEvent(self, event): """ Resize event. """ QtGui.QPlainTextEdit.resizeEvent(self, event) content_rect = self.contentsRect() self._line_area.setGeometry( QtCore.QRect(content_rect.left(), content_rect.top(), self.lineNumberAreaWidth(), content_rect.height()))
def graphicsSceneResizeEvent(self, event): if self.pm1: if self.pm1.pixmap_item: rect = self.pm1.pixmap_item.boundingRect() else: rect = QtCore.QRect(0, 0, 512, 512) self.previewGraphicsView.setSceneRect(rect) self.previewGraphicsView.fitInView(rect, QtCore.Qt.KeepAspectRatio) event.accept()
def setupUi(self, taskItem): taskItem.setObjectName("taskItem") taskItem.resize(108, 20) taskItem.setWindowTitle("") self.versionlessLayout = QtGui.QGridLayout(taskItem) self.versionlessLayout.setContentsMargins(0, 0, 0, 0) self.versionlessLayout.setSpacing(0) self.versionlessLayout.setObjectName("versionlessLayout") spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.versionlessLayout.addItem(spacerItem, 0, 0, 1, 1) self.addToolButton = QtGui.QToolButton(taskItem) self.addToolButton.setMaximumSize(QtCore.QSize(75, 20)) self.addToolButton.setIconSize(QtCore.QSize(12, 12)) self.addToolButton.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) self.addToolButton.setAutoRaise(True) self.addToolButton.setArrowType(QtCore.Qt.DownArrow) self.addToolButton.setObjectName("addToolButton") self.versionlessLayout.addWidget(self.addToolButton, 0, 1, 1, 1) self.retranslateUi(taskItem) QtCore.QMetaObject.connectSlotsByName(taskItem)
class mayaBatchClass(QtCore.QObject): progress_out = QtCore.Signal(object) def __init__(self, parent=None): super(self.__class__, self).__init__(parent=parent) self.batch_process = QtCore.QProcess(self) self.actions() def start_batch(self): self.batch_process.setProcessChannelMode( QtCore.QProcess.MergedChannels) self.batch_process.readyRead.connect(self.progress_output) self.batch_process.waitForReadyRead(True) self.batch_process.start( u'{0}/python3/App/Python/python.exe'.format(TACTIC_DIR), ['{0}/bin/startup_standalone.py'.format(TACTIC_DIR)]) def progress_output(self): log_output = str(self.batch_process.readAllStandardOutput()) self.progress_out.emit(log_output) self.write_log(log_output) def write_log(self, log_text): log_path = u'{0}/log_out.log'.format(TACTIC_DIR) if os.path.exists(gf.extract_dirname(log_path)): with codecs.open(log_path, 'a+', 'utf-8') as log_file: log_file.write(log_text) else: os.makedirs(gf.extract_dirname(log_path)) with codecs.open(log_path, 'w+', 'utf-8') as log_file: log_file.write(log_text) log_file.close() def actions(self): self.batch_process.error.connect(self.error_handle) #self.batch_process.stateChanged.connect(self.state_changed_handle) #self.batch_process.readyRead.connect(self.progress_output) def error_handle(self, message=None): if message: print('Some errors', message)
def setupUi(self, previewItem): previewItem.setObjectName("previewItem") previewItem.resize(382, 64) self.gridLayout = QtGui.QGridLayout(previewItem) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setSpacing(0) self.gridLayout.setObjectName("gridLayout") self.previewLabel = QtGui.QLabel(previewItem) self.previewLabel.setMinimumSize(QtCore.QSize(64, 64)) self.previewLabel.setMaximumSize(QtCore.QSize(64, 64)) self.previewLabel.setStyleSheet( "QLabel {\n" " background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(175, 175, 175, 16), stop: 1 rgba(0, 0, 0, 0));\n" " border: 0px;\n" " border-radius: 4px;\n" " padding: 0px 0px;\n" "}") self.previewLabel.setTextFormat(QtCore.Qt.RichText) self.previewLabel.setAlignment(QtCore.Qt.AlignCenter) self.previewLabel.setObjectName("previewLabel") self.gridLayout.addWidget(self.previewLabel, 0, 0, 1, 1) self.fileNameLabel = QtGui.QLabel(previewItem) self.fileNameLabel.setMinimumSize(QtCore.QSize(0, 20)) self.fileNameLabel.setMaximumSize(QtCore.QSize(16777215, 24)) font = Qt4Gui.QFont() font.setWeight(75) font.setBold(True) self.fileNameLabel.setFont(font) self.fileNameLabel.setStyleSheet( "QLabel {\n" " background-color: transparent;\n" " border-bottom: 2px solid qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(128, 128, 128, 64), stop:1 rgba(128, 128,128, 0));\n" "}") self.fileNameLabel.setTextFormat(QtCore.Qt.PlainText) self.fileNameLabel.setObjectName("fileNameLabel") self.gridLayout.addWidget(self.fileNameLabel, 0, 1, 1, 1) self.retranslateUi(previewItem) QtCore.QMetaObject.connectSlotsByName(previewItem)
def set_settings_from_dict(self, settings_dict=None): if not settings_dict: settings_dict = { 'geometry': None, 'edit_widndow_settings_dict': self.edit_window.get_settings_dict(), } geo = settings_dict['geometry'] if geo: self.setGeometry(QtCore.QRect(geo[0], geo[1], geo[2], geo[3])) else: self.resize(600, 500) self.edit_window.set_settings_from_dict(settings_dict['edit_widndow_settings_dict'])
def create_ui(self): self.setWindowTitle('Preview Images list') self.resize(500, 400) self.setMinimumSize(QtCore.QSize(500, 400)) self.create_widgets() self.contorls_actions() self.fill_items_tree_widget(self.files_objects) self.fill_screenshot_items_tree_widget(self.screenshots)
def graphicsSceneResizeEvent(self, event): # TODO Smooth downscaling pixmap rect = QtCore.QRect(0, 0, 512, 512) if self.pix_list: # pix = self.pix_list[self.current_pix] # self.pm1.add_pixmap(pix.scaledToHeight(self.previewGraphicsView.height(), QtCore.Qt.SmoothTransformation)) rect = self.pix_list[self.current_pix].rect() self.previewGraphicsView.setSceneRect(rect) self.previewGraphicsView.fitInView(rect, QtCore.Qt.KeepAspectRatio) # print self.previewGraphicsView.height() # print self.pm1.pixmap_item event.accept()
def create_ui(self): self.setWindowTitle('Making Screenshot') self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) # if do not work on linux, try "apt install xcompmgr" and run it, or compiz self.setAttribute(QtCore.Qt.WA_TranslucentBackground) self.setWindowModality(QtCore.Qt.ApplicationModal) self.setGeometry(Qt4Gui.QCursor.pos().x() - 12, Qt4Gui.QCursor.pos().y() - 12, 24, 24) self.label_lay = QtGui.QVBoxLayout() self.setLayout(self.label_lay) self.screenshot_pixmap = None self.label_lay.setContentsMargins(0, 0, 0, 0) self.label_lay.setSpacing(0) self.bg_wd = QtGui.QLabel() self.bg_wd.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter) self.bg_wd.setPixmap( gf.get_icon('crosshairs', color=Qt4Gui.QColor(255, 255, 255)).pixmap(24, 24)) self.bg_wd.setStyleSheet( 'QLabel {padding: 0px;border: 0px dashed rgb(255,255,255); background-color: rgba(0,0,0,1);}' ) self.label_lay.addWidget(self.bg_wd) self.bg_wd.setMouseTracking(True) self.button_lay = QtGui.QHBoxLayout(self.bg_wd) self.button_lay.setContentsMargins(0, 0, 0, 0) self.button_lay.setSpacing(0) self.move_under_mouse_timer = QtCore.QTimer() self.move_under_mouse_timer.setInterval(50) self.move_under_mouse_timer.timeout.connect(self.move_under_mouse) self.move_under_mouse_timer.start() self.create_take_screenshot_button() self.setIcon() self.setMouseTracking(True) self.controls_actions()
def env_read_config(filename='settings', unique_id='', sub_id=None, long_abs_path=False): filename = filename.replace('/', '_').replace('\\', '_') if long_abs_path: abs_path = u'{0}/settings/{1}/{2}/{3}'.format( env_mode.get_current_path(), env_mode.get_node(), env_server.get_cur_srv_preset(), env_mode.get_mode()) else: abs_path = u'{0}/settings'.format(env_mode.get_current_path()) if CFG_FORMAT == u'json': if unique_id: full_path = u'{0}/{1}/{2}.json'.format(abs_path, unique_id, filename) else: full_path = u'{0}/{1}.json'.format(abs_path, filename) if os.path.exists(full_path): with open(full_path, 'r') as json_file: try: obj = json.load(json_file) except Exception as expected: dl.exception(expected, group_id='configs') obj = {} json_file.close() if sub_id: return obj.get(sub_id) else: return obj elif CFG_FORMAT == u'ini': full_path = u'{0}/{1}.ini'.format(abs_path, filename) settings = QtCore.QSettings(full_path, QtCore.QSettings.IniFormat) settings.beginGroup(filename) if sub_id: settings.beginGroup(sub_id) value = settings.value(unique_id, None) settings.endGroup() if value: obj = json.loads(value) return obj
def create_stypes_tree_widget(self): self.stypes_tree_widget = Ui_extendedTreeWidget(self) self.stypes_tree_widget.setMaximumSize(QtCore.QSize(0, 16777215)) self.stypes_tree_widget.setHorizontalScrollBarPolicy( QtCore.Qt.ScrollBarAlwaysOff) self.stypes_tree_widget.setEditTriggers( QtGui.QAbstractItemView.NoEditTriggers) self.stypes_tree_widget.setVerticalScrollMode( QtGui.QAbstractItemView.ScrollPerPixel) self.stypes_tree_widget.setRootIsDecorated(False) self.stypes_tree_widget.setAnimated(True) self.stypes_tree_widget.setHeaderHidden(True) self.stypes_tree_widget.setObjectName('stypes_tree_widget') self.maint_layout.addWidget(self.stypes_tree_widget)
def sobj_tab_middle_mouse_event(self, event): if event.button() == QtCore.Qt.MouseButton.MiddleButton: pos = event.pos() # This is because hamburger button tab_pos = self.sObjTabWidget.tabBar().tabAt( QtCore.QPoint(pos.x() - 26, pos.y())) if tab_pos != -1: widget = self.sObjTabWidget.widget(tab_pos) tab = self.get_stype_tab_by_widget(widget) self.toggle_stype_tab(tab=tab, hide=True) tree_item = self.get_tree_item_by_code(tab.stype.get_code()) if tree_item: tree_item.setCheckState(0, QtCore.Qt.Unchecked) event.accept()
def send(self, m_client, data): key = m_client.property("key") # self.__logger.info("send message to client [{0}]".format(key)) block = QtCore.QByteArray() stream = QtCore.QDataStream(block, QtCore.QIODevice.WriteOnly) stream.setVersion(QtCore.QDataStream.Qt_4_7) stream.writeUInt64(0) stream << QtCore.QByteArray(data) stream.device().seek(0) stream.writeUInt64(block.size() - ctypes.sizeof(ctypes.c_long)) stream.device().seek(block.size()) stream.writeUInt64(0) s = 0 while s < block.size(): if m_client.state() != QtNetwork.QAbstractSocket.ConnectedState: m_client.warning( "is not connected to server [{0}]".format(key)) break w = m_client.write(block) s += w
def get_widgets(self, kwargs): def query_widgets_agent(): return self.query_widgets(kwargs) server_thread_pool = QtCore.QThreadPool() server_thread_pool.setMaxThreadCount(env_tactic.max_threads()) env_inst.set_thread_pool(server_thread_pool, 'server_query/server_thread_pool') worker = gf.get_thread_worker( query_widgets_agent, env_inst.get_thread_pool('server_query/server_thread_pool'), self.create_widgets_ui, gf.error_handle) worker.start()
def setupUi(self, openOptions): openOptions.setObjectName("openOptions") openOptions.setWindowModality(QtCore.Qt.ApplicationModal) openOptions.resize(400, 100) openOptions.setMinimumSize(QtCore.QSize(400, 0)) openOptions.setMaximumSize(QtCore.QSize(16777215, 200)) self.gridLayout = QtGui.QGridLayout(openOptions) self.gridLayout.setObjectName("gridLayout") spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum) self.gridLayout.addItem(spacerItem, 1, 0, 1, 1) self.optionsOpenPushButton = QtGui.QPushButton(openOptions) self.optionsOpenPushButton.setObjectName("optionsOpenPushButton") self.gridLayout.addWidget(self.optionsOpenPushButton, 1, 1, 1, 1) self.openPushButton = QtGui.QPushButton(openOptions) self.openPushButton.setObjectName("openPushButton") self.gridLayout.addWidget(self.openPushButton, 1, 2, 1, 1) self.groupBox = QtGui.QGroupBox(openOptions) self.groupBox.setFlat(True) self.groupBox.setObjectName("groupBox") self.horizontalLayout = QtGui.QHBoxLayout(self.groupBox) self.horizontalLayout.setObjectName("horizontalLayout") self.setWorkdirCheckBox = QtGui.QCheckBox(self.groupBox) self.setWorkdirCheckBox.setChecked(True) self.setWorkdirCheckBox.setObjectName("setWorkdirCheckBox") self.horizontalLayout.addWidget(self.setWorkdirCheckBox) spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem1) self.savePushButton = QtGui.QPushButton(self.groupBox) self.savePushButton.setObjectName("savePushButton") self.horizontalLayout.addWidget(self.savePushButton) self.gridLayout.addWidget(self.groupBox, 0, 0, 1, 3) self.retranslateUi(openOptions) QtCore.QMetaObject.connectSlotsByName(openOptions)
def create_controls(self): self.clear_queue_push_button = QtGui.QPushButton('Clear Queue') self.clear_queue_push_button.setMinimumSize(QtCore.QSize(120, 0)) self.clear_queue_push_button.setObjectName('clear_queue_push_button') self.clear_queue_push_button.setIcon(gf.get_icon('delete', icons_set='mdi')) self.files_count_label = QtGui.QLabel('Donwloads in Queue: ') self.files_count_label.setObjectName('files_count_label') self.files_num_label = QtGui.QLabel('') self.files_num_label.setObjectName("files_num_label") self.controls_layout.addWidget(self.files_count_label, 0, 0) self.controls_layout.addWidget(self.files_num_label, 0, 1) self.controls_layout.addWidget(self.clear_queue_push_button, 0, 2)
def set_settings_from_dict(self, settings_dict=None): ref_settings_dict = { 'geometry': None, 'edit_widndow_settings_dict': self.edit_window.get_settings_dict(), } settings = gf.check_config(ref_settings_dict, settings_dict) geo = settings['geometry'] if geo: self.setGeometry(QtCore.QRect(geo[0], geo[1], geo[2], geo[3])) else: self.resize(600, 500) self.edit_window.set_settings_from_dict( settings['edit_widndow_settings_dict'])
def create_ui(self): self.setWindowFlags(QtCore.Qt.ToolTip) screen = QtGui.QDesktopWidget().screenGeometry() size = self.geometry() self.setGeometry(screen.width() - size.width() - 5, screen.height() - size.height() - 45, self.width(), self.height()) # self.readSettings() self.createActions() self.createTrayIcon() self.setIcon() self.trayIcon.show() self._updateTimer = QtCore.QTimer(self) self.controls_actions()
def setupUi(self, DebugLog): DebugLog.setObjectName("DebugLog") DebugLog.resize(1195, 933) self.gridLayout = QtGui.QGridLayout(DebugLog) self.gridLayout.setObjectName("gridLayout") self.splitter = QtGui.QSplitter(DebugLog) self.splitter.setOrientation(QtCore.Qt.Horizontal) self.splitter.setObjectName("splitter") self.treeWidget = QtGui.QTreeWidget(self.splitter) self.treeWidget.setMaximumSize(QtCore.QSize(320, 16777215)) self.treeWidget.setStyleSheet("QTreeView::item {padding: 2px;}") self.treeWidget.setAlternatingRowColors(True) self.treeWidget.setVerticalScrollMode( QtGui.QAbstractItemView.ScrollPerPixel) self.treeWidget.setObjectName("treeWidget") self.treeWidget.headerItem().setText(0, "1") self.treeWidget.header().setVisible(False) self.debugLogTextEdit = QtGui.QTextEdit(self.splitter) self.debugLogTextEdit.setObjectName("debugLogTextEdit") self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.logCheckBox = QtGui.QCheckBox(DebugLog) self.logCheckBox.setObjectName("logCheckBox") self.horizontalLayout.addWidget(self.logCheckBox) self.infoCheckBox = QtGui.QCheckBox(DebugLog) self.infoCheckBox.setObjectName("infoCheckBox") self.horizontalLayout.addWidget(self.infoCheckBox) self.warningCheckBox = QtGui.QCheckBox(DebugLog) self.warningCheckBox.setObjectName("warningCheckBox") self.horizontalLayout.addWidget(self.warningCheckBox) self.exceptionCheckBox = QtGui.QCheckBox(DebugLog) self.exceptionCheckBox.setObjectName("exceptionCheckBox") self.horizontalLayout.addWidget(self.exceptionCheckBox) self.errorCheckBox = QtGui.QCheckBox(DebugLog) self.errorCheckBox.setObjectName("errorCheckBox") self.horizontalLayout.addWidget(self.errorCheckBox) self.criticalCheckBox = QtGui.QCheckBox(DebugLog) self.criticalCheckBox.setObjectName("criticalCheckBox") self.horizontalLayout.addWidget(self.criticalCheckBox) self.gridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 1) self.gridLayout.setRowMinimumHeight(0, 1) self.retranslateUi(DebugLog) QtCore.QMetaObject.connectSlotsByName(DebugLog)
class SquareLabel(QtGui.QLabel): clicked = QtCore.Signal() def __init__(self, menu, action, parent=None): super(self.__class__, self).__init__(parent=parent) self.menu = menu self.action = action def mousePressEvent(self, event): self.clicked.emit() event.accept() def enterEvent(self, event): self.setAutoFillBackground(False) self.menu.setActiveAction(self.action) def leaveEvent(self, event): self.setAutoFillBackground(True)
def get_stypes(self, result=None, run_thread=False): if result: self.stypes_items = result self.create_checkin_checkout_ui() # self.create_ui_my_tactic() # self.create_ui_float_notify() # self.create_ui_assets_browser() self.toggle_loading_label() if env_mode.get_mode() == 'maya': dl.log('Handling Maya Hotkeys', group_id='Maya') env_inst.ui_maya_dock.handle_hotkeys() self.ui_checkin_checkout.setHidden(False) env_inst.ui_main.set_info_status_text('') if run_thread: env_inst.ui_main.set_info_status_text( '<span style=" font-size:8pt; color:#00ff00;">Getting Search Types</span>') def get_stypes_agent(): return self.project.get_stypes() stypes_cache = None if stypes_cache: self.stypes_items = stypes_cache if not self.stypes_items_thread.isRunning(): self.stypes_items_thread.kwargs = dict(result=self.stypes_items) self.stypes_items_thread.routine = self.empty_return self.stypes_items_thread.start(QtCore.QThread.NormalPriority) else: server_thread_pool = QtCore.QThreadPool() server_thread_pool.setMaxThreadCount(env_tactic.max_threads()) env_inst.set_thread_pool(server_thread_pool, 'server_query/server_thread_pool') stypes_items_worker = gf.get_thread_worker( get_stypes_agent, env_inst.get_thread_pool('server_query/server_thread_pool'), result_func=self.get_stypes, error_func=gf.error_handle ) stypes_items_worker.start()
def setupUi(self, sobjectGroupBox): sobjectGroupBox.setObjectName("sobjectGroupBox") sobjectGroupBox.resize(150, 150) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( sobjectGroupBox.sizePolicy().hasHeightForWidth()) sobjectGroupBox.setSizePolicy(sizePolicy) sobjectGroupBox.setMinimumSize(QtCore.QSize(150, 150)) sobjectGroupBox.setFocusPolicy(QtCore.Qt.ClickFocus) sobjectGroupBox.setStyleSheet( "#sobjectGroupBox {\n" " background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(175, 175, 175, 75), stop: 1 rgba(0, 0, 0, 30));\n" " border: 1px solid rgb(96, 96, 96);\n" " border-radius: 1px;\n" " padding: 0px 0px;\n" " margin-top: 5ex;\n" "}\n" "\n" "#sobjectGroupBox::title {\n" " subcontrol-origin: margin;\n" " subcontrol-position: top center;\n" " padding: 0 3px;\n" " background-color: transparent;\n" "}") sobjectGroupBox.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignTop) self.vboxlayout = QtGui.QVBoxLayout(sobjectGroupBox) self.vboxlayout.setSpacing(0) self.vboxlayout.setContentsMargins(0, 0, 0, 0) self.vboxlayout.setObjectName("vboxlayout") self.picLabel = QtGui.QLabel(sobjectGroupBox) self.picLabel.setTextFormat(QtCore.Qt.RichText) self.picLabel.setAlignment(QtCore.Qt.AlignCenter) self.picLabel.setObjectName("picLabel") self.vboxlayout.addWidget(self.picLabel) self.vboxlayout.setStretch(0, 1) self.retranslateUi(sobjectGroupBox) QtCore.QMetaObject.connectSlotsByName(sobjectGroupBox)
def setupUi(self, updateDialog): updateDialog.setObjectName("updateDialog") updateDialog.resize(580, 400) updateDialog.setMinimumSize(QtCore.QSize(580, 400)) updateDialog.setSizeGripEnabled(True) updateDialog.setModal(True) self.gridLayout = QtGui.QGridLayout(updateDialog) self.gridLayout.setObjectName("gridLayout") self.versionLabel = QtGui.QLabel(updateDialog) self.versionLabel.setObjectName("versionLabel") self.gridLayout.addWidget(self.versionLabel, 0, 0, 1, 1) self.versionsTreeWidget = QtGui.QTreeWidget(updateDialog) self.versionsTreeWidget.setStyleSheet("QTreeView::item {\n" " padding: 2px;\n" "}") self.versionsTreeWidget.setAlternatingRowColors(True) self.versionsTreeWidget.setVerticalScrollMode( QtGui.QAbstractItemView.ScrollPerPixel) self.versionsTreeWidget.setWordWrap(True) self.versionsTreeWidget.setHeaderHidden(False) self.versionsTreeWidget.setObjectName("versionsTreeWidget") self.versionsTreeWidget.header().setDefaultSectionSize(130) self.versionsTreeWidget.header().setMinimumSectionSize(130) self.gridLayout.addWidget(self.versionsTreeWidget, 1, 0, 1, 5) self.updateToLastPushButton = QtGui.QPushButton(updateDialog) self.updateToLastPushButton.setObjectName("updateToLastPushButton") self.gridLayout.addWidget(self.updateToLastPushButton, 2, 0, 1, 4) self.updateToSelectedPushButton = QtGui.QPushButton(updateDialog) self.updateToSelectedPushButton.setObjectName( "updateToSelectedPushButton") self.gridLayout.addWidget(self.updateToSelectedPushButton, 2, 4, 1, 1) self.currentVersionlabel = QtGui.QLabel(updateDialog) self.currentVersionlabel.setObjectName("currentVersionlabel") self.gridLayout.addWidget(self.currentVersionlabel, 0, 1, 1, 3) self.commitPushButton = QtGui.QPushButton(updateDialog) self.commitPushButton.setObjectName("commitPushButton") self.gridLayout.addWidget(self.commitPushButton, 0, 4, 1, 1) self.gridLayout.setColumnStretch(1, 1) self.retranslateUi(updateDialog) QtCore.QMetaObject.connectSlotsByName(updateDialog)
def env_read_config(filename='settings', unique_id='', sub_id=None, long_abs_path=False): if long_abs_path: abs_path = '{0}/settings/{1}/{2}/{3}'.format( env_mode.get_current_path(), env_mode.get_node(), env_server.get_cur_srv_preset(), env_mode.get_mode()) else: abs_path = '{0}/settings'.format(env_mode.get_current_path()) if CFG_FORMAT == 'json': if unique_id: full_path = '{0}/{1}/{2}.json'.format(abs_path, unique_id, filename) else: full_path = '{0}/{1}.json'.format(abs_path, filename) if os.path.exists(full_path): with open(full_path, 'r') as json_file: obj = json.load(json_file) if sub_id: return obj.get(sub_id) else: return obj elif CFG_FORMAT == 'ini': full_path = '{0}/{1}.ini'.format(abs_path, filename) settings = QtCore.QSettings(full_path, QtCore.QSettings.IniFormat) settings.beginGroup(filename) if sub_id: settings.beginGroup(sub_id) value = settings.value(unique_id, None) settings.endGroup() if value: obj = json.loads(value) return obj
def __init__(self, *args, **kwargs): super(CompleterLineEdit, self).__init__(*args, **kwargs) self.completer = QtGui.QCompleter() self.completer.setCompletionMode(QtGui.QCompleter.UnfilteredPopupCompletion) self.completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive) self.completer.popup().setStyleSheet(""" QListView { font-size:10pt; selection-background-color: #ffaa00; selection-color: black; background-color: #7A7A7A; border-style: solid; border: 0px solid #EBEBEB; border-radius: 6; color: #EBEBEB; padding: 0px 0px 0px 0px; } """) self.setCompleter(self.completer) completer_strings = QtCore.QStringListModel([], self) self.completer.setModel(completer_strings)
def setupUi(self, sObjTabs): sObjTabs.setObjectName("sObjTabs") sObjTabs.resize(131, 192) self.horizontalLayout = QtGui.QHBoxLayout(sObjTabs) self.horizontalLayout.setSpacing(0) self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.horizontalLayout.setObjectName("horizontalLayout") self.sTypesTreeWidget = QtGui.QTreeWidget(sObjTabs) self.sTypesTreeWidget.setMaximumSize(QtCore.QSize(0, 16777215)) self.sTypesTreeWidget.setStyleSheet("QTreeView::item {\n" " padding: 2px;\n" "}") self.sTypesTreeWidget.setHorizontalScrollBarPolicy( QtCore.Qt.ScrollBarAlwaysOff) self.sTypesTreeWidget.setEditTriggers( QtGui.QAbstractItemView.NoEditTriggers) self.sTypesTreeWidget.setProperty("showDropIndicator", False) self.sTypesTreeWidget.setVerticalScrollMode( QtGui.QAbstractItemView.ScrollPerPixel) self.sTypesTreeWidget.setRootIsDecorated(False) self.sTypesTreeWidget.setAnimated(True) self.sTypesTreeWidget.setHeaderHidden(True) self.sTypesTreeWidget.setObjectName("sTypesTreeWidget") self.sTypesTreeWidget.headerItem().setText(0, "1") self.horizontalLayout.addWidget(self.sTypesTreeWidget) self.sObjTabWidget = QtGui.QTabWidget(sObjTabs) self.sObjTabWidget.setStyleSheet("QTabWidget::pane {\n" " border: 0px;\n" "}\n" "QTabWidget::tab-bar {\n" " alignment: left;\n" "}") self.sObjTabWidget.setMovable(True) self.sObjTabWidget.setObjectName("sObjTabWidget") self.horizontalLayout.addWidget(self.sObjTabWidget) self.horizontalLayout.setStretch(1, 1) self.retranslateUi(sObjTabs) QtCore.QMetaObject.connectSlotsByName(sObjTabs)