Browse Source

功能更改

rambo 4 weeks ago
parent
commit
bca96b2235
14 changed files with 873 additions and 218 deletions
  1. 2 1
      .gitignore
  2. 84 29
      UI/login.py
  3. 137 98
      UI/login.ui
  4. 441 0
      UI/new1.qss
  5. 1 1
      config.ini
  6. 1 1
      custom_config.ini
  7. 20 0
      log/logging_text.log
  8. 19 25
      main.py
  9. 33 0
      module/MineMainWindow.py
  10. 51 0
      module/MineQWidget.py
  11. 5 4
      module/module_login.py
  12. 5 5
      module/module_move_files.py
  13. 63 41
      module/module_rename_pic.py
  14. 11 13
      module/module_resize_pic.py

+ 2 - 1
.gitignore

@@ -6,4 +6,5 @@ temp
 venv/
 venv/
 .venv/
 .venv/
 .vscode/
 .vscode/
-.idea/
+.idea/
+log/*

+ 84 - 29
UI/login.py

@@ -3,7 +3,7 @@
 ################################################################################
 ################################################################################
 ## Form generated from reading UI file 'login.ui'
 ## Form generated from reading UI file 'login.ui'
 ##
 ##
-## Created by: Qt User Interface Compiler version 6.7.2
+## Created by: Qt User Interface Compiler version 6.8.1
 ##
 ##
 ## WARNING! All changes made in this file will be lost when recompiling UI file!
 ## WARNING! All changes made in this file will be lost when recompiling UI file!
 ################################################################################
 ################################################################################
@@ -15,8 +15,8 @@ from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
     QFont, QFontDatabase, QGradient, QIcon,
     QFont, QFontDatabase, QGradient, QIcon,
     QImage, QKeySequence, QLinearGradient, QPainter,
     QImage, QKeySequence, QLinearGradient, QPainter,
     QPalette, QPixmap, QRadialGradient, QTransform)
     QPalette, QPixmap, QRadialGradient, QTransform)
-from PySide6.QtWidgets import (QApplication, QLabel, QLineEdit, QPushButton,
-    QRadioButton, QSizePolicy, QWidget)
+from PySide6.QtWidgets import (QApplication, QHBoxLayout, QLabel, QLineEdit,
+    QPushButton, QRadioButton, QSizePolicy, QWidget)
 
 
 class Ui_Form(object):
 class Ui_Form(object):
     def setupUi(self, Form):
     def setupUi(self, Form):
@@ -24,43 +24,98 @@ class Ui_Form(object):
             Form.setObjectName(u"Form")
             Form.setObjectName(u"Form")
         Form.resize(406, 287)
         Form.resize(406, 287)
         Form.setStyleSheet(u"background-color: rgb(255, 255, 255);")
         Form.setStyleSheet(u"background-color: rgb(255, 255, 255);")
-        self.pushButton = QPushButton(Form)
+        self.label_4 = QLabel(Form)
+        self.label_4.setObjectName(u"label_4")
+        self.label_4.setGeometry(QRect(0, 260, 401, 21))
+        self.horizontalLayoutWidget = QWidget(Form)
+        self.horizontalLayoutWidget.setObjectName(u"horizontalLayoutWidget")
+        self.horizontalLayoutWidget.setGeometry(QRect(30, 210, 341, 41))
+        self.horizontalLayout = QHBoxLayout(self.horizontalLayoutWidget)
+        self.horizontalLayout.setSpacing(0)
+        self.horizontalLayout.setObjectName(u"horizontalLayout")
+        self.horizontalLayout.setContentsMargins(40, 0, 40, 0)
+        self.pushButton = QPushButton(self.horizontalLayoutWidget)
         self.pushButton.setObjectName(u"pushButton")
         self.pushButton.setObjectName(u"pushButton")
-        self.pushButton.setGeometry(QRect(100, 180, 271, 41))
+        sizePolicy = QSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Preferred)
+        sizePolicy.setHorizontalStretch(0)
+        sizePolicy.setVerticalStretch(0)
+        sizePolicy.setHeightForWidth(self.pushButton.sizePolicy().hasHeightForWidth())
+        self.pushButton.setSizePolicy(sizePolicy)
         self.pushButton.setStyleSheet(u"background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 137, 27, 255), stop:1 rgba(255, 93, 1, 255));\n"
         self.pushButton.setStyleSheet(u"background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 137, 27, 255), stop:1 rgba(255, 93, 1, 255));\n"
 "color: rgb(255, 255, 255);\n"
 "color: rgb(255, 255, 255);\n"
 "border-radius: 5px;  border: 2px groove gray;\n"
 "border-radius: 5px;  border: 2px groove gray;\n"
 "border:0px;\n"
 "border:0px;\n"
 "font: 75 14pt \"Adobe Arabic\";")
 "font: 75 14pt \"Adobe Arabic\";")
-        self.lineEdit = QLineEdit(Form)
-        self.lineEdit.setObjectName(u"lineEdit")
-        self.lineEdit.setGeometry(QRect(100, 50, 271, 41))
-        self.label_2 = QLabel(Form)
+
+        self.horizontalLayout.addWidget(self.pushButton)
+
+        self.horizontalLayoutWidget_2 = QWidget(Form)
+        self.horizontalLayoutWidget_2.setObjectName(u"horizontalLayoutWidget_2")
+        self.horizontalLayoutWidget_2.setGeometry(QRect(30, 150, 341, 31))
+        self.horizontalLayout_2 = QHBoxLayout(self.horizontalLayoutWidget_2)
+        self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
+        self.horizontalLayout_2.setContentsMargins(40, 0, 40, 0)
+        self.radioButton = QRadioButton(self.horizontalLayoutWidget_2)
+        self.radioButton.setObjectName(u"radioButton")
+        self.radioButton.setChecked(True)
+
+        self.horizontalLayout_2.addWidget(self.radioButton)
+
+        self.radioButton_2 = QRadioButton(self.horizontalLayoutWidget_2)
+        self.radioButton_2.setObjectName(u"radioButton_2")
+
+        self.horizontalLayout_2.addWidget(self.radioButton_2)
+
+        self.horizontalLayoutWidget_3 = QWidget(Form)
+        self.horizontalLayoutWidget_3.setObjectName(u"horizontalLayoutWidget_3")
+        self.horizontalLayoutWidget_3.setGeometry(QRect(30, 30, 341, 31))
+        self.horizontalLayout_3 = QHBoxLayout(self.horizontalLayoutWidget_3)
+        self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
+        self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0)
+        self.label_2 = QLabel(self.horizontalLayoutWidget_3)
         self.label_2.setObjectName(u"label_2")
         self.label_2.setObjectName(u"label_2")
-        self.label_2.setGeometry(QRect(20, 50, 71, 41))
-        self.label_3 = QLabel(Form)
+
+        self.horizontalLayout_3.addWidget(self.label_2)
+
+        self.lineEdit = QLineEdit(self.horizontalLayoutWidget_3)
+        self.lineEdit.setObjectName(u"lineEdit")
+        sizePolicy1 = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred)
+        sizePolicy1.setHorizontalStretch(0)
+        sizePolicy1.setVerticalStretch(0)
+        sizePolicy1.setHeightForWidth(self.lineEdit.sizePolicy().hasHeightForWidth())
+        self.lineEdit.setSizePolicy(sizePolicy1)
+
+        self.horizontalLayout_3.addWidget(self.lineEdit)
+
+        self.horizontalLayoutWidget_4 = QWidget(Form)
+        self.horizontalLayoutWidget_4.setObjectName(u"horizontalLayoutWidget_4")
+        self.horizontalLayoutWidget_4.setGeometry(QRect(30, 90, 341, 31))
+        self.horizontalLayout_4 = QHBoxLayout(self.horizontalLayoutWidget_4)
+        self.horizontalLayout_4.setObjectName(u"horizontalLayout_4")
+        self.horizontalLayout_4.setContentsMargins(0, 0, 0, 0)
+        self.label_3 = QLabel(self.horizontalLayoutWidget_4)
         self.label_3.setObjectName(u"label_3")
         self.label_3.setObjectName(u"label_3")
-        self.label_3.setGeometry(QRect(20, 110, 71, 41))
-        self.lineEdit_2 = QLineEdit(Form)
+
+        self.horizontalLayout_4.addWidget(self.label_3)
+
+        self.lineEdit_2 = QLineEdit(self.horizontalLayoutWidget_4)
         self.lineEdit_2.setObjectName(u"lineEdit_2")
         self.lineEdit_2.setObjectName(u"lineEdit_2")
-        self.lineEdit_2.setGeometry(QRect(100, 110, 161, 41))
+        sizePolicy1.setHeightForWidth(self.lineEdit_2.sizePolicy().hasHeightForWidth())
+        self.lineEdit_2.setSizePolicy(sizePolicy1)
         self.lineEdit_2.setEchoMode(QLineEdit.Password)
         self.lineEdit_2.setEchoMode(QLineEdit.Password)
-        self.label_4 = QLabel(Form)
-        self.label_4.setObjectName(u"label_4")
-        self.label_4.setGeometry(QRect(0, 250, 401, 31))
-        self.radioButton = QRadioButton(Form)
-        self.radioButton.setObjectName(u"radioButton")
-        self.radioButton.setGeometry(QRect(100, 10, 101, 41))
-        self.radioButton.setChecked(True)
-        self.radioButton_2 = QRadioButton(Form)
-        self.radioButton_2.setObjectName(u"radioButton_2")
-        self.radioButton_2.setGeometry(QRect(200, 10, 101, 41))
-        self.pushButton_2 = QPushButton(Form)
+
+        self.horizontalLayout_4.addWidget(self.lineEdit_2)
+
+        self.pushButton_2 = QPushButton(self.horizontalLayoutWidget_4)
         self.pushButton_2.setObjectName(u"pushButton_2")
         self.pushButton_2.setObjectName(u"pushButton_2")
-        self.pushButton_2.setGeometry(QRect(260, 120, 111, 21))
+        sizePolicy.setHeightForWidth(self.pushButton_2.sizePolicy().hasHeightForWidth())
+        self.pushButton_2.setSizePolicy(sizePolicy)
         self.pushButton_2.setStyleSheet(u"border-radius: 5px;  border: 2px groove gray;\n"
         self.pushButton_2.setStyleSheet(u"border-radius: 5px;  border: 2px groove gray;\n"
 "border:0px;")
 "border:0px;")
 
 
+        self.horizontalLayout_4.addWidget(self.pushButton_2)
+
+
         self.retranslateUi(Form)
         self.retranslateUi(Form)
 
 
         QMetaObject.connectSlotsByName(Form)
         QMetaObject.connectSlotsByName(Form)
@@ -68,12 +123,12 @@ class Ui_Form(object):
 
 
     def retranslateUi(self, Form):
     def retranslateUi(self, Form):
         Form.setWindowTitle(QCoreApplication.translate("Form", u"Form", None))
         Form.setWindowTitle(QCoreApplication.translate("Form", u"Form", None))
-        self.pushButton.setText(QCoreApplication.translate("Form", u"\u767b\u5f55", None))
-        self.label_2.setText(QCoreApplication.translate("Form", u"\u624b\u673a\u53f7\uff1a", None))
-        self.label_3.setText(QCoreApplication.translate("Form", u"\u5bc6\u7801\uff1a", None))
         self.label_4.setText("")
         self.label_4.setText("")
+        self.pushButton.setText(QCoreApplication.translate("Form", u"\u767b\u5f55", None))
         self.radioButton.setText(QCoreApplication.translate("Form", u"\u77ed\u4fe1\u9a8c\u8bc1\u7801\u767b\u5f55", None))
         self.radioButton.setText(QCoreApplication.translate("Form", u"\u77ed\u4fe1\u9a8c\u8bc1\u7801\u767b\u5f55", None))
         self.radioButton_2.setText(QCoreApplication.translate("Form", u"\u8d26\u53f7\u5bc6\u7801\u767b\u5f55", None))
         self.radioButton_2.setText(QCoreApplication.translate("Form", u"\u8d26\u53f7\u5bc6\u7801\u767b\u5f55", None))
+        self.label_2.setText(QCoreApplication.translate("Form", u"\u624b\u673a\uff1a", None))
+        self.label_3.setText(QCoreApplication.translate("Form", u"\u5bc6\u7801\uff1a", None))
         self.pushButton_2.setText(QCoreApplication.translate("Form", u"\u83b7\u53d6\u9a8c\u8bc1\u7801", None))
         self.pushButton_2.setText(QCoreApplication.translate("Form", u"\u83b7\u53d6\u9a8c\u8bc1\u7801", None))
     # retranslateUi
     # retranslateUi
 
 

+ 137 - 98
UI/login.ui

@@ -16,133 +16,172 @@
   <property name="styleSheet">
   <property name="styleSheet">
    <string notr="true">background-color: rgb(255, 255, 255);</string>
    <string notr="true">background-color: rgb(255, 255, 255);</string>
   </property>
   </property>
-  <widget class="QPushButton" name="pushButton">
-   <property name="geometry">
-    <rect>
-     <x>100</x>
-     <y>180</y>
-     <width>271</width>
-     <height>41</height>
-    </rect>
-   </property>
-   <property name="styleSheet">
-    <string notr="true">background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 137, 27, 255), stop:1 rgba(255, 93, 1, 255));
-color: rgb(255, 255, 255);
-border-radius: 5px;  border: 2px groove gray;
-border:0px;
-font: 75 14pt &quot;Adobe Arabic&quot;;</string>
-   </property>
-   <property name="text">
-    <string>登录</string>
-   </property>
-  </widget>
-  <widget class="QLineEdit" name="lineEdit">
-   <property name="geometry">
-    <rect>
-     <x>100</x>
-     <y>50</y>
-     <width>271</width>
-     <height>41</height>
-    </rect>
-   </property>
-  </widget>
-  <widget class="QLabel" name="label_2">
-   <property name="geometry">
-    <rect>
-     <x>20</x>
-     <y>50</y>
-     <width>71</width>
-     <height>41</height>
-    </rect>
-   </property>
-   <property name="text">
-    <string>手机号:</string>
-   </property>
-  </widget>
-  <widget class="QLabel" name="label_3">
+  <widget class="QLabel" name="label_4">
    <property name="geometry">
    <property name="geometry">
     <rect>
     <rect>
-     <x>20</x>
-     <y>110</y>
-     <width>71</width>
-     <height>41</height>
+     <x>0</x>
+     <y>260</y>
+     <width>401</width>
+     <height>21</height>
     </rect>
     </rect>
    </property>
    </property>
    <property name="text">
    <property name="text">
-    <string>密码:</string>
+    <string/>
    </property>
    </property>
   </widget>
   </widget>
-  <widget class="QLineEdit" name="lineEdit_2">
+  <widget class="QWidget" name="horizontalLayoutWidget">
    <property name="geometry">
    <property name="geometry">
     <rect>
     <rect>
-     <x>100</x>
-     <y>110</y>
-     <width>161</width>
+     <x>30</x>
+     <y>210</y>
+     <width>341</width>
      <height>41</height>
      <height>41</height>
     </rect>
     </rect>
    </property>
    </property>
-   <property name="echoMode">
-    <enum>QLineEdit::Password</enum>
-   </property>
+   <layout class="QHBoxLayout" name="horizontalLayout">
+    <property name="spacing">
+     <number>0</number>
+    </property>
+    <property name="leftMargin">
+     <number>40</number>
+    </property>
+    <property name="rightMargin">
+     <number>40</number>
+    </property>
+    <item>
+     <widget class="QPushButton" name="pushButton">
+      <property name="sizePolicy">
+       <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+        <horstretch>0</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
+      <property name="styleSheet">
+       <string notr="true">background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 137, 27, 255), stop:1 rgba(255, 93, 1, 255));
+color: rgb(255, 255, 255);
+border-radius: 5px;  border: 2px groove gray;
+border:0px;
+font: 75 14pt &quot;Adobe Arabic&quot;;</string>
+      </property>
+      <property name="text">
+       <string>登录</string>
+      </property>
+     </widget>
+    </item>
+   </layout>
   </widget>
   </widget>
-  <widget class="QLabel" name="label_4">
+  <widget class="QWidget" name="horizontalLayoutWidget_2">
    <property name="geometry">
    <property name="geometry">
     <rect>
     <rect>
-     <x>0</x>
-     <y>250</y>
-     <width>401</width>
+     <x>30</x>
+     <y>150</y>
+     <width>341</width>
      <height>31</height>
      <height>31</height>
     </rect>
     </rect>
    </property>
    </property>
-   <property name="text">
-    <string/>
-   </property>
+   <layout class="QHBoxLayout" name="horizontalLayout_2">
+    <property name="leftMargin">
+     <number>40</number>
+    </property>
+    <property name="rightMargin">
+     <number>40</number>
+    </property>
+    <item>
+     <widget class="QRadioButton" name="radioButton">
+      <property name="text">
+       <string>短信验证码登录</string>
+      </property>
+      <property name="checked">
+       <bool>true</bool>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QRadioButton" name="radioButton_2">
+      <property name="text">
+       <string>账号密码登录</string>
+      </property>
+     </widget>
+    </item>
+   </layout>
   </widget>
   </widget>
-  <widget class="QRadioButton" name="radioButton">
+  <widget class="QWidget" name="horizontalLayoutWidget_3">
    <property name="geometry">
    <property name="geometry">
     <rect>
     <rect>
-     <x>100</x>
-     <y>10</y>
-     <width>101</width>
-     <height>41</height>
-    </rect>
-   </property>
-   <property name="text">
-    <string>短信验证码登录</string>
-   </property>
-   <property name="checked">
-    <bool>true</bool>
-   </property>
-  </widget>
-  <widget class="QRadioButton" name="radioButton_2">
-   <property name="geometry">
-    <rect>
-     <x>200</x>
-     <y>10</y>
-     <width>101</width>
-     <height>41</height>
+     <x>30</x>
+     <y>30</y>
+     <width>341</width>
+     <height>31</height>
     </rect>
     </rect>
    </property>
    </property>
-   <property name="text">
-    <string>账号密码登录</string>
-   </property>
+   <layout class="QHBoxLayout" name="horizontalLayout_3">
+    <item>
+     <widget class="QLabel" name="label_2">
+      <property name="text">
+       <string>手机:</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QLineEdit" name="lineEdit">
+      <property name="sizePolicy">
+       <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+        <horstretch>0</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
+     </widget>
+    </item>
+   </layout>
   </widget>
   </widget>
-  <widget class="QPushButton" name="pushButton_2">
+  <widget class="QWidget" name="horizontalLayoutWidget_4">
    <property name="geometry">
    <property name="geometry">
     <rect>
     <rect>
-     <x>260</x>
-     <y>120</y>
-     <width>111</width>
-     <height>21</height>
+     <x>30</x>
+     <y>90</y>
+     <width>341</width>
+     <height>31</height>
     </rect>
     </rect>
    </property>
    </property>
-   <property name="styleSheet">
-    <string notr="true">border-radius: 5px;  border: 2px groove gray;
+   <layout class="QHBoxLayout" name="horizontalLayout_4">
+    <item>
+     <widget class="QLabel" name="label_3">
+      <property name="text">
+       <string>密码:</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QLineEdit" name="lineEdit_2">
+      <property name="sizePolicy">
+       <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+        <horstretch>0</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
+      <property name="echoMode">
+       <enum>QLineEdit::Password</enum>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QPushButton" name="pushButton_2">
+      <property name="sizePolicy">
+       <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+        <horstretch>0</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
+      <property name="styleSheet">
+       <string notr="true">border-radius: 5px;  border: 2px groove gray;
 border:0px;</string>
 border:0px;</string>
-   </property>
-   <property name="text">
-    <string>获取验证码</string>
-   </property>
+      </property>
+      <property name="text">
+       <string>获取验证码</string>
+      </property>
+     </widget>
+    </item>
+   </layout>
   </widget>
   </widget>
  </widget>
  </widget>
  <resources/>
  <resources/>

+ 441 - 0
UI/new1.qss

@@ -0,0 +1,441 @@
+/* ================================================ *
+author:lei
+lastedited:2020.2
+* ================================================ */
+/*hover*/
+/*actived*/
+/*gradient start*/
+/*gradient end*/
+
+QWidget
+{
+    color: #ffffff;
+    background-color: #1d1d1d;
+}
+
+QFrame{
+    color: #ffffff;
+    background-color: #1d1d1d;/*不能设置为transparent*/
+}
+QMainWindow::separator{
+    border: 1px solid #999999;
+    border-style: outset;
+    width: 4px;
+    height: 4px;
+}
+QMainWindow::separator:hover{
+    background: #efca22;
+}
+QSplitter::handle{
+    border: 1px solid #999999;
+    border-style: outset;
+    width: 4px;
+    height: 4px;
+}
+QSplitter::handle:hover{/*splitter->handle(1)->setAttribute(Qt::WA_Hover, true);才生效*/
+    border-color: #efca22;
+}
+QSplitter::handle:pressed{
+    border-color: #efca22;
+}
+QSizeGrip{
+    background-color: none;
+}
+
+/* =============================================== */
+/* Label                                           */
+/* =============================================== */
+QLabel {
+    background: transparent;
+    border: 1px solid transparent;
+    padding: 1px;
+}
+
+
+/* A QLabel is a QFrame ... */
+/* A QToolTip is a QLabel ... */
+QToolTip {
+    border: 1px solid #999999;
+    padding: 5px;
+    border-radius: 3px;
+    opacity:210;
+}
+
+/* =============================================== */
+/* TextBox                                         */
+/* =============================================== */
+QLineEdit {
+    background: #1d1d1d;/*不建议设为透明,否则table编辑时会字显示*/
+    selection-background-color: #efca22;
+    border: 1px solid #999999;
+    border-radius: 2px;
+    border-style: inset;
+    padding: 0 1px;
+}
+
+QLineEdit:hover{
+    border-color: #efca22;
+}
+QLineEdit:focus{
+    border-color: #efca22;
+}
+/*QLineEdit[readOnly="true"] { color: gray }*/
+QLineEdit[echoMode="2"]{
+    lineedit-password-character: 9679;/*字符的ascii码35 88等 */
+}
+
+QLineEdit:read-only {
+    color: lightgray;
+}
+
+QLineEdit:disabled{
+    color: lightgray;
+    background: lightgray;
+}
+
+QTextEdit{
+    selection-background-color:#efca22;
+    border: 1px solid #999999;
+    border-style: inset;
+}
+QTextEdit:hover{
+    border-color: #efca22;
+}
+QTextEdit:focus{
+    border-color: #efca22;
+}
+/* =============================================== */
+/* Button                                          */
+/* =============================================== */
+QPushButton {
+    border: 1px solid #999999;
+    border-radius: 2px;
+    background-color: #f6d541;
+    padding: 1px 4px;
+    min-width: 50px;
+    min-height: 16px;
+}
+
+QPushButton:hover{
+    background-color: #efca22;
+    border-color: #efca22;
+}
+
+QPushButton:pressed
+{
+    border-width: 1px;      
+    background-color: #efca22;
+    border-color: #999999;
+}
+
+QPushButton:focus, QPushButton:default {
+    border-color: #efca22; /* make the default button prominent */
+}
+
+
+QToolButton,QToolButton:unchecked { /* ToolBar里的按钮和带下拉菜单的按钮 */
+    border: 1px solid transparent;
+    border-radius: 3px;
+    background-color: transparent;
+    margin: 1px;
+}
+QToolButton:checked{
+    background-color: #efca22;
+    border-color: #efca22;
+}
+QToolButton:hover{
+    background-color: #efca22;
+    border-color: #efca22;
+}
+
+QToolButton:pressed,QToolButton:checked:hover{
+    background-color: #efca22;
+    border-color: #efca22;
+}
+QToolButton:checked:pressed{
+    background-color: #efca22;
+}
+
+/* only for MenuButtonPopup */
+QToolButton[popupMode="1"]{
+    padding-left: 1px;
+    padding-right: 15px; /* make way for the popup button */
+    border: 1px solid #999999;
+    min-height: 15px;
+    /*background: qlineargradient(x1:0, y1:0 ,x2:0, y2:1
+        stop: 0 #EEEEEF, stop: 0.05 #DADADF, stop: 0.5 #DADADF
+        stop: 0.95 #EEEEEF stop: 1#EEEEEF)*/
+}
+QToolButton[popupMode="1"]:hover{
+    background-color: #efca22;
+    border-color: #efca22;
+}
+QToolButton[popupMode="1"]:pressed{
+    border-width: 1px;
+    background-color: #efca22;
+    border-color: #999999;
+}
+QToolButton::menu-button {
+    border: 1px solid #999999;
+    border-top-right-radius: 2px;
+    border-bottom-right-radius: 2px;
+    width: 16px;
+}
+
+
+/* =============================================== */
+/* Slider ProgressBar                              */
+/* =============================================== */
+QProgressBar {
+    border: 1px solid #999999;
+    border-radius: 4px;
+    text-align: center;
+}
+
+QProgressBar::chunk {
+    background-color: #efca22;
+    width: 4px;
+    margin: 1px;
+}
+
+QSlider{
+    border: 1px solid transparent;
+}
+QSlider::groove{
+    border: 1px solid #999999;
+    background: #1d1d1d;
+}
+QSlider::handle {/*设置中间的那个滑动的键*/                           
+    border: 1px solid #999999;
+    background: #efca22;
+}
+QSlider::groove:horizontal {
+    height: 3px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */
+    left:5px; right: 5px;
+}
+QSlider::groove:vertical{
+    width: 3px;
+    top: 5px; bottom: 5px;
+}
+QSlider::handle:horizontal{
+    width: 6px;
+    margin: -7px; /* height */
+}
+QSlider::handle:vertical{
+    height: 6px;
+    margin: -7px; /* height */
+}
+QSlider::add-page{/*还没有滑上去的地方*/
+    border: 1px solid #999999;
+    background:#EEEEEF;
+}
+QSlider::sub-page{/*已经划过的从地方*/                            
+    background: #efca22;
+}
+
+/* =============================================== */
+/* ScrollBar                                       */
+/* =============================================== */
+QScrollBar{
+    background-color: #1d1d1d;
+    border: 1px solid #999999;
+    border-radius: 5px;
+    padding: 1px;
+    height: 10px;
+    width: 10px;
+}
+QScrollBar:hover{
+    border-color:#efca22;
+}
+QScrollBar::handle{
+    border-radius: 3px;
+    background: #efca22;
+    min-width: 16px;
+    min-height: 16px;
+}
+QScrollBar::handle:hover {
+    background: #efca22;
+}
+QScrollBar::add-line, QScrollBar::sub-line,
+QScrollBar::add-page, QScrollBar::sub-page {
+    width: 0px;
+    background: transparent;
+}
+QScrollArea{
+    border: none;
+}
+/*QScrollArea  QAbstractSlider{
+    border-radius: 0px;
+}*/
+/* =============================================== */
+/* DockWidget                                       */
+/* =============================================== */
+QDockWidget, QDockWidget > QWidget/*not work*/
+{
+    border-color: #999999;/*qt bug*/
+    background: transparent;
+}
+QDockWidget::title {
+    border-bottom: 1px solid #999999;
+    border-style: inset;
+    text-align: left; /* align the text to the left */
+    padding: 6px;
+}
+
+/* =============================================== */
+/* GroupBox                                        */
+/* =============================================== */
+QGroupBox {
+    background-color: #1d1d1d;
+    border: 1px solid #999999;
+    border-radius: 4px;
+    margin-top: 0.5em;
+}
+QGroupBox::title {
+    subcontrol-origin: margin;
+    subcontrol-position: top left;
+    left: 1em;
+	top: 0.1em;
+    background-color: #1d1d1d;
+}
+/* =============================================== */
+/* ToolBox                                         */
+/* =============================================== */
+QToolBox{
+    border: 1px solid #999999;
+}
+QToolBox::tab {
+    background: #EEEEEF;
+    border: 1px solid #999999;
+    border-radius: 1px;
+}
+QToolBox::tab:hover {
+    background-color: #efca22;
+    border-color: transparent;
+}
+QToolBox::tab:pressed {
+    background-color: #efca22;
+    border-color: transparent;
+}
+QToolBox::tab:selected {
+    font-weight: bold;
+    border-color: #efca22;
+}
+
+/* =============================================== */
+/* TabWidget                                       */
+/* =============================================== */
+QTabWidget{
+    margin-top:10px;
+}
+QTabWidget::pane{
+    border: 1px solid #999999;
+}
+QTabWidget::tab-bar {
+    left: 0px;
+}
+QTabBar::tab {
+    background: #1d1d1d;
+    border: 1px solid #999999;
+    padding: 3px 5px;    
+}
+QTabBar::tab:hover {
+    background: #efca22;
+    border-color: transparent;
+}
+QTabBar::tab:selected {
+    background: #efca22;
+    border-color: #efca22;
+}
+QTabBar::tab:pressed {
+    background: #efca22;
+    border-color: transparent;
+}
+QTabBar::tab:focus {
+    border-color: #efca22;
+}
+QTabBar::tab:top{
+    margin-top: 3px;
+    border-bottom: transparent;
+    margin-right: 1px;
+}
+QTabBar::tab:bottom{
+    margin-bottom: 3px;
+    border-top: transparent;
+    margin-right: 1px;
+}
+QTabBar::tab:left{
+    border-right: transparent;
+    margin-bottom: 1px;
+}
+QTabBar::tab:right{
+    border-left: transparent;
+    margin-bottom: 1px;
+}
+
+/* =============================================== */
+/* QHeaderView for list table                      */
+/* =============================================== */
+QHeaderView {
+	border: none;
+	margin: 0px;
+	padding: 0px;
+}
+QHeaderView::section, QTableCornerButton::section {/*设置表头属性*//*左上角*/
+	background-color: #EEEEEF;
+	padding: 0 3px;
+	border-right: 1px solid #999999;
+	border-bottom: 1px solid #999999;
+	border-radius: 0px;
+}
+QHeaderView::section:hover, QTableCornerButton::section:hover{
+    background-color: #efca22;
+}
+QHeaderView::section:pressed{
+    background-color: #efca22;
+}
+QHeaderView::section:checked {
+    background-color: #efca22;
+}
+
+/* =============================================== */
+/* QTableWidget                                    */
+/* =============================================== */
+QTableWidget, QTableView
+{
+    gridline-color: #999999;    /*表格中的网格线条颜色*/
+    background: #1d1d1d;
+    /*设置交替颜色,需要在函数属性中设置:tableWidget->setAlternatingRowColors(true)*/
+    alternate-background-color: #EEEEEF;
+    /*selection-color:#1d1d1d;    鼠标选中时前景色:文字颜色*/
+    selection-background-color:#efca22;   /*鼠标选中时背景色*/
+    border:1px solid #999999;  /*边框线的宽度、颜色*/
+    /*border:none;    去除边界线*/
+    /*border-radius:5px;*/
+    /*padding:10px 10px;*/  /*表格与边框的间距*/
+}
+QTableView::item, QTabWidget::item{
+    background: transparent;
+	outline-style: none;
+	border: none;
+}
+
+QTableView::item:hover {
+	background: #efca22;
+    border: 1px solid #efca22;
+}
+
+QTableView::item:selected {
+	background: #efca22;
+	color: #EEEEEF;
+}
+
+QTableView::item:selected:active {
+	background: #efca22;
+	color: #EEEEEF;
+}
+
+QTableWidget QComboBox{
+    margin: 2px;
+    border: none;
+}

