hkuadmin continue

This commit is contained in:
fasiondog 2021-04-21 01:12:44 +08:00
parent 64b9423568
commit d402402ecd
6 changed files with 1264 additions and 564 deletions

View File

@ -25,11 +25,11 @@
import logging import logging
import sys import sys
import resource # 使 IDE import,
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
import qdarkstyle import qdarkstyle
from UiConfig import UiConfig from UiConfig import UiConfig
from admin.HkuSessionViewWidget import HkuSessionViewWidget
translate = QtCore.QCoreApplication.translate translate = QtCore.QCoreApplication.translate
@ -88,6 +88,7 @@ class MyMainWindow(QtWidgets.QMainWindow):
self.initMainTabWidget() self.initMainTabWidget()
self.initDockWidgets() self.initDockWidgets()
self.statusBar().showMessage(translate('MainWindow', 'Running')) self.statusBar().showMessage(translate('MainWindow', 'Running'))
QtCore.QMetaObject.connectSlotsByName(self)
def closeEvent(self, event): def closeEvent(self, event):
self.ui_config.save(self) self.ui_config.save(self)
@ -95,13 +96,17 @@ class MyMainWindow(QtWidgets.QMainWindow):
def initAction(self): def initAction(self):
self.action_dict = dict( self.action_dict = dict(
action_quit=QtWidgets.QAction(translate('MainWindow', '&Quit'), self), action_file_session=QtWidgets.QAction(
QtGui.QIcon(":/icon/server.png"), translate("MainWindow", "&Session"), self
),
action_file_quit=QtWidgets.QAction(QtGui.QIcon(":/icon/quit.png"), translate('MainWindow', '&Quit'), self),
action_view_normal_style=QtWidgets.QAction(translate('MainWindow', 'Normal style'), self), action_view_normal_style=QtWidgets.QAction(translate('MainWindow', 'Normal style'), self),
action_view_dark_style=QtWidgets.QAction(translate('MainWindow', 'Dark style'), self), action_view_dark_style=QtWidgets.QAction(translate('MainWindow', 'Dark style'), self),
action_about=QtWidgets.QAction(translate('MainWindow', 'About'), self), action_about=QtWidgets.QAction(translate('MainWindow', 'About'), self),
action_about_qt=QtWidgets.QAction(translate('MainWindow', 'About Qt'), self), action_about_qt=QtWidgets.QAction(translate('MainWindow', 'About Qt'), self),
) )
self.action_dict['action_quit'].setStatusTip(translate('MainWindow', 'Quit Application')) self.action_dict['action_file_session'].setStatusTip(translate('MainWindow', 'Session Manager'))
self.action_dict['action_file_quit'].setStatusTip(translate('MainWindow', 'Quit Application'))
self.action_dict['action_about_qt'].setStatusTip(translate('MainWindow', "Show the Qt library's About box")) self.action_dict['action_about_qt'].setStatusTip(translate('MainWindow', "Show the Qt library's About box"))
self.action_dict['action_view_normal_style'].setObjectName('normal_style') self.action_dict['action_view_normal_style'].setObjectName('normal_style')
self.action_dict['action_view_normal_style'].setStatusTip(translate('MainWindow', 'Switch to normal style')) self.action_dict['action_view_normal_style'].setStatusTip(translate('MainWindow', 'Switch to normal style'))
@ -118,7 +123,8 @@ class MyMainWindow(QtWidgets.QMainWindow):
def initMenu(self): def initMenu(self):
style_menu = self.menubar_dict['menu_view'].addMenu(translate('MainWindow', 'Skin style')) style_menu = self.menubar_dict['menu_view'].addMenu(translate('MainWindow', 'Skin style'))
self.menu_dict = dict( self.menu_dict = dict(
menu_quit=self.menubar_dict['menu_file'].addAction(self.action_dict['action_quit']), menu_file_session=self.menubar_dict['menu_file'].addAction(self.action_dict['action_file_session']),
menu_file_quit=self.menubar_dict['menu_file'].addAction(self.action_dict['action_file_quit']),
menu_view_normal_style=style_menu.addAction(self.action_dict['action_view_normal_style']), menu_view_normal_style=style_menu.addAction(self.action_dict['action_view_normal_style']),
menu_view_dark_style=style_menu.addAction(self.action_dict['action_view_dark_style']), menu_view_dark_style=style_menu.addAction(self.action_dict['action_view_dark_style']),
menu_about=self.menubar_dict['menu_help'].addAction(self.action_dict['action_about']), menu_about=self.menubar_dict['menu_help'].addAction(self.action_dict['action_about']),
@ -126,11 +132,12 @@ class MyMainWindow(QtWidgets.QMainWindow):
) )
def initToolBar(self): def initToolBar(self):
if sys.platform == 'darwin': self.setUnifiedTitleAndToolBarOnMac(True)
self.setUnifiedTitleAndToolBarOnMac(true) file_toolbar = self.addToolBar('File')
file_toolbar.addAction(self.action_dict['action_file_quit'])
def initActionConnect(self): def initActionConnect(self):
self.action_dict['action_quit'].triggered.connect(self.close) self.action_dict['action_file_quit'].triggered.connect(self.close)
self.action_dict['action_about'].triggered.connect(self.about) self.action_dict['action_about'].triggered.connect(self.about)
self.action_dict['action_about_qt'].triggered.connect(QtWidgets.QApplication.aboutQt) self.action_dict['action_about_qt'].triggered.connect(QtWidgets.QApplication.aboutQt)
self.action_dict['action_view_normal_style'].triggered.connect(self.changStyle) self.action_dict['action_view_normal_style'].triggered.connect(self.changStyle)
@ -141,7 +148,7 @@ class MyMainWindow(QtWidgets.QMainWindow):
self.setCentralWidget(self.main_tab) self.setCentralWidget(self.main_tab)
def initDockWidgets(self): def initDockWidgets(self):
self.server_view_dock = QtWidgets.QDockWidget('Server View', self) self.server_view_dock = HkuSessionViewWidget(self)
self.server_view_dock.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable) # self.server_view_dock.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable) #
self.server_view_dock.setMinimumWidth(200) self.server_view_dock.setMinimumWidth(200)
title_bar = self.server_view_dock.titleBarWidget() title_bar = self.server_view_dock.titleBarWidget()
@ -149,7 +156,6 @@ class MyMainWindow(QtWidgets.QMainWindow):
del title_bar del title_bar
self.addDockWidget(QtCore.Qt.LeftDockWidgetArea, self.server_view_dock) self.addDockWidget(QtCore.Qt.LeftDockWidgetArea, self.server_view_dock)
def about(self): def about(self):
msg = translate( msg = translate(
'MainWindow', "<p><b>Hikyuu Strategy Server Manager</b><p>" 'MainWindow', "<p><b>Hikyuu Strategy Server Manager</b><p>"

View File

@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
from PyQt5 import QtWidgets, QtCore, QtGui
import resource
class HkuSessionViewWidget(QtWidgets.QDockWidget):
def __init__(self, parent=None):
super(HkuSessionViewWidget, self).__init__(parent)
self.setObjectName("HKUServerViewWidget")
self.tree = QtWidgets.QTreeWidget(self)
self.setWidget(self.tree)
self.tree.header().setVisible(False)
item_0 = QtWidgets.QTreeWidgetItem(self.tree)
item_0.setIcon(0, QtGui.QIcon(':/icon/server.png'))
item_1 = QtWidgets.QTreeWidgetItem(item_0)
item_0 = QtWidgets.QTreeWidgetItem(self.tree)
self.retranslateUi()
QtCore.QMetaObject.connectSlotsByName(self)
def addSession(self):
pass
def retranslateUi(self):
_translate = QtCore.QCoreApplication.translate
self.tree.headerItem().setText(0, _translate("Form", "name"))
__sortingEnabled = self.tree.isSortingEnabled()
self.tree.setSortingEnabled(False)
self.tree.topLevelItem(0).setText(0, _translate("Form", "local"))
self.tree.topLevelItem(0).child(0).setText(0, _translate("Form", "account"))
self.tree.topLevelItem(1).setText(0, _translate("Form", "other"))
self.tree.setSortingEnabled(__sortingEnabled)

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -6,5 +6,7 @@
<file>logo/logo_64.png</file> <file>logo/logo_64.png</file>
<file>logo/logo_128.png</file> <file>logo/logo_128.png</file>
<file>logo/logo_256.png</file> <file>logo/logo_256.png</file>
<file>icon/quit.png</file>
<file>icon/server.png</file>
</qresource> </qresource>
</RCC> </RCC>