def press1023(self): if self.ids.tenSeven.state == 'normal': if self.ids.tenTwentyThree.state == 'normal': self.ids.tenTwentyThree.state = 'down' db.updateOnScene(self.badge, True) else: self.ids.tenTwentyThree.state = 'normal' db.updateOnScene(self.badge, False)
def press108(self): print('Press 10-8') self.ids.tenSeven.state = "down" if self.ids.tenEight.state != "down" else "normal" if self.ids.tenEight.state == 'down': updateAvailability(self.badge, 0) else: db.updateOnScene(self.badge, False) updateAvailability(self.badge, 1)
def press23(self): if self.ids.onScene.state == "normal": if self.state == True: self.ids.onScene.state = "down" else: addNow(self.ids.badgeNum.text) db.updateOnScene(int(self.ids.badgeNum.text), True) else: db.updateOnScene(int(self.ids.badgeNum.text), False) updateAvailability(int(self.ids.badgeNum.text), self.state)
def press108(self): if self.ids.tenEight.state != "down": self.state = True db.updateOnScene(int(self.ids.badgeNum.text), False) self.ids.onScene.state = "down" self.ids.tenSeven.state = "down" else: self.ids.tenSeven.state = "normal" self.state = False updateAvailability(int(self.ids.badgeNum.text), self.state)
def checkOnline(): time.sleep(.25) print("starting thread") # Run while dispatcher screen is running while globals.dispRunning is True: # Build database information for all on duty officers cursor = db.getCursor() cursor.execute("select * from officer where on_duty = True") checkOffline( ) # Check to see if any officers previously online have gone offline # Cycle through all the online officers for row in cursor: create = True # If True at the end, we will create new officer # If length of online officers is 0, we do not need to check if all status', can assume offline prior if len(globals.onlineOfficers) is 0: # Build the officer cur = [ int(row["officer_id"]), str(row["last_name"]), bool(row["status"]), bool(row["on_duty"]) ] curOff = classes.officer(cur) globals.screens[2].ids.ob.putOfficerIn( curOff.id ) # Run disp screens add officer to screen function globals.onlineOfficers.append(curOff) # If the list of online officers is not 0 (Online officers prior to current loop) else: # Run through all officers for off in globals.onlineOfficers: # If the officer was previously online prior to loop, update their status if row["officer_id"] == int(off.id): off.active = row["status"] off.onScene = row["on_scene"] # Update their buttons globals.screens[2].ids.ob.getOfficer( row["officer_id"]).change23Button(row["on_scene"]) globals.screens[2].ids.ob.getOfficer( row["officer_id"]).changeStatusButton( row["status"]) if off.active is True: db.setCallInactive(db.getCurCall( row["officer_id"])) globals.screens[2].ids.ob.getOfficer( row["officer_id"]).change23Button(False) db.updateOnScene(row["officer_id"], False) # No need to create this officer, they were previously online create = False # If we are creating a new officer, new one came online, build officer much like if list was 0 if create is True: cur = [ int(row["officer_id"]), str(row["last_name"]), bool(row["status"]), bool(row["on_duty"]) ] curOff = classes.officer(cur) globals.screens[2].ids.ob.putOfficerIn(curOff.id) globals.onlineOfficers.append(curOff) cursor.close() time.sleep(.25) print("stopping thread")
def sendCall(self): self.state = False self.changeStatusButton(False) updateAvailability(int(self.ids.badgeNum.text), self.state) db.updateOnScene(int(self.ids.badgeNum.text), False)