+ 1 - 1
config.ini

@@ -1,6 +1,6 @@
 [basicSetup]
 [basicSetup]
 name = ¿ÙͼÈí¼þ
 name = ¿ÙͼÈí¼þ
-account = 15957854217
+account = 15001208995
 version = 0.17
 version = 0.17
 env = dev
 env = dev
 last_select_path = C:/Users/gymmc/Desktop/¿Ùͼ²âÊÔ/1
 last_select_path = C:/Users/gymmc/Desktop/¿Ùͼ²âÊÔ/1

+ 1 - 1
custom_config.ini

@@ -1,5 +1,5 @@
 [basicSetup]
 [basicSetup]
-account = 15957854217
+account = 
 is_fall_dir = żŰÍź,ŇŃżŰÍź
 is_fall_dir = żŰÍź,ŇŃżŰÍź
 is_fall_file = ΢ĐĹ
 is_fall_file = ΢ĐĹ
 
 

+ 20 - 0
log/logging_text.log

@@ -0,0 +1,20 @@
+2024-12-12 10:48:39,977---59---图片抠图工具---Uncaught exception
+Traceback (most recent call last):
+  File "C:\Development\project\python\image_cutout\main.py", line 474, in select_file_path
+    if not mineWidget.checkLogin(self):
+TypeError: MineQWidget.checkLogin() takes 1 positional argument but 2 were given
+2024-12-12 10:48:40,813---59---图片抠图工具---Uncaught exception
+Traceback (most recent call last):
+  File "C:\Development\project\python\image_cutout\main.py", line 474, in select_file_path
+    if not mineWidget.checkLogin(self):
+TypeError: MineQWidget.checkLogin() takes 1 positional argument but 2 were given
+2024-12-12 10:48:41,260---59---图片抠图工具---Uncaught exception
+Traceback (most recent call last):
+  File "C:\Development\project\python\image_cutout\main.py", line 474, in select_file_path
+    if not mineWidget.checkLogin(self):
+TypeError: MineQWidget.checkLogin() takes 1 positional argument but 2 were given
+2024-12-12 10:48:41,675---59---图片抠图工具---Uncaught exception
+Traceback (most recent call last):
+  File "C:\Development\project\python\image_cutout\main.py", line 474, in select_file_path
+    if not mineWidget.checkLogin(self):
+TypeError: MineQWidget.checkLogin() takes 1 positional argument but 2 were given

