This commit is contained in:
2025-11-01 18:52:19 +08:00
parent f6698a74a0
commit 9e4b73b1de
5 changed files with 14647 additions and 1 deletions

View File

@ -1,23 +1,83 @@
from re import U
from hardware import transmitter
from view.main_window import MainWindow
import threading
from .camera_controller import CameraController
from .bottom_control_controller import BottomControlController
from hardware.transmitter import TransmitterController
from hardware.relay import RelayController
class MainController:
def __init__(self):
# 主界面
self.main_window = MainWindow()
# 定时器
self.timer = threading.Timer(5.0, self._onTimer)
self.timer.start() # 每5秒触发一次
self.timer2=threading.Timer(1.0, self._onTimer2)
self.timer2.start() # 每秒触发一次
self.angle=10
self.max_angle=60
self.min_angle=10
self.is_add=True
# 初始化子界面
self._initSubViews()
# 初始化子控制器
self._initSubControllers()
# self.__connectSignals()
def _onTimer(self):
# 定时任务逻辑
loc_tra=TransmitterController(RelayController())
upper_weight=loc_tra.read_data(1)
lower_weight=loc_tra.read_data(2)
if upper_weight is None:
upper_weight=0
if lower_weight is None:
lower_weight=0
self.main_window.hopper_widget.setUpperHopperWeight(upper_weight)
self.main_window.hopper_widget.setLowerHopperWeight(lower_weight)
# 重新启动定时器以实现重复执行
self.timer = threading.Timer(5.0, self._onTimer)
self.timer.start()
pass
def _onTimer2(self):
print(str(self.angle))
# 定时任务逻辑
if self.is_add:
self.angle+=1
else:
self.angle-=1
if self.angle>self.max_angle:
self.is_add=False
self.angle=self.max_angle
if self.angle<=self.min_angle:
self.is_add=True
self.angle=10
self.main_window.hopper_widget.setLowerHopperOpeningAngle(self.angle)
# 重新启动定时器以实现重复执行
self.timer2 = threading.Timer(1.0, self._onTimer2)
self.timer2.start()
pass
def showMainWindow(self):
self.main_window.show()
self.main_window.dispatch_task_widget.set_task_time("task1","15:44 PM")
self.main_window.dispatch_task_widget.set_task_time("task2","17:37 PM")
self.main_window.segment_task_widget.set_task_time("task1","15:38 PM")
self.main_window.segment_task_widget.set_task_time("task2","17:24 PM")
def _initSubControllers(self):
# 振捣视频控制

71
resources/resources.qrc Normal file
View File

@ -0,0 +1,71 @@
<RCC>
<qresource prefix="/icons">
<file>../images/AI检测.png</file>
<file>../images/传送带.png</file>
<file>../images/传送带齿轮.png</file>
<file>../images/传送带箭头按钮右1.png</file>
<file>../images/传送带箭头按钮右2.png</file>
<file>../images/传送带箭头按钮左1.png</file>
<file>../images/传送带箭头按钮左2.png</file>
<file>../images/底部背景.png</file>
<file>../images/底部短按钮1.png</file>
<file>../images/底部短按钮2.png</file>
<file>../images/底部系统状态红.png</file>
<file>../images/底部系统状态黄.png</file>
<file>../images/底部系统状态绿.png</file>
<file>../images/底部长按钮1.png</file>
<file>../images/底部长按钮2.png</file>
<file>../images/拱1.png</file>
<file>../images/拱2.png</file>
<file>../images/拱3.png</file>
<file>../images/搅拌机.png</file>
<file>../images/搅拌桨.png</file>
<file>../images/界面刷新.png</file>
<file>../images/离线.png</file>
<file>../images/料斗1.png</file>
<file>../images/料斗2.png</file>
<file>../images/料斗夹具右.png</file>
<file>../images/料斗夹具左.png</file>
<file>../images/料斗状态红.png</file>
<file>../images/料斗状态黄.png</file>
<file>../images/料斗状态绿.png</file>
<file>../images/破拱.png</file>
<file>../images/任务计划背景.png</file>
<file>../images/任务矩形1.png</file>
<file>../images/任务矩形2.png</file>
<file>../images/任务矩形3.png</file>
<file>../images/任务矩形4.png</file>
<file>../images/任务矩形5.png</file>
<file>../images/任务刷新.png</file>
<file>../images/任务信息背景1.png</file>
<file>../images/任务信息分隔.png</file>
<file>../images/任务信息详情按钮1.png</file>
<file>../images/任务信息详情按钮2.png</file>
<file>../images/任务信息选择按钮1.png</file>
<file>../images/任务信息选择按钮2.png</file>
<file>../images/视频背景.png</file>
<file>../images/视频标题背景.png</file>
<file>../images/视频框背景.png</file>
<file>../images/视频摄像头标志.png</file>
<file>../images/文字标题底.png</file>
<file>../images/系统logo.png</file>
<file>../images/系统复位.png</file>
<file>../images/系统启动.png</file>
<file>../images/系统设置背景1.png</file>
<file>../images/系统设置背景2.png</file>
<file>../images/系统数据中心背景1.png</file>
<file>../images/系统数据中心背景2.png</file>
<file>../images/系统停止.png</file>
<file>../images/系统消息背景.png</file>
<file>../images/系统消息喇叭.png</file>
<file>../images/系统用户中心背景1.png</file>
<file>../images/系统用户中心背景2.png</file>
<file>../images/系统中心弹窗背景.png</file>
<file>../images/系统主界面导航栏.png</file>
<file>../images/系统总标题.png</file>
<file>../images/圆形按钮背景1.png</file>
<file>../images/圆形按钮背景2.png</file>
<file>../images/在线.png</file>
<file>../images/主界面背景.png</file>
</qresource>
</RCC>

14514
resources/resources_rc.py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -334,6 +334,7 @@ class HopperWidget(QWidget):
angle : 传入多少度 (单位°)
"""
self.lower_extra_label.setText(f"开: {angle}°")
self.lower_clamp_widget.set_angle(angle)
# ------------------------------
# 设置上料斗状态0=绿1=黄2=红)