def __init__(self, main_window): super().__init__() self.main_window = main_window # 设置窗口无边框 self.setWindowFlags(QtCore.Qt.FramelessWindowHint) # 设置窗口背景透明 self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # 设置窗口大小 self.window_min_width = 500 self.window_max_width = 500 self.window_min_height = 400 self.window_max_height = 400 self.setMinimumSize(self.window_min_width, self.window_min_height) self.setMaximumSize(self.window_max_width, self.window_max_height) # 设置窗口图标 self.setWindowIcon(self.main_window.icon) # 设置窗口子部件 self.set_head_widget() self.set_body_widget() # 窗口组装 self.layout_main = QtWidgets.QVBoxLayout() self.layout_main.addWidget(self.widget_head) self.layout_main.addWidget(self.widget_body) self.layout_main.setSpacing(0) self.layout_main.setContentsMargins(0, 0, 0, 0) self.setLayout(self.layout_main) # 设置样式 QSSSetter.set_qss(self, __file__)
def __init__(self, parent): super().__init__(parent, QtCore.Qt.FramelessWindowHint) # 设置窗口大小 self.window_min_width = 250 self.window_max_width = 500 self.window_min_height = 120 self.window_max_height = 120 self.setMinimumSize(self.window_min_width, self.window_min_height) self.setMaximumSize(self.window_max_width, self.window_max_height) # 设置窗口背景透明 self.setAttribute(QtCore.Qt.WA_TranslucentBackground) widget_error = QtWidgets.QWidget() widget_error.setObjectName('error') widget_error.setMinimumSize(self.window_min_width, self.window_min_height) widget_error.setMaximumSize(self.window_max_width, self.window_max_height) button_box = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok) button_box.accepted.connect(self.accept) button_ok = button_box.button(QtWidgets.QDialogButtonBox.Ok) button_ok.setText('确定') button_ok.setFixedSize(50, 25) button_ok.setStyleSheet('QPushButton{' 'border-radius:2px;' 'font-size:12px;' 'font-family:"微软雅黑";' 'color:white;' 'background-color:rgba(255,102,51,90%);' '}') self.label_info = QtWidgets.QLabel() self.label_info.setObjectName('info') label_icon = QtWidgets.QLabel() label_icon.setFixedSize(32, 32) label_icon.setObjectName('icon') layout = QtWidgets.QVBoxLayout() layout.setSpacing(0) layout.setContentsMargins(20, 0, 20, 0) layout_info = QtWidgets.QHBoxLayout() layout_info.setSpacing(10) layout_info.addWidget(label_icon) layout_info.addWidget(self.label_info) layout.addStretch(1) layout.addLayout(layout_info) layout.addStretch(1) layout.addWidget(button_box) layout.addStretch(1) widget_error.setLayout(layout) layout_main = QtWidgets.QVBoxLayout() layout_main.addWidget(widget_error) layout_main.setSpacing(0) layout_main.setContentsMargins(0, 0, 0, 0) self.setLayout(layout_main) # 设置样式 QSSSetter.set_qss(self, __file__)
def __init__(self, main_window, tenant_id, tenant_name, env): super().__init__() self.main_window = main_window self.env = env self.tenant_id = tenant_id self.tenant_name = tenant_name self.application_status = { 1: '运行中', 2: '已结束', 3: '已拒绝', 4: '出错', 5: '已撤回', 51: '撤回中', 6: '已取消', 61: '取消中', 999: '终止' } self.children_windows = dict() self.children_windows['anal_result'] = None self.children_windows['select_application'] = None # 设置窗口无边框 self.setWindowFlags( QtCore.Qt.FramelessWindowHint ) # 设置窗口背景透明 self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # 设置窗口图标 self.setWindowIcon(self.main_window.icon) # 设置窗口大小 self.window_min_width = 500 self.window_max_width = 500 self.window_min_height = 135 self.window_max_height = 800 self.setMinimumSize(self.window_min_width, self.window_min_height) self.setMaximumSize(self.window_max_width, self.window_max_height) # 设置窗口子部件 self.set_head_widget() self.set_body_widget() # 窗口组装 self.layout_main = QtWidgets.QVBoxLayout(self) self.layout_main.addWidget(self.widget_head) self.layout_main.addWidget(self.widget_body) self.layout_main.setSpacing(0) self.layout_main.setContentsMargins(0, 0, 0, 0) self.setLayout(self.layout_main) # 设置样式 QSSSetter.set_qss(self, __file__)
def __init__(self, session_id, service, screen_width=None, screen_height=None): super().__init__() self.session_id = session_id self.window_main = None # 设置窗口大小 self.setFixedSize(400, 350) # 设置窗口无边框 self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) # 设置窗口背景透明 self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # 设置窗口图标 self.icon = QtGui.QIcon() self.icon.addPixmap(QtGui.QPixmap("images/window_icon.jpg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.setWindowIcon(self.icon) # 设置窗口子部件 self.set_window_buttons_widget() self.set_head_widget() self.set_body_widget() # 窗口组装 self.layout_main = QtWidgets.QVBoxLayout() self.layout_main.addWidget(self.widget_window_buttons) self.layout_main.addWidget(self.widget_head) self.layout_main.addWidget(self.widget_body) self.layout_main.setSpacing(0) self.layout_main.setContentsMargins(0, 0, 0, 0) self.setLayout(self.layout_main) # 连接服务 self.kos = service # 设置样式 QSSSetter.set_qss(self, __file__)
def __init__(self, parent, user): super().__init__() self.parent = parent self.children_windows = dict() self.user = user self.installEventFilter(self) self.activated = False # 设置窗口无边框 self.setWindowFlags(QtCore.Qt.FramelessWindowHint) # 设置窗口背景透明 self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # 设置窗口大小 self.window_min_width = 392 self.window_max_width = 392 self.window_min_height = 165 self.window_max_height = 165 self.setMinimumSize(self.window_min_width, self.window_min_height) self.setMaximumSize(self.window_max_width, self.window_max_height) # 设置窗口图标 self.setWindowIcon(self.parent.icon) # 设置窗口子部件 self.set_body_widget() # 窗口组装 self.layout_main = QtWidgets.QVBoxLayout() self.layout_main.addWidget(self.widget_body) self.layout_main.setSpacing(0) self.layout_main.setContentsMargins(0, 0, 0, 0) self.setLayout(self.layout_main) parent_pos = parent.pos() self.setGeometry(parent_pos.x() - self.window_min_width, parent_pos.y(), self.window_min_width, self.window_min_height) # 设置样式 QSSSetter.set_qss(self, __file__)
def __init__(self, parent, activity): super().__init__() self.parent = parent self.parent_activity = activity self.installEventFilter(self) self.activated = False # 设置窗口无边框 self.setWindowFlags(QtCore.Qt.FramelessWindowHint) # 设置窗口背景透明 self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # 设置窗口大小 self.window_min_width = 660 self.window_max_width = 660 self.window_min_height = 150 self.window_max_height = 800 self.setMinimumSize(self.window_min_width, self.window_min_height) self.setMaximumSize(self.window_max_width, self.window_max_height) # 设置窗口图标 self.setWindowIcon(self.parent.parent.main_window.icon) # 设置窗口子部件 self.set_body_widget() # 窗口组装 self.layout_main = QtWidgets.QVBoxLayout() self.layout_main.addWidget(self.widget_body) self.layout_main.setSpacing(0) self.layout_main.setContentsMargins(0, 0, 0, 0) self.setLayout(self.layout_main) parent_pos = self.parent.pos() self.move(parent_pos.x() + self.parent.width(), parent_pos.y() + self.parent.parent.height()) # 设置样式 QSSSetter.set_qss(self, __file__)
def __init__(self, main_window, tenant_id, env): super().__init__() self.main_window = main_window self.env = env self.tenant_id = tenant_id self.validation_results = {'passed': [], 'failed': []} self.application_id_list = [] # 设置窗口无边框 self.setWindowFlags(QtCore.Qt.FramelessWindowHint) # 设置窗口背景透明 self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # 设置窗口图标 self.setWindowIcon(self.main_window.icon) # 设置窗口大小 self.window_min_width = 300 self.window_max_width = 300 self.window_min_height = 320 self.window_max_height = 550 self.setMinimumSize(self.window_min_width, self.window_min_height) self.setMaximumSize(self.window_max_width, self.window_max_height) # 设置窗口子部件 self.set_head_widget() self.set_body_widget() # 窗口组装 self.layout_main = QtWidgets.QVBoxLayout(self) self.layout_main.addWidget(self.widget_head) self.layout_main.addWidget(self.widget_body) self.layout_main.setSpacing(0) self.layout_main.setContentsMargins(0, 0, 0, 0) self.setLayout(self.layout_main) # 设置样式 QSSSetter.set_qss(self, __file__)
def __init__(self, session_id, token, service, login_window, username, role): super().__init__() self.session_id = session_id self.token = token self.login_window = login_window self.children_windows = dict() self.children_windows['config'] = None self.children_windows['create_user'] = None self.children_windows['manage_user'] = None self.children_windows['manage_env'] = None self.children_windows['del_app'] = None self.children_windows['anal_app'] = None self.children_windows['tenant_detail'] = None self.tenants = dict() self.enviroments = list() self.username = username self.role = role # 连接服务 self.kos = service # 公用标记 self.tab = 'tenants' self.combobox_env_initiated = False # 设置窗口大小 self.window_min_width = 384 self.window_max_width = 384 self.window_min_height = 760 self.window_max_height = 960 self.setMinimumSize(self.window_min_width, self.window_min_height) self.setMaximumSize(self.window_max_width, self.window_max_height) # 设置窗口透明度 #self.setWindowOpacity(0.8) # 设置窗口无边框 self.setWindowFlags(QtCore.Qt.FramelessWindowHint) # 设置窗口背景透明 self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # 设置窗口图标 self.icon = QtGui.QIcon() self.icon.addPixmap(QtGui.QPixmap("images/window_icon.jpg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.setWindowIcon(self.icon) # 设置窗口子部件 self.set_window_buttons_widget() self.set_head_widget() self.set_body_widget() self.set_bottom_widget() # 窗口组装 self.layout_main = QtWidgets.QVBoxLayout() self.layout_main.addWidget(self.widget_window_buttons) self.layout_main.addWidget(self.widget_head) self.layout_main.addWidget(self.widget_body) self.layout_main.addWidget(self.widget_bottom) self.layout_main.setSpacing(0) self.layout_main.setContentsMargins(0, 0, 0, 0) self.setLayout(self.layout_main) # 设置样式 QSSSetter.set_qss(self, __file__)
def __init__(self, parent): super().__init__() self.parent = parent self.children_windows = dict() self.children_windows['activity'] = None self.status_brush = { 0: { 'name': '未开始', 'brush': QtGui.QBrush(QtGui.QColor(221, 221, 221)) }, 1: { 'name': '运行中', 'brush': QtGui.QBrush(QtGui.QColor(255, 229, 153)) }, 2: { 'name': '已结束', 'brush': QtGui.QBrush(QtGui.QColor(147, 196, 125)) }, 3: { 'name': '已拒绝', 'brush': QtGui.QBrush(QtGui.QColor(255, 102, 51)) }, 4: { 'name': '出错', 'brush': QtGui.QBrush(QtGui.QColor(255, 0, 0)) }, 5: { 'name': '已撤回', 'brush': QtGui.QBrush(QtGui.QColor(102, 102, 102)) }, 51: { 'name': '撤回中', 'brush': QtGui.QBrush(QtGui.QColor(102, 102, 102)) }, 6: { 'name': '已取消', 'brush': QtGui.QBrush(QtGui.QColor(142, 124, 195)) }, 61: { 'name': '取消中', 'brush': QtGui.QBrush(QtGui.QColor(142, 124, 195)) }, 999: { 'name': '终止', 'brush': QtGui.QBrush(QtGui.QColor(111, 168, 220)) } } # 设置窗口无边框 self.setWindowFlags(QtCore.Qt.FramelessWindowHint) # 设置窗口背景透明 self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # 设置窗口图标 self.setWindowIcon(self.parent.main_window.icon) # 设置窗口大小 self.window_min_width = 650 self.window_max_width = 650 self.window_min_height = 734 self.window_max_height = 900 self.setMinimumSize(self.window_min_width, self.window_min_height) self.setMaximumSize(self.window_max_width, self.window_max_height) # 设置窗口子部件 self.set_head_widget() self.set_body_widget() # 窗口组装 self.layout_main = QtWidgets.QVBoxLayout(self) self.layout_main.addWidget(self.widget_head) self.layout_main.addWidget(self.widget_body) self.layout_main.setSpacing(0) self.layout_main.setContentsMargins(0, 0, 0, 0) self.setLayout(self.layout_main) parent_pos = self.parent.pos() self.setGeometry(parent_pos.x() - self.window_min_width, parent_pos.y(), self.window_min_width, self.window_min_height) # 设置样式 QSSSetter.set_qss(self, __file__)