+ 19 - 25
main.py

@@ -17,7 +17,7 @@ from module.other.module_online_data import GetOnlineData
 from module.module_login import LoginWindow
 from module.module_login import LoginWindow
 from module.remove_bg_pixian import RemoveBgPiXian
 from module.remove_bg_pixian import RemoveBgPiXian
 from module.deal_cutout import DealCutout
 from module.deal_cutout import DealCutout
-
+from module.MineMainWindow import MineMainWindow
 import requests
 import requests
 from module.module_move_files import MoveFiles
 from module.module_move_files import MoveFiles
 import webbrowser
 import webbrowser
@@ -30,7 +30,7 @@ from qt_material import apply_stylesheet,list_themes
 """
 """
 
 
 
 
-class MainWindow(QMainWindow, Ui_MainWindow):
+class MainWindow(MineMainWindow, Ui_MainWindow):
     sign_self = Signal(dict)
     sign_self = Signal(dict)
 
 
     def __init__(self):
     def __init__(self):
@@ -129,7 +129,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
         self.setStyleSheet(style_sheet)
         self.setStyleSheet(style_sheet)
 
 
     def login_info_is_false(self):
     def login_info_is_false(self):
-        reply = QMessageBox.question(self, '确认', "登录信息已失效", QMessageBox.Yes)
+        self.WaringMessage("登录信息已失效")
         QTimer.singleShot(500, self.to_logout)
         QTimer.singleShot(500, self.to_logout)
 
 
     def refresh_times(self, is_online=True, remaining_times=None):
     def refresh_times(self, is_online=True, remaining_times=None):
