mirror of
https://github.com/WMK965/965-Python-Learning-Repo.git
synced 2025-04-27 14:03:22 +00:00
更新示例代码
This commit is contained in:
parent
18ad86d3fa
commit
7b596ca018
@ -20,12 +20,11 @@ class mainthread:
|
||||
self.mainWindow = uic.loadUi('main.ui')
|
||||
self.mainWindow.FileChooseButton.clicked.connect(self.Choose_File)
|
||||
self.mainWindow.MaskChooseButton.clicked.connect(self.Choose_Mask)
|
||||
self.mainWindow.FontSelectionBox.addItems(['Adobe 黑体 Std R', '华文行楷 R', '楷体 R', '微软雅黑 R', '幼圆 R'])
|
||||
self.mainWindow.FontSelectionBox.currentIndexChanged.connect(self.selectionChange)
|
||||
self.mainWindow.FontSelectBox.addItems(['Adobe 黑体 Std R', '华文行楷 R', '楷体 R', '微软雅黑 R', '宋体 R', '幼圆 R'])
|
||||
self.mainWindow.FontSelectBox.currentIndexChanged.connect(self.selectionChange)
|
||||
self.mainWindow.FontSizeSelectBox.valueChanged.connect(self.valueChange1)
|
||||
self.mainWindow.MaxWordCountBox.valueChanged.connect(self.valueChange2)
|
||||
self.mainWindow.GenerateButton.toggle()
|
||||
self.mainWindow.GenerateButton.clicked.connect(self.Generate_Action())
|
||||
self.mainWindow.GenerateButton.clicked.connect(lambda: self.Generate_Action())
|
||||
|
||||
# 文本选择
|
||||
def Choose_File(self):
|
||||
@ -61,15 +60,21 @@ class mainthread:
|
||||
def selectionChange(i):
|
||||
WcModule.font = fontlist[i]
|
||||
|
||||
@staticmethod
|
||||
def Generate_Action():
|
||||
def Generate_Action(self):
|
||||
print(WcModule.size, WcModule.maxword, WcModule.font, WcModule.file, WcModule.mask)
|
||||
cursor = self.mainWindow.LogBrowser.textCursor()
|
||||
cursor.movePosition(QtGui.QTextCursor.End)
|
||||
cursor.insertText(f"[Sys]:Parameters:{WcModule.size, WcModule.maxword, WcModule.font, WcModule.file, WcModule.mask}\n")
|
||||
cursor.insertText(f"[Sys]:Generating.....\n")
|
||||
self.mainWindow.LogBrowser.setTextCursor(cursor)
|
||||
self.mainWindow.LogBrowser.ensureCursorVisible()
|
||||
WcModule.generate(WcModule.size, WcModule.maxword, WcModule.font, WcModule.file, WcModule.mask)
|
||||
|
||||
|
||||
fontlist = ("AdobeHeitiStd-Regular.otf", "STXINGKA.TTF", "simkai.ttf", "msyh.ttc", "simsun.ttc", "SIMYOU.TTF")
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = QApplication(sys.argv)
|
||||
# 显示UI
|
||||
m_main = mainthread()
|
||||
m_main.mainWindow.show()
|
||||
app.exec_()
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>501</width>
|
||||
<height>501</height>
|
||||
<height>382</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
@ -25,7 +25,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>380</x>
|
||||
<y>460</y>
|
||||
<y>340</y>
|
||||
<width>101</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
@ -43,43 +43,11 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextBrowser" name="SizePreview">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>110</y>
|
||||
<width>461</width>
|
||||
<height>91</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>90</y>
|
||||
<width>81</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Adobe 黑体 Std R</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>文字预览</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::NoTextInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="MaskChooseButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>400</x>
|
||||
<y>300</y>
|
||||
<y>180</y>
|
||||
<width>81</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
@ -92,7 +60,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>300</y>
|
||||
<y>180</y>
|
||||
<width>371</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
@ -102,7 +70,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>280</y>
|
||||
<y>160</y>
|
||||
<width>81</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
@ -124,7 +92,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>370</y>
|
||||
<y>250</y>
|
||||
<width>461</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
@ -134,7 +102,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>350</y>
|
||||
<y>230</y>
|
||||
<width>81</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
@ -156,7 +124,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>230</y>
|
||||
<y>110</y>
|
||||
<width>371</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
@ -166,7 +134,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>400</x>
|
||||
<y>230</y>
|
||||
<y>110</y>
|
||||
<width>81</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
@ -179,7 +147,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>210</y>
|
||||
<y>90</y>
|
||||
<width>81</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
@ -238,25 +206,6 @@
|
||||
<set>Qt::NoTextInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="FontSelectionBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>40</y>
|
||||
<width>181</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>ArrowCursor</cursorShape>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="acceptDrops">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
@ -324,7 +273,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>460</y>
|
||||
<y>340</y>
|
||||
<width>93</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
@ -333,6 +282,16 @@
|
||||
<string>Generate</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="FontSelectBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>140</x>
|
||||
<y>40</y>
|
||||
<width>221</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>MaskChooseButton</tabstop>
|
||||
@ -342,8 +301,6 @@
|
||||
<tabstop>FileChooseButton</tabstop>
|
||||
<tabstop>FontSizeSelectBox</tabstop>
|
||||
<tabstop>MaxWordCountBox</tabstop>
|
||||
<tabstop>FontSelectionBox</tabstop>
|
||||
<tabstop>SizePreview</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
|
Loading…
Reference in New Issue
Block a user