def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.setupUi(self)
self.setWindowFlags(Qt.Window)
self.move(QDesktopWidget().availableGeometry().center() - self.frameGeometry().center())
self.label_version.setText(__version__)
self.yandex_button.clicked.connect(self.yandex_dialog)
self.google_button.clicked.connect(self.google_dialog)
self.dropbox_button.clicked.connect(self.dropbox_dialog)
self.question_button.clicked.connect(self.about)
self.license_button.clicked.connect(self.openUrl)
python类QDesktopWidget()的实例源码
def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.setupUi(self)
self.setWindowFlags(Qt.Window)
self.move(QDesktopWidget().availableGeometry().center() - self.frameGeometry().center())
def init_display(self, backend_str=None, size=(1024, 768)):
from OCC.Display.backend import load_backend, get_qt_modules
used_backend = load_backend(backend_str)
global display, start_display, app, _, USED_BACKEND
if 'qt' in used_backend:
from OCC.Display.qtDisplay import qtViewer3d
QtCore, QtGui, QtWidgets, QtOpenGL = get_qt_modules()
from OCC.Display.qtDisplay import qtViewer3d
self.ui.modelTab = qtViewer3d(self)
self.setWindowTitle("Osdag Cleat Angle")
self.ui.mytabWidget.resize(size[0], size[1])
self.ui.mytabWidget.addTab(self.ui.modelTab, "")
self.ui.modelTab.InitDriver()
display = self.ui.modelTab._display
# background gradient
display.set_bg_gradient_color(23, 1, 32, 23, 1, 32)
display.display_trihedron()
display.View.SetProj(1, 1, 1)
def center_on_screen(self):
'''Centers the window on the screen.'''
resolution = QDesktopWidget().screenGeometry()
self.move((resolution.width() / 2) - (self.frameSize().width() / 2),
(resolution.height() / 2) - (self.frameSize().height() / 2))
def start_display():
self.ui.modelTab.raise_()
return display, start_display
def center(self):
"""Place the window in the center of the screen."""
qr = self.frameGeometry()
cp = QDesktopWidget().availableGeometry().center()
qr.moveCenter(cp)
self.move(qr.topLeft())
def center(self):
screen = QtWidgets.QDesktopWidget().screenGeometry()
size = self.geometry()
self.move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2)
def __init__(self):
super().__init__()
self.setWindowTitle(self.tr("Kaptan Desktop"))
self.setWindowIcon(QIcon.fromTheme("kaptan"))
self.setMinimumSize(850, 600)
self.setMaximumSize(950, 720)
#x = (QDesktopWidget().screen().width() - self.width())/2
#y = (QDesktopWidget().screen().height() - self.height())/2
#self.move(x, y)
self.setPixmap(QWizard.LogoPixmap, QPixmap(":/data/images/logo.svg"))
self.setWizardStyle(QWizard.ModernStyle)
#self.setButtonText(QWizard.NextButton, self.tr("Next"))
#self.button(QWizard.NextButton).setIcon(QIcon.fromTheme("arrow-right"))
#self.button(QWizard.NextButton).setLayoutDirection(Qt.RightToLeft)
self.setButtonText(QWizard.CancelButton, self.tr("Cancel"))
self.button(QWizard.CancelButton).setIcon(QIcon.fromTheme("dialog-cancel"))
self.setOption(QWizard.NoCancelButtonOnLastPage, True)
self.setOption(QWizard.CancelButtonOnLeft, False)
#self.setOption(QWizard.HaveHelpButton, True)
self.setButtonText(QWizard.BackButton, self.tr("Back"))
self.setOption(QWizard.NoBackButtonOnLastPage, True)
self.setOption(QWizard.NoBackButtonOnStartPage, True)
self.button(QWizard.BackButton).setIcon(QIcon.fromTheme("arrow-left"))
self.setButtonText(QWizard.FinishButton, self.tr("Finish"))
self.button(QWizard.FinishButton).setIcon(QIcon.fromTheme("dialog-ok-apply"))
self.addPage(WelcomeWidget(self))
self.addPage(MouseWidget(self))
self.addPage(ThemeWidget(self))
self.addPage(MenuWidget(self))
self.addPage(WallpaperWidget(self))
self.addPage(AvatarWidget(self))
#self.addPage(PMWidget()) FIXME
self.sumId = self.addPage(SummaryWidget(self))
self.otherId = self.addPage(OtherWidget(self))
self.currentIdChanged.connect(self.optionsAccepted)
self.button(QWizard.FinishButton).clicked.connect(self.close)
def openAllGraph(self):
self.plot_file_list = self.parent.plot_file[self.root_name]
self.graphviewer = QtWidgets.QFrame()
self.screen = QtWidgets.QDesktopWidget().screenGeometry()
# Set geometry
self.graphviewer.setGeometry(self.screen.width()/4, 100, 800, 600)
self.graphviewer.setWindowFlags(QtCore.Qt.Popup)
self.graphviewer.setObjectName("graphView")
self.graphviewer.setStyleSheet("QFrame#graphView{background:#ffffff;border:0.5px solid #fa7064;} QPushButton:hover{background:#6e66cc;border:1px solid #373366;} QToolButton:hover{background:#fa7064;}")
# self.graphviewer.setWindowModality(QtCore.Qt.WindowModal)
# Layout
graph_layout = QtWidgets.QVBoxLayout()
# Title
graph_title = SubTitleBar(self.graphviewer)
graph_title.title_Label.setText(self.root_name)
# Separator line
hline = QtWidgets.QWidget()
hline.setStyleSheet("QWidget{min-height:2px; max-height:2px; background:#399ee5;}")
# ComboBox
graph_control = QtWidgets.QWidget()
graph_control_layout = QtWidgets.QHBoxLayout()
self.graph_control_comboBox = QtWidgets.QComboBox()
self.graph_control_comboBox.setStyleSheet("QComboBox{font-family:'Segoe UI';font-size: 10pt;border: 1px solid #c5d2d9; border-radius:5px;padding: 5px 10px 5px 10px; color: #66767c;min-width: 250px;} QComboBox:hover{border: 2px solid #2a4d69;border-radius: 5px;height: 30ps;} QComboBox::drop-down {subcontrol-origin: padding; subcontrol-position: top right;width: 40px;border-left-width: 2px;border-left-color: #c5d2d9;border-left-style: solid; border-top-right-radius: 5px; border-bottom-right-radius: 5px;padding: 1px 1px 1px 1px;image: url(:/resources/dropdown_arrow.png);} QComboBox QAbstractItemView {border: 1px solid #c5d2d9; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px;selection-background-color:#4b86b4;outline: solid #2a4d69;font-family: 'Segoe UI';font-size: 10pt;color: #66767c;}")
graph_control_layout.insertStretch(0, 4)
graph_control_layout.addWidget(self.graph_control_comboBox)
graph_control_layout.insertStretch(3, 4)
graph_control.setLayout(graph_control_layout)
# Main Content
self.graph_content = QtWidgets.QStackedWidget()
# Add stack
for i in range(1, len(self.plot_file_list)):
currentName = self.plot_file_list[i].rsplit("/", 1)[1].rsplit(".", 1)[0]
self.graph_control_comboBox.addItem(currentName)
graph_label = QtWidgets.QLabel()
currentGraph = QtGui.QPixmap(self.plot_file_list[i])
graph_label.setPixmap(currentGraph)
graph_label.setAlignment(QtCore.Qt.AlignCenter)
self.graph_content.addWidget(graph_label)
# Add layout
graph_layout.addWidget(graph_title, 1)
graph_layout.addWidget(hline, 1)
graph_layout.addWidget(graph_control, 1)
graph_layout.addWidget(self.graph_content, 8)
graph_layout.setContentsMargins(5, 10, 5, 10)
graph_layout.setAlignment(QtCore.Qt.AlignTop)
self.graphviewer.setLayout(graph_layout)
self.graph_control_comboBox.currentIndexChanged.connect(self.changeGraph)
self.graphviewer.show()
def __init__(self):
super().__init__()
self.setWindowTitle(self.tr("Kaptan Desktop"))
self.setWindowIcon(QIcon.fromTheme("kaptan-icon"))
self.setMinimumSize(850, 600)
self.setMaximumSize(950, 620)
x = (QDesktopWidget().screen().width() - self.width())/2
y = (QDesktopWidget().screen().height() - self.height())/2
self.move(x, y)
self.setPixmap(QWizard.LogoPixmap, QPixmap(":/data/images/kaptan.png"))
self.setButtonText(QWizard.NextButton, self.tr("Next"))
self.button(QWizard.NextButton).setIcon(QIcon.fromTheme("arrow-right"))
self.button(QWizard.NextButton).setLayoutDirection(Qt.RightToLeft)
self.setButtonText(QWizard.CancelButton, self.tr("Cancel"))
self.button(QWizard.CancelButton).setIcon(QIcon.fromTheme("dialog-cancel"))
self.setOption(QWizard.NoCancelButtonOnLastPage, True)
self.setOption(QWizard.CancelButtonOnLeft, True)
self.setButtonText(QWizard.BackButton, self.tr("Back"))
self.setOption(QWizard.NoBackButtonOnLastPage, True)
self.setOption(QWizard.NoBackButtonOnStartPage, True)
self.button(QWizard.BackButton).setIcon(QIcon.fromTheme("arrow-left"))
self.setButtonText(QWizard.FinishButton, self.tr("Finish"))
self.button(QWizard.FinishButton).setIcon(QIcon.fromTheme("dialog-ok-apply"))
self.addPage(WelcomeWidget(self))
self.addPage(MouseWidget(self))
self.addPage(ThemeWidget(self))
self.addPage(MenuWidget(self))
self.addPage(WallpaperWidget(self))
self.addPage(AvatarWidget(self))
#self.addPage(PMWidget()) FIXME
self.sumId = self.addPage(SummaryWidget(self))
self.otherId = self.addPage(OtherWidget(self))
self.currentIdChanged.connect(self.optionsAccepted)
self.button(QWizard.FinishButton).clicked.connect(self.close)