@@ -163,7 +163,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
 
 
     def closeEvent(self, event):
     def closeEvent(self, event):
         print("to close")
         print("to close")
-        reply = QMessageBox.question(self, '确认', "确定要关闭窗口吗?", QMessageBox.Yes | QMessageBox.No)
+        reply = self.comfirmMessage("确定要关闭窗口吗?")
         if reply == QMessageBox.Yes:
         if reply == QMessageBox.Yes:
             # 如果用户点击了"是"按钮,则正常关闭窗口
             # 如果用户点击了"是"按钮,则正常关闭窗口
             super().closeEvent(event)
             super().closeEvent(event)
@@ -285,8 +285,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
                 need_cutout_images.append(image_item.image_data)
                 need_cutout_images.append(image_item.image_data)
 
 
             if not self.mods:
             if not self.mods:
-                a = QMessageBox.question(self, '确认', '无抠图权限,请联系业务员'.format(),
-                                         QMessageBox.Yes)
+                # self.
+                a = self.comfirmMessage("无抠图权限,请联系业务员")
                 if a == QMessageBox.Yes:
                 if a == QMessageBox.Yes:
                     pass
                     pass
                 self.pushButton.setEnabled(True)
                 self.pushButton.setEnabled(True)
@@ -294,22 +294,23 @@ class MainWindow(QMainWindow, Ui_MainWindow):
 
 
             n = len([x for x in need_cutout_images if x["need_cutout"]])
             n = len([x for x in need_cutout_images if x["need_cutout"]])
             if n == 0:
             if n == 0:
