def __init__(self): super().__init__() self.loggedIn = False self.resources = Resources() if SysParams.tag == "ukb-7": self.createLogo() self.createLoginTab() # self.createRegisterTab() # define layout self.layout = QtWidgets.QVBoxLayout() self.blankLabel = QtWidgets.QLabel() self.blankLabel.setFixedHeight(75) if SysParams.tag == "ukb-5": self.layout.addWidget(self.blankLabel) # style self.setContentsMargins(50, 5, 50, 0) #left, top, right, bottom self.layout.setSpacing(1) self.loginFormLayout.setContentsMargins(0, 0, 0, 0) # add to layout self.layout.addWidget(self.loginFormLayoutWidget) self.setLayout(self.layout)
def __init__(self): super().__init__() # self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint) self.setWindowFlags(QtCore.Qt.FramelessWindowHint) self.loginTab = None self.launcherTab = None self.loggedIn = False self.userPermission = 0 self.resources = Resources() self.init_ui()
def __init__(self, parent=None): super(DateTimeWidget, self).__init__(parent) self.dayComboBox = QtWidgets.QComboBox() for n in range(31): self.dayComboBox.addItem(str(n + 1)) self.monthComboBox = QtWidgets.QComboBox() for n in range(12): self.monthComboBox.addItem(str(n + 1)) self.yearComboBox = QtWidgets.QComboBox() for n in range(10): self.yearComboBox.addItem(str(n + 2019)) self.hourComboBox = QtWidgets.QComboBox() for n in range(24): self.hourComboBox.addItem(str(n)) self.min10ComboBox = QtWidgets.QComboBox() for n in range(60): self.min10ComboBox.addItem(str(n)) setDateTimeButton = QtWidgets.QPushButton( Resources().get("set_date_time")) setDateTimeButton.setFixedWidth(60) setDateTimeButton.clicked.connect(self.set_date_time) layout = QtWidgets.QHBoxLayout() layout.addWidget(self.dayComboBox) layout.addWidget(self.monthComboBox) layout.addWidget(self.yearComboBox) layout.addWidget(self.hourComboBox) layout.addWidget(self.min10ComboBox) layout.addWidget(setDateTimeButton) # layout.addWidget(min1ComboBox) self.setLayout(layout) self.setContentsMargins(0, 0, 0, 0) layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(1) # self.setStyleSheet(" QComboBox::drop-down{height: 200px;}") # time.strftime('%d-%m-%Y %H:%M') self.print_date_time()
def __init__(self, parent=None, margin=None): super(OverlayDialog, self).__init__(parent=parent) self.id = None self.isOpen = False self.setFixedSize(300, 200) self.successFn = None self.failFn = None self.resources = Resources() self.messageLabel = QtWidgets.QLabel() self.messageLabel.setAlignment(QtCore.Qt.AlignCenter) self.messageLabel.setText("") self.messageLabel.setWordWrap(True) layout2 = QtWidgets.QVBoxLayout() layout2.addWidget(self.messageLabel) layout2.setAlignment(QtCore.Qt.AlignCenter) self.yesButton = QtWidgets.QPushButton("") self.noButton = QtWidgets.QPushButton("") self.yesButton.clicked.connect(self.yes) self.noButton.clicked.connect(self.no) layout1 = QtWidgets.QHBoxLayout() layout1.addWidget(self.yesButton) layout1.addWidget(self.noButton) widget1 = QtWidgets.QWidget() widget1.setLayout(layout1) layout2.addWidget(widget1) layout2.setSpacing(0) # layout1.setContentsMargins(0, 0, 0, 0) self.setLayout(layout2) self.setMyStyleSheet() if margin is None: self.paddingLeft = 5 self.paddingTop = 5 else: self.paddingLeft = margin[0] self.paddingTop = margin[1]
def __init__(self, pixmap_list, default_lvl=-1, prefix="", parent=None): super().__init__(parent) self.warning_30_flag = False self.warning_10_flag = False self.resources = Resources() self.messagePopup = MessagePopup( self.resources.get("battery_30").replace("\\n", "\n"), addCloseButton=True) self.pixmapList = pixmap_list self.label = QtWidgets.QLabel() self.prefix = prefix self.iconLabel = QtWidgets.QLabel() self.batteryLevel = default_lvl layout = QtWidgets.QHBoxLayout(self) layout.addWidget(self.iconLabel) layout.addWidget(self.label) layout.setSpacing(10) layout.setContentsMargins(0, 0, 0, 0) self.setContentsMargins(0, 0, 0, 0) self.set_battery_level(100)
def init(self, message, yesString, noString, succesFn=None, failFn=None): self.succesFn = succesFn self.failFn = failFn self.resources = Resources() self.setWindowModality(QtCore.Qt.ApplicationModal) self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint) # self.setWindowFlag(QtCore.Qt.Popup) self.setWindowTitle(" ") # self.setMaximumWidth(250) # self.setMaximumHeight(250) messageLabel = QtWidgets.QLabel() messageLabel.setText(message) messageLabel.setWordWrap(True) layout2 = QtWidgets.QVBoxLayout() layout2.addWidget(messageLabel) if yesString is not None: yesButton = QtWidgets.QPushButton(yesString) noButton = QtWidgets.QPushButton(noString) yesButton.clicked.connect(self.yes) noButton.clicked.connect(self.no) layout1 = QtWidgets.QHBoxLayout() layout1.addWidget(yesButton) layout1.addWidget(noButton) widget1 = QtWidgets.QWidget() widget1.setLayout(layout1) layout2.addWidget(widget1) self.setLayout(layout2) self.setMyStyleSheet() self.exec_()
def __init__(self, video_source_str, save_dir=None, parent=None): super().__init__(parent=parent, pan_values=[0, 0]) self.setScaledContents(True) self.softPlay = True self.isMotionEnabledDetection = False self.isMotionDetected = False self.lastMotionTime = time.time() # gunCam = GunCamera() # self.flipTransform = QtGui.QTransform() # self.flipTransform.rotate(180) self.videoFlipElement = None self.overlayText = "" self.active_window = None self.videoWidth = None self.videoHeight = None self.zoomCount = 1 self.maxZoom = 10 self.isFlipped = False self.currentFlipMode = 0 self.panValues = [0, 0] self.prevPanValues = [0, 0] self.demandedState = "play" self.isSurfaceScaled = False self.lastSampleTime = time.time() self.videoSourceStr = video_source_str # self.isGunCamera = gunCam.cameraState self.pipe = None self.appSrc = None self.appSink = None self.lastSample = None self.previousSample = None self.isClosing = False self.arr = None # self.isEOSDone = False self.pixmap = None self.set_video_src(video_source_str) self.setContentsMargins(0, 0, 0, 0) self.scaleHeight = self.geometry().size().height() - 0 self.saveDir = save_dir self.isRecordEnabled = False self.isRecorderSetUp = False self.fourcc = None self.videoWriter = None if save_dir is not None: # self.isRecordEnabled = True self.fourcc = cv2.VideoWriter_fourcc(*"mp4v") self.videoWriter = None self.videoCheckTimer = QtCore.QTimer() self.videoCheckTimer.setInterval(250) self.videoCheckTimer.timeout.connect(self.video_check_2) self.videoCheckTimer.start() self.resources = Resources() self.motionMessagePopup = MessagePopup( self.resources.get("motion_detected"), addCloseButton=True)
def __init__(self): super().__init__() # self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint) self.setWindowFlags(QtCore.Qt.FramelessWindowHint) self.coordinateType = int(sys.argv[1]) self.disconnectionPolicy = int(sys.argv[2]) self.chooseIka = int(sys.argv[3]) print("choose ika : ", self.chooseIka) self.disconnectTime = int(sys.argv[4]) self.coordinateConverter = mgrs.MGRS() # vars self.isRestart = False self.isClosing = False self.isConfigDone = False self.socketReceive, self.socketSend = None, None self.cabledSocketReceive, self.cabledSocketSend = None, None self.lastMessage = None self.udpLastReceiveTime = None self.payloadID = None self.kgmControl = None self.kgmTest = None # self.ggmTest = None if self.chooseIka == 0: self.kgmTest = Com.PingTest(UKBParams.kgmIp) elif self.chooseIka == 1: self.kgmTest = Com.PingTest(UKBParams.ggmIp) # self.loginTab = None # self.loggedIn = False self.userPermission = 0 self.panelTab = None self.serialPrefix = [0xAA, 0XBB] self.serialSuffix = [0xCC, 0XDD] self.brightnessLevels = [10, 60, 99] self.serialJoystick = None self.joystickPatternDetector = Joystick() self.joystickPatternDetector.setOnClicks(self.execute_joystick_action) self.resources = Resources() self.peripheral = PeripheralData() self.ukbCoords = None self.joystickLeftX = 0 self.joystickLeftY = 0 self.communicationProcess = BackgroundProcess(self.communication_loop, parent=self) self.communicationTimer = QtCore.QTimer() self.communicationTimer.setInterval(40) self.communicationTimer.timeout.connect( self.execute_received_board_udp_data) self.init_ui() self.dialog = OverlayDialog(parent=self) self.emptyMessage = Message(None, "", None, None) self.pimMessage = Message(2, self.resources.get("pim_not_inserted"), None, None, _type="info") self.batteryIka10Message = Message( 5, "IKA: " + self.resources.get("battery_10").replace("\\n", "\n"), self.resources.get("ok"), None) self.batteryIka30Message = Message( 6, "IKA: " + self.resources.get("battery_30").replace("\\n", "\n"), self.resources.get("ok"), None) self.batteryUkb10Message = Message( 4, "UKB: " + self.resources.get("battery_10").replace("\\n", "\n"), self.resources.get("ok"), None) self.batteryUkb30Message = Message( 3, "UKB: " + self.resources.get("battery_30").replace("\\n", "\n"), self.resources.get("ok"), None) self.batteryIka10Message.success = self.set_empty_message self.batteryIka30Message.success = self.set_empty_message self.batteryUkb10Message.success = self.set_empty_message self.batteryUkb30Message.success = self.set_empty_message # self.motionDetectionMessage = Message(5, self.resources.get("motion_detected"), # self.resources.get("ok"), None) self.screenShotMessage = Message( 0, self.resources.get("screenshot_taken"), None, None) self.disconnectedMessage = Message(1, self.resources.get("disconnected"), None, None, _type="error") self.config() self.communicationProcess.start() self.communicationTimer.start()
def __init__(self, message, timeout=None, platform=None, error=False, pause=None, progressFn=None, addCloseButton=False): super().__init__() print("message initted", message) self.setWindowModality(QtCore.Qt.ApplicationModal) # self.setWindowFlag(QtCore.Qt.Popup) if addCloseButton: self.setWindowTitle("Bilgi") f = QtCore.Qt.WindowStaysOnTopHint self.setWindowFlags(f) else: self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint) self.isSizeFixed = False self.isOpen = False self.error = error self.resources = Resources() self.layout = QtWidgets.QVBoxLayout() self.messageLabel = QtWidgets.QLabel() self.messageLabel.setText(message) self.messageLabel.setWordWrap(True) self.setMyStyleSheet() self.layout.addWidget(self.messageLabel) if addCloseButton: closeButton = QtWidgets.QPushButton(self.resources.get("close_3")) closeButton.clicked.connect(self.closeThis) self.layout.addWidget(closeButton) self.setLayout(self.layout) if progressFn is not None: self.progress = threading.Timer(interval=1, function=progressFn) self.progress.daemon = True self.progress.start() if pause is not None: self.isOpen = True self.show() time.sleep(float(pause / 1000)) self.closeMessagePopupSc() elif timeout is not None: self.timer = threading.Timer(interval=float(timeout / 1000), function=self.closeMessagePopupSc) self.timer.daemon = True self.timer.start() self.isOpen = True self.show() # else: # self.exec_() if progressFn is not None: progressFn()
def __init__(self, parent=None): super(LoginView, self).__init__(parent=parent) self.loggedIn = False self.resources = Resources() if SysParams.tag == "ukb-7": self.iconContainer = QWidget() self.iconContainer.setContentsMargins(0, 0, 0, 0) layout = QHBoxLayout() layout.setSpacing(0) layout.setContentsMargins(0, 0, 0, 0) self.icon = QLabel() self.icon = PicButton( QPixmap(UKBParams.dirResources + self.iconName)) width = 100 r = 1 / 1 self.icon.setFixedSize(width, int(width * r)) layout.addWidget(self.icon) self.iconContainer.setLayout(layout) # define widgets self.loginUserNameLine = QComboBox() self.loginUserNameLine.addItem(self.resources.get("admin")) self.loginUserNameLine.addItem(self.resources.get("user_2")) self.loginPasswordLine = MyLineEdit() self.loginPasswordLine.setEchoMode(QLineEdit.Password) self.loginPasswordLine.setPlaceholderText( self.resources.get("password")) self.loginPasswordLine.mousePressed = self.update_current_widget self.current_widget = self.loginPasswordLine self.loginNew1PasswordLine = MyLineEdit() self.loginNew1PasswordLine.setEchoMode(QLineEdit.Password) self.loginNew1PasswordLine.setPlaceholderText( self.resources.get("new_password")) self.loginNew1PasswordLine.mousePressed = self.update_current_widget self.loginNew1PasswordLine.setVisible(False) self.loginNew2PasswordLine = MyLineEdit() self.loginNew2PasswordLine.setEchoMode(QLineEdit.Password) self.loginNew2PasswordLine.setPlaceholderText( self.resources.get("new_password_again")) self.loginNew2PasswordLine.mousePressed = self.update_current_widget self.loginNew2PasswordLine.setVisible(False) self.moreOptionsLabel = ClickAbleLabel() self.moreOptionsLabel.setText(self.resources.get("more")) self.moreOptionsLabel.clickedFn = self.open_more_options self.closeLabel = ClickAbleLabel() self.closeLabel.setText(self.resources.get("close_2")) self.closeLabel.setVisible(False) self.coordinateTypeComboBox = QComboBox() self.coordinateTypeComboBox.addItem( self.resources.get("decimal_coord")) self.coordinateTypeComboBox.addItem( self.resources.get("military_coord")) self.disconnectionPolicyComboBox = QComboBox() self.disconnectionPolicyComboBox.addItem( self.resources.get("connection_loss_rule")) self.disconnectionPolicyComboBox.addItem( self.resources.get("if_disconnected_return_home")) self.disconnectionPolicyComboBox.addItem( self.resources.get("if_disconnected_destruct")) self.loginFromSubmitButton = QPushButton(self.resources.get('login')) # self.loginFromSubmitButton.clicked.connect(self.loginFromSubmitButtonOnClick) self.loginInfoBox = QLabel("") # self.loginInfoBox.setFont(QtGui.QFont("Times", 16, QtGui.QFont.Bold)) # keyboard keyboard_layout = QHBoxLayout() keyboard_layout.setSpacing(5) for n, ch in enumerate("0123456789<"): bt = MyButton(ch) bt.effect = ch bt.setOnClick(self.virtual_keyboard) bt.setMaximumWidth(50) keyboard_layout.addWidget(bt) # temp self.loginPasswordLine.setText('123456') # define forms self.loginFormLayoutWidget = QFrame() self.loginFormLayout = QFormLayout(self.loginFormLayoutWidget) zeroLabel = QLabel("") zeroLabel.setFixedSize(0, 20) if SysParams.tag == "ukb-7": self.loginFormLayout.addRow("", self.iconContainer) self.loginFormLayout.addRow("", self.loginUserNameLine) self.loginFormLayout.addRow("", self.loginPasswordLine) self.loginFormLayout.addRow("", self.loginNew1PasswordLine) self.loginFormLayout.addRow("", self.loginNew2PasswordLine) # self.loginFormLayout.addRow("", self.coordinateTypeComboBox) # self.loginFormLayout.addRow("", self.disconnectionPolicyComboBox) self.loginFormLayout.addRow("", self.loginFromSubmitButton) self.loginFormLayout.addRow("", self.closeLabel) self.loginFormLayout.addRow("", self.loginInfoBox) self.loginFormLayout.addRow("", self.moreOptionsLabel) self.loginFormLayout.addRow("", keyboard_layout) # define layout self.layout = QVBoxLayout() # style self.setContentsMargins(50, 5, 50, 0) # left, top, right, bottom self.layout.setSpacing(1) self.loginFormLayout.setContentsMargins(0, 0, 0, 0) # add to layout self.layout.addWidget(self.loginFormLayoutWidget) self.setLayout(self.layout)
def __init__(self, user_permission, parent=None): super().__init__(parent=parent) self.isAnAppRunning = False self.resources = Resources() layout = QtWidgets.QVBoxLayout(self) # layout.set(QtCore.Qt.RightToLeft) # layout.setAlignment(QtCore.Qt.AlignRight) layout.setContentsMargins(10, 10, 10, 10) disk_usage_info_label = QtWidgets.QLabel("") # disk_usage_info_label.setFixedSize(400, 30) disk_progress_bar = DiskProgressBar(label=disk_usage_info_label) # disk_progress_bar.setFixedSize(100, 30) layout2 = QtWidgets.QHBoxLayout() panel_app = self.create_menu_item( "Panel", self.launch_to_panel, UKBParams.dirResources + "dashboard-3-128.png") records_app = self.create_menu_item( "Kayıtlar", self.launch_to_records, UKBParams.dirResources + "film-2-128.png") tile_importer_app = self.create_menu_item( "Harita Yükle", self.launch_to_tile_importer, UKBParams.dirResources + "internet-128.png") # thermal_test_app = self.create_menu_item("Termal Test", self.launch_to_thermal_test, UKBParams.dirResources + "internet-128.png") close_app = self.create_menu_item( "Kapat", self.launch_to_close, UKBParams.dirResources + "power-128.png") info_app = self.create_menu_item( None, self.launch_to_info, UKBParams.dirResources + "info-2-32.png") info_app.setFixedSize(50, 50) # info_app = PicButton(UKBParams.dirResources + "info-2-32.png") # info_app.clicked.connect(self.launch_to_info) layout2.addWidget(panel_app) if user_permission > 0: layout2.addWidget(records_app) if SysParams.tag == "ukb-7": layout2.addWidget(tile_importer_app) # layout2.addWidget(thermal_test_app) layout2.addWidget(close_app) layout2.setSpacing(5) layout2.setContentsMargins(0, 0, 0, 0) self.infoBox = QtWidgets.QLabel("Hazır") self.infoBox.setMaximumHeight(40) self.infoBox.setAlignment(QtCore.Qt.AlignCenter) self.chooseIkaComboBox = QtWidgets.QComboBox() self.chooseIkaComboBox.addItem("Komodo") self.chooseIkaComboBox.addItem("Ejder") self.destructTimeComboBox = QtWidgets.QComboBox() self.destructTimeComboBox.addItem("0") self.destructTimeComboBox.addItem("15") self.destructTimeComboBox.addItem("30") self.destructTimeComboBox.addItem("45") self.destructTimeComboBox.addItem("60") self.coordinateTypeComboBox = QtWidgets.QComboBox() self.coordinateTypeComboBox.addItem( self.resources.get("decimal_coord")) self.coordinateTypeComboBox.addItem( self.resources.get("military_coord")) self.disconnectionPolicyComboBox = QtWidgets.QComboBox() self.disconnectionPolicyComboBox.addItem( self.resources.get("connection_loss_rule")) self.disconnectionPolicyComboBox.addItem( self.resources.get("if_disconnected_return_home")) self.disconnectionPolicyComboBox.addItem( self.resources.get("if_disconnected_destruct").replace( "\\n", "\n")) # self.disconnectionPolicyComboBox.setFixedWidth(100) self.failedHomeActioonPolicyComboBox = QtWidgets.QComboBox() self.failedHomeActioonPolicyComboBox.addItem( self.resources.get("home_fail_rule")) self.failedHomeActioonPolicyComboBox.addItem( self.resources.get("if_return_failed_do_nothing")) self.failedHomeActioonPolicyComboBox.addItem( self.resources.get("if_return_failed_destruct")) # info_app = QtWidgets.QPushButton() # info_app.clicked.connect(self.launch_to_info) layout.setAlignment(QtCore.Qt.AlignCenter) layout.addLayout( self.layout_packer( [info_app, disk_usage_info_label, disk_progress_bar])) layout.addWidget(QtWidgets.QLabel("")) layout.addLayout(layout2) layout.addWidget(QtWidgets.QLabel("")) layout.addWidget(self.infoBox) layout.addWidget(QtWidgets.QLabel("")) layout.addLayout( self.layout_packer( [self.chooseIkaComboBox, self.destructTimeComboBox])) layout.addWidget(QtWidgets.QLabel("")) layout.addLayout( self.layout_packer([ self.coordinateTypeComboBox, self.disconnectionPolicyComboBox ])) layout.addWidget(QtWidgets.QLabel(""))