-                a = QMessageBox.question(self, '确认', '没有需要的处理的图片'.format(),
-                                         QMessageBox.Yes)
+                self.WaringMessage("没有需要的处理的图片")
                 self.pushButton.setEnabled(True)
                 self.pushButton.setEnabled(True)
 
 
             if n > 0:
             if n > 0:
                 # 检查余额是否正确
                 # 检查余额是否正确
                 if self.remaining_times < n:
                 if self.remaining_times < n:
-                    a = QMessageBox.question(self, '确认', '待处理图:{}张,剩余点数:{},余额不足'.format(n, self.remaining_times),
-                                             QMessageBox.Yes)
+                    a = self.comfirmMessage(
+                        "待处理图:{}张,剩余点数:{},余额不足".format(
+                            n, self.remaining_times
+                        )
+                    )
                     if a == QMessageBox.Yes:
                     if a == QMessageBox.Yes:
                         pass
                         pass
                     self.pushButton.setEnabled(True)
                     self.pushButton.setEnabled(True)
                     return
                     return
                 else:
                 else:
-                    a = QMessageBox.question(self, '确认', '图片总数:{},是否进行抠图处理?'.format(n),
-                                             QMessageBox.Yes | QMessageBox.No)
+                    a = self.comfirmMessage("图片总数:{},是否进行抠图处理?".format(n))
                     if a == QMessageBox.Yes:
                     if a == QMessageBox.Yes:
                         self.deal_data_info_1 = {"time": time.time(),
                         self.deal_data_info_1 = {"time": time.time(),
                                                  "num": n}
                                                  "num": n}
@@ -444,8 +445,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
         print("online_version:", online_version)
         print("online_version:", online_version)
         if online_version:
         if online_version:
             if compare_versions(settings.Version, online_version) == -1:
             if compare_versions(settings.Version, online_version) == -1:
-                a = QMessageBox.question(self, '确认', '当前不是最新版本,请下载最新版本',
-                                         QMessageBox.Yes)
+                a =  self.comfirmMessage("当前不是最新版本,请下载最新版本")
                 if a == QMessageBox.Yes:
                 if a == QMessageBox.Yes:
                     print("close")
                     print("close")
                 os._exit(0)
                 os._exit(0)
@@ -470,15 +470,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
             self.state_change(to_state=0)
             self.state_change(to_state=0)
 
 
     def select_file_path(self, *args):
     def select_file_path(self, *args):
-
-        if not settings.IsLogin:
-            a = QMessageBox.question(self, '确认', '请先登录',
-                                     QMessageBox.Yes)
+        if not self.checkLogin():
             return
             return
 
 
-        if not self.mods:
-            a = QMessageBox.question(self, '确认', '无抠图软件权限,请联系管理员',
-                                     QMessageBox.Yes)
+        if not self.checkMods(self.mods):
             return
             return
 
 
         messageBox = QMessageBox()
         messageBox = QMessageBox()
@@ -551,8 +546,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
             # 检查需要处理的文件数量
             # 检查需要处理的文件数量
             self.init_images(file_path=self.file_path)
             self.init_images(file_path=self.file_path)
             if len([x for x in self.need_cutout_images if x["need_cutout"]]) == 0:
             if len([x for x in self.need_cutout_images if x["need_cutout"]]) == 0:
-                a = QMessageBox.question(self, '确认', '您所选文件夹下没有jpg图片,或对应图片已扣图',
-                                         QMessageBox.Yes)
+                a = self.comfirmMessage("您所选文件夹下没有jpg图片,或对应图片已扣图")
                 if a == QMessageBox.Yes:
                 if a == QMessageBox.Yes:
                     pass
                     pass
 
 
@@ -865,12 +859,12 @@ class MainWindow(QMainWindow, Ui_MainWindow):
         #     self.action_6.setEnabled(True)
         #     self.action_6.setEnabled(True)
 
 
     def stop_func(self):
     def stop_func(self):
-        a = QMessageBox.question(self, '确认', '是否终止当前正在运行?',
-                                 QMessageBox.Yes | QMessageBox.No)
+        a = self.comfirmMessage("是否终止当前正在运行?")
         if a == QMessageBox.Yes:
         if a == QMessageBox.Yes:
             self.deal_cutout_mode.state = 2
             self.deal_cutout_mode.state = 2
             self.state_change(to_state=1)
             self.state_change(to_state=1)
 
 
+
 class MyImage(QLabel):
 class MyImage(QLabel):
     signal_data = Signal(dict)
     signal_data = Signal(dict)
 
 

+ 33 - 0
module/MineMainWindow.py

@@ -0,0 +1,33 @@
+from PySide6.QtWidgets import *
+from PySide6.QtCore import *
+from PySide6.QtGui import *
+import settings
+
+class MineMainWindow(QMainWindow):
+
+    def checkLogin(self):
+        """检查是否登录"""
+        if not settings.IsLogin:
+            # self.PlayErrorAudio()
+            QMessageBox.critical(self, "警告", "请先登录账号", QMessageBox.Ok)
+            return False
+        return True
+
+    def checkMods(self,mods):
+        """检查是否有权限"""
+        if not mods:
+            a = QMessageBox.question(self, '确认', '无抠图软件权限,请联系管理员',
+                                     QMessageBox.Yes)
+            return False
+        return True
+
+    def WaringMessage(self, message):
+        """警告弹窗"""
+        # self.PlayErrorAudio()
+        return QMessageBox.critical(self, "警告", message, QMessageBox.Ok)
+
+    def comfirmMessage(self, message):
+        questResult = QMessageBox.question(
+            self, "确认", message, QMessageBox.Yes | QMessageBox.No
+        )
+        return questResult

+ 51 - 0
module/MineQWidget.py

@@ -0,0 +1,51 @@
+from PySide6.QtWidgets import *
+from PySide6.QtCore import *
+from PySide6.QtGui import *
+from PySide6.QtWidgets import *
+from PySide6.QtCore import *
+from PySide6.QtMultimedia import *
+import settings
+import os
+import threading
+import concurrent.futures
+from functools import partial
+
+
+# 统一封装
+class MineQWidget(QWidget):
+
+    def __init__(self):
+        super().__init__()
+        self.setWindowFlags(Qt.WindowStaysOnTopHint)
+
+    def checkLogin(self):
+        """检查是否登录"""
+        if not settings.IsLogin:
+            # self.PlayErrorAudio()
+            QMessageBox.critical(self, "警告", "请先登录账号", QMessageBox.Ok)
+            return False
+        return True
+
+    def WaringMessage(self, message):
+        """警告弹窗"""
+        # self.PlayErrorAudio()
+        return QMessageBox.critical(self, "警告", message, QMessageBox.Ok)
+
+    def PlayErrorAudio(self):
+        current_path = os.getcwd()
+        effect = QSoundEffect(self)
+        # print("current_path", current_path)
+        effect.setSource(
+            QUrl.fromLocalFile(r"{}\resources\ttl\error_audio.wav".format(current_path))
+        )
+        effect.setVolume(1)
+        effect.setLoopCount(1)
+        effect.play()
+        return
+
+    def comfirmMessage(self, message):
+        questResult = QMessageBox.question(
+            self, "确认", message, QMessageBox.Yes | QMessageBox.No
+        )
+        return questResult
+

+ 5 - 4
module/module_login.py

@@ -7,9 +7,10 @@ import settings
 from PySide6.QtCore import *
 from PySide6.QtCore import *
 import threading
 import threading
 from module.other.rsa import RSAService
 from module.other.rsa import RSAService
+from .MineQWidget import MineQWidget
 
 
 
 
-class LoginWindow(QWidget, Ui_Form):
+class LoginWindow(MineQWidget, Ui_Form):
     get_verification_code_last_time = 0
     get_verification_code_last_time = 0
 
 
     def __init__(self, windows=None, call_back=None, par=None):
     def __init__(self, windows=None, call_back=None, par=None):
@@ -93,18 +94,18 @@ class LoginWindow(QWidget, Ui_Form):
         print("phone", phone)
         print("phone", phone)
 
 
         if phone == "":
         if phone == "":
-            reply = QMessageBox.question(self, '确认', "请输入手机号", QMessageBox.Yes)
+            self.WaringMessage("请输入手机号")
             self.pushButton_2.setEnabled(True)
             self.pushButton_2.setEnabled(True)
             return False, "请输入手机号"
             return False, "请输入手机号"
 
 
         try:
         try:
             phone = int(phone)
             phone = int(phone)
             if len(str(phone)) != 11:
             if len(str(phone)) != 11:
-                reply = QMessageBox.question(self, '确认', "手机号码长度错误", QMessageBox.Yes)
+                self.WaringMessage("手机号码长度错误")
                 self.pushButton_2.setEnabled(True)
                 self.pushButton_2.setEnabled(True)
                 return False
                 return False
         except:
         except:
-            reply = QMessageBox.question(self, '确认', "手机号码格式错误", QMessageBox.Yes)
+            self.WaringMessage("手机号码格式错误")
             self.pushButton_2.setEnabled(True)
             self.pushButton_2.setEnabled(True)
             return False, "手机号码格式错误"
             return False, "手机号码格式错误"
         url = "{domain}/api/auth/send_code".format(
         url = "{domain}/api/auth/send_code".format(

+ 5 - 5
module/module_move_files.py

@@ -6,13 +6,13 @@ import os
 import threading
 import threading
 import shutil
 import shutil
 import time
 import time
-
+from .MineQWidget import MineQWidget
 """
 """
 图片移动
 图片移动
 """
 """
 
 
 
 
-class MoveFiles(QWidget, move_files_Ui_Form):
+class MoveFiles(MineQWidget, move_files_Ui_Form):
     progress_sign = Signal(dict)
     progress_sign = Signal(dict)
     info_sign = Signal(str)
     info_sign = Signal(str)
     text_show = Signal(str)
     text_show = Signal(str)
@@ -87,7 +87,7 @@ class MoveFiles(QWidget, move_files_Ui_Form):
     def run(self):
     def run(self):
         self.total_num = 0
         self.total_num = 0
         if not self.to_deal_image_dir:
         if not self.to_deal_image_dir:
-            QMessageBox.question(self, '确认', '请选择待处理图片文件夹', QMessageBox.Yes)
+            self.WaringMessage("请选择待处理图片文件夹")
             return
             return
         self.textEdit_2.setText("")
         self.textEdit_2.setText("")
         self.textEdit_3.setText("")
         self.textEdit_3.setText("")
@@ -98,7 +98,7 @@ class MoveFiles(QWidget, move_files_Ui_Form):
             if i:
             if i:
                 goods_art_list.append(i.upper())
                 goods_art_list.append(i.upper())
         if not goods_art_list:
         if not goods_art_list:
-            QMessageBox.question(self, '确认', '请填写待转移图片', QMessageBox.Yes)
+            self.WaringMessage("请填写待转移图片")
             return
             return
 
 
         to_deal_pic = []
         to_deal_pic = []
@@ -110,7 +110,7 @@ class MoveFiles(QWidget, move_files_Ui_Form):
                     to_deal_pic.append(pic)
                     to_deal_pic.append(pic)
 
 
         if not to_deal_pic:
         if not to_deal_pic:
-            QMessageBox.question(self, '确认', '该文件夹下没有任何图片', QMessageBox.Yes)
+            self.WaringMessage("该文件夹下没有任何图片")
             return
             return
 
 
         # 开始执行拼接处理
         # 开始执行拼接处理

+ 63 - 41
module/module_rename_pic.py

@@ -1,24 +1,28 @@
 from UI.rename_pic import Ui_Form as rename_pic_Ui_Form
 from UI.rename_pic import Ui_Form as rename_pic_Ui_Form
 from PySide6.QtWidgets import *
 from PySide6.QtWidgets import *
 from PySide6.QtCore import *
 from PySide6.QtCore import *
+
 # from collections import defaultdict
 # from collections import defaultdict
 import os
 import os
 import log
 import log
 from PIL import Image, ImageDraw, ImageFont
 from PIL import Image, ImageDraw, ImageFont
 import time
 import time
 import settings
 import settings
+
 # from pyzbar.pyzbar import decode
 # from pyzbar.pyzbar import decode
 import shutil
 import shutil
 from cv2 import cvtColor, COLOR_RGB2BGR
 from cv2 import cvtColor, COLOR_RGB2BGR
+
 # cv2.cvtColor(np.asarray(im), cv2.COLOR_RGB2BGR)
 # cv2.cvtColor(np.asarray(im), cv2.COLOR_RGB2BGR)
 import numpy as np
 import numpy as np
 from cv2.wechat_qrcode import WeChatQRCode
 from cv2.wechat_qrcode import WeChatQRCode
 from module.module_online_data import GetOnlineData
 from module.module_online_data import GetOnlineData
-
+from MineQWidget import MineQWidget
 
 
 # pip install opencv-python -i https://pypi.douban.com/simple
 # pip install opencv-python -i https://pypi.douban.com/simple
 # pip install opencv-contrib-python -i https://pypi.douban.com/simple
 # pip install opencv-contrib-python -i https://pypi.douban.com/simple
 
 
+
 class Picture:
 class Picture:
     def __init__(self, in_path):
     def __init__(self, in_path):
         self.im = Image.open(in_path)
         self.im = Image.open(in_path)
@@ -41,10 +45,12 @@ class Picture:
     def corp_square(self):
     def corp_square(self):
         if self.y < self.x:
         if self.y < self.x:
             return
             return
-        self.im = self.im.crop((0, int((self.y - self.x) / 2), self.x, self.y - int((self.y - self.x) / 2)))
+        self.im = self.im.crop(
+            (0, int((self.y - self.x) / 2), self.x, self.y - int((self.y - self.x) / 2))
+        )
 
 
 
 
-class RenamePic(QWidget, rename_pic_Ui_Form):
+class RenamePic(MineQWidget, rename_pic_Ui_Form):
     progress_sign = Signal(dict)
     progress_sign = Signal(dict)
     info_sign = Signal(str)
     info_sign = Signal(str)
     text_show = Signal(str)
     text_show = Signal(str)
@@ -60,13 +66,7 @@ class RenamePic(QWidget, rename_pic_Ui_Form):
         self.setFixedSize(self.width(), self.height())
         self.setFixedSize(self.width(), self.height())
         self.set_state(2)
         self.set_state(2)
         self.show()
         self.show()
-        QTimer.singleShot(500, self.check_login)
-
-    def check_login(self, *args):
-        if not settings.IsLogin:
-            a = QMessageBox.question(self, '确认', '请先登录',
-                                     QMessageBox.Yes)
-            self.close()
+        QTimer.singleShot(500, self.checkLogin)
 
 
     def init(self):
     def init(self):
         self.text_show.connect(self.append_text_to_browser)
         self.text_show.connect(self.append_text_to_browser)
@@ -81,7 +81,7 @@ class RenamePic(QWidget, rename_pic_Ui_Form):
 
 
     def get_len_text(self, text, max_len: int):
     def get_len_text(self, text, max_len: int):
         if len(text) > max_len:
         if len(text) > max_len:
-            text = text[:int(max_len / 4)] + "..." + text[-1 * int(max_len * 3 / 4):]
+            text = text[: int(max_len / 4)] + "..." + text[-1 * int(max_len * 3 / 4) :]
         return text
         return text
 
 
     def select_pic_dir(self, *args):
     def select_pic_dir(self, *args):
@@ -118,11 +118,9 @@ class RenamePic(QWidget, rename_pic_Ui_Form):
 
 
     def run(self):
     def run(self):
         # 基础检查
         # 基础检查
-        if not settings.IsLogin:
-            a = QMessageBox.question(self, '确认', '请先登录',
-                                     QMessageBox.Yes)
+        checkRes = self.checkLogin()
+        if checkRes == False:
             return
             return
-
         self.set_state(1)
         self.set_state(1)
         if not self.pic_dir:
         if not self.pic_dir:
             self.text_show.emit("请选择图片文件夹")
             self.text_show.emit("请选择图片文件夹")
@@ -133,7 +131,7 @@ class RenamePic(QWidget, rename_pic_Ui_Form):
             self.set_state(2)
             self.set_state(2)
             return
             return
         total = 0
         total = 0
-        _Type = ['.png', '.PNG', '.jpg', '.JPG', '.gif', '.GIF', '.jpeg', '.JPEG']
+        _Type = [".png", ".PNG", ".jpg", ".JPG", ".gif", ".GIF", ".jpeg", ".JPEG"]
         for image_file in os.listdir(self.pic_dir):
         for image_file in os.listdir(self.pic_dir):
             path = "{}\{}".format(self.pic_dir, image_file)
             path = "{}\{}".format(self.pic_dir, image_file)
             if os.path.isfile(path):
             if os.path.isfile(path):
@@ -158,7 +156,9 @@ class RenamePic(QWidget, rename_pic_Ui_Form):
 
 
     def run_deal(self, total, is_add_text=False):
     def run_deal(self, total, is_add_text=False):
         # 输出目录
         # 输出目录
-        out_put_path = "{}\out_put_{}".format(os.path.split(self.pic_dir)[0], int(time.time()))
+        out_put_path = "{}\out_put_{}".format(
+            os.path.split(self.pic_dir)[0], int(time.time())
+        )
         # 无法识别的目录
         # 无法识别的目录
         error_path = "{}\识别失败".format(out_put_path)
         error_path = "{}\识别失败".format(out_put_path)
         # 识别成功的目录
         # 识别成功的目录
@@ -169,28 +169,35 @@ class RenamePic(QWidget, rename_pic_Ui_Form):
         self.check_path(success_path)
         self.check_path(success_path)
 
 
         error_list = []
         error_list = []
-        _Type = ['.png', '.PNG', '.jpg', '.JPG', '.gif', '.GIF', '.jpeg', '.JPEG']
+        _Type = [".png", ".PNG", ".jpg", ".JPG", ".gif", ".GIF", ".jpeg", ".JPEG"]
         last_code = None
         last_code = None
         do_n = 0
         do_n = 0
         for image_file in os.listdir(self.pic_dir):
         for image_file in os.listdir(self.pic_dir):
             if os.path.splitext(image_file)[1] in _Type:
             if os.path.splitext(image_file)[1] in _Type:
                 # 获取当前路径的文件夹名称
                 # 获取当前路径的文件夹名称
                 file_path = "{}/{}".format(self.pic_dir, image_file)
                 file_path = "{}/{}".format(self.pic_dir, image_file)
-                self.send_info({"_type": "text",
-                                "data": "{}图片解析".format(image_file)})
+                self.send_info(
+                    {"_type": "text", "data": "{}图片解析".format(image_file)}
+                )
                 code = self.get_code(file_path)
                 code = self.get_code(file_path)
 
 
                 if code:
                 if code:
                     if "_" in code:
                     if "_" in code:
                         goods_number = code.split("_")[0]
                         goods_number = code.split("_")[0]
                         numbers_list = [goods_number]
                         numbers_list = [goods_number]
-                        r_data = GetOnlineData().get_goods_art_no_info(numbers_list=numbers_list)
+                        r_data = GetOnlineData().get_goods_art_no_info(
+                            numbers_list=numbers_list
+                        )
                         if goods_number in r_data:
                         if goods_number in r_data:
                             code = r_data[goods_number]["商品货号"]
                             code = r_data[goods_number]["商品货号"]
                         else:
                         else:
                             code = None
                             code = None
-                            self.send_info({"_type": "text",
-                                            "data": "{}查询不到商品".format(goods_number)})
+                            self.send_info(
+                                {
+                                    "_type": "text",
+                                    "data": "{}查询不到商品".format(goods_number),
+                                }
+                            )
 
 
                 if code:
                 if code:
                     # 获取到二维码内容,说明是二维码图片,则不做处理
                     # 获取到二维码内容,说明是二维码图片,则不做处理
@@ -200,18 +207,27 @@ class RenamePic(QWidget, rename_pic_Ui_Form):
                     # 上个二维码没有解析成功
                     # 上个二维码没有解析成功
                     if not last_code:
                     if not last_code:
                         error_list.append(image_file)
                         error_list.append(image_file)
-                        self.send_info({"_type": "text",
-                                        "data": "{}无法识别".format(image_file)})
-                        shutil.copyfile(file_path, "{}\{}".format(error_path, image_file))
+                        self.send_info(
+                            {"_type": "text", "data": "{}无法识别".format(image_file)}
+                        )
+                        shutil.copyfile(
+                            file_path, "{}\{}".format(error_path, image_file)
+                        )
                     #
                     #
                     if last_code:
                     if last_code:
                         print("{}--------".format(last_code))
                         print("{}--------".format(last_code))
                         # 目标文件路径
                         # 目标文件路径
-                        _file_name = "{}{}".format(last_code, os.path.splitext(image_file)[1])
+                        _file_name = "{}{}".format(
+                            last_code, os.path.splitext(image_file)[1]
+                        )
                         dst_file = "{}/{}".format(success_path, _file_name)
                         dst_file = "{}/{}".format(success_path, _file_name)
                         if os.path.exists(dst_file):
                         if os.path.exists(dst_file):
-                            self.send_info({"_type": "text",
-                                            "data": "{}图片已存在".format(image_file)})
+                            self.send_info(
+                                {
+                                    "_type": "text",
+                                    "data": "{}图片已存在".format(image_file),
+                                }
+                            )
                             last_code = None
                             last_code = None
                             continue
                             continue
                         shutil.copy(file_path, dst_file)  # 复制文件
                         shutil.copy(file_path, dst_file)  # 复制文件
@@ -220,20 +236,19 @@ class RenamePic(QWidget, rename_pic_Ui_Form):
                         pic.corp_square()  # 居中剪裁
                         pic.corp_square()  # 居中剪裁
                         if is_add_text:
                         if is_add_text:
                             draw = ImageDraw.Draw(pic.im)
                             draw = ImageDraw.Draw(pic.im)
-                            font_style_1 = ImageFont.truetype(r"ttf\simfang.ttf", 40, encoding="utf-8")
+                            font_style_1 = ImageFont.truetype(
+                                r"ttf\simfang.ttf", 40, encoding="utf-8"
+                            )
                             draw.text((0, 0), last_code, 0, font=font_style_1)
                             draw.text((0, 0), last_code, 0, font=font_style_1)
                         pic.save_img(dst_file)
                         pic.save_img(dst_file)
                         # 处理成功了,清空上个记录
                         # 处理成功了,清空上个记录
                         last_code = None
                         last_code = None
 
 
             do_n += 1
             do_n += 1
-            self.send_info({"_type": "show_p",
-                            "data": int(do_n / total * 100)})
+            self.send_info({"_type": "show_p", "data": int(do_n / total * 100)})
         if error_list:
         if error_list:
-            self.send_info({"_type": "text",
-                            "data": "以下图片无法解析,请自行处理"})
-        self.send_info({"_type": "text",
-                        "data": "{}".format(error_list)})
+            self.send_info({"_type": "text", "data": "以下图片无法解析,请自行处理"})
+        self.send_info({"_type": "text", "data": "{}".format(error_list)})
 
 
         os.startfile(out_put_path)
         os.startfile(out_put_path)
 
 
@@ -251,17 +266,24 @@ class RenamePic(QWidget, rename_pic_Ui_Form):
         im = pic.im
         im = pic.im
         img = cvtColor(np.asarray(im), COLOR_RGB2BGR)
         img = cvtColor(np.asarray(im), COLOR_RGB2BGR)
         # path = r"D:\MyDocuments\PythonCode\MyPython\red_dragonfly\deal_pics\rename_by_qrcode\opencv_3rdparty-wechat_qrcode"
         # path = r"D:\MyDocuments\PythonCode\MyPython\red_dragonfly\deal_pics\rename_by_qrcode\opencv_3rdparty-wechat_qrcode"
-        detector = WeChatQRCode(detector_prototxt_path="qr_mode/detect.prototxt",
-                                detector_caffe_model_path="qr_mode/detect.caffemodel",
-                                super_resolution_prototxt_path="qr_mode/sr.prototxt",
-                                super_resolution_caffe_model_path="qr_mode/sr.caffemodel")
+        detector = WeChatQRCode(
+            detector_prototxt_path="qr_mode/detect.prototxt",
+            detector_caffe_model_path="qr_mode/detect.caffemodel",
+            super_resolution_prototxt_path="qr_mode/sr.prototxt",
+            super_resolution_caffe_model_path="qr_mode/sr.caffemodel",
+        )
 
 
         res, points = detector.detectAndDecode(img)
         res, points = detector.detectAndDecode(img)
         if res:
         if res:
             return res[0]
             return res[0]
         return None
         return None
 
 
-    def deal_pic_resize(self, file_path, target_size, times=0, ):
+    def deal_pic_resize(
+        self,
+        file_path,
+        target_size,
+        times=0,
+    ):
         file_size = int(os.path.getsize(file_path) / 1024)
         file_size = int(os.path.getsize(file_path) / 1024)
         if file_size < target_size:
         if file_size < target_size:
             return
             return

+ 11 - 13
module/module_resize_pic.py

@@ -6,9 +6,9 @@ from UI.resize_photos import Ui_Form as ResizePicUI
 from PySide6.QtWidgets import *
 from PySide6.QtWidgets import *
 from PySide6.QtCore import *
 from PySide6.QtCore import *
 from PIL import Image
 from PIL import Image
+from .MineQWidget import MineQWidget
 
 
-
-class ResizePic(QWidget, ResizePicUI):
+class ResizePic(MineQWidget, ResizePicUI):
     signal_data = Signal(dict)
     signal_data = Signal(dict)
 
 
     def __init__(self, windows=None):
     def __init__(self, windows=None):
@@ -53,25 +53,25 @@ class ResizePic(QWidget, ResizePicUI):
 
 
     def run(self, is_sure=False):
     def run(self, is_sure=False):
         if not self.lineEdit.text():
         if not self.lineEdit.text():
-            QMessageBox.question(self, '确认', '请输入目标像素', QMessageBox.Yes)
+            self.WaringMessage("请输入目标像素")
             return
             return
         else:
         else:
             try:
             try:
                 self.pic_width_target = int(self.lineEdit.text())
                 self.pic_width_target = int(self.lineEdit.text())
                 if self.pic_width_target < 200 or self.pic_width_target > 2000:
                 if self.pic_width_target < 200 or self.pic_width_target > 2000:
-                    QMessageBox.question(self, '确认', '建议像素在800px左右', QMessageBox.Yes)
+                    self.WaringMessage("建议像素在800px左右")
                     return
                     return
             except:
             except:
-                QMessageBox.question(self, '确认', '像素必须是整数', QMessageBox.Yes)
+                self.WaringMessage("像素必须是整数")
                 return
                 return
 
 
         if not is_sure:
         if not is_sure:
             if not self.show_img_dir:
             if not self.show_img_dir:
-                QMessageBox.question(self, '确认', '请选择图片文件夹', QMessageBox.Yes)
+                self.WaringMessage("请选择图片文件夹")
                 return
                 return
-
-            a = QMessageBox.question(self, '确认', '是否确认继续执行,软件会自动处理所有子文件夹,请自行备份数据,执行后无法恢复',
-                                     QMessageBox.Yes | QMessageBox.No)
+            a =  self.comfirmMessage(
+                "是否确认继续执行,软件会自动处理所有子文件夹,请自行备份数据,执行后无法恢复"
+            )
             if a != QMessageBox.Yes:
             if a != QMessageBox.Yes:
                 return
                 return
 
 
@@ -84,11 +84,9 @@ class ResizePic(QWidget, ResizePicUI):
                         total_pic += 1
                         total_pic += 1
 
 
             if not total_pic:
             if not total_pic:
-                QMessageBox.question(self, '确认', '没有任何图片', QMessageBox.Yes)
+                self.WaringMessage("没有任何图片")
                 return
                 return
-
-            a = QMessageBox.question(self, '确认', '待处理图片数:{},是否继续'.format(total_pic),
-                                     QMessageBox.Yes | QMessageBox.No)
+            a = self.comfirmMessage("待处理图片数:{},是否继续".format(total_pic))
             if a == QMessageBox.Yes:
             if a == QMessageBox.Yes:
                 self.run(is_sure=True)
                 self.run(is_sure=True)
         else:
         else: