Skip to content

Commit c654ca8

Browse files
committed
Mid Adding Dojo Mode Dojo Mode Disabled in Config File.
1 parent 8782a9a commit c654ca8

File tree

7 files changed

+38
-31
lines changed

7 files changed

+38
-31
lines changed

Frames/MobTimerController.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def remove_title_bar(self):
160160
container.master.overrideredirect(1)
161161

162162
def set_always_on_top(self):
163-
return
163+
164164
for container in self.containers:
165165
container.master.wm_attributes("-topmost", True)
166166
if PlatformUtility.platform_is_mac():
@@ -170,7 +170,7 @@ def set_always_on_top(self):
170170
container.master.focus_force()
171171

172172
def set_full_screen_always_on_top(self):
173-
return
173+
174174
self.set_always_on_top()
175175
self.remove_title_bar()
176176
self.disable_resizing()

Frames/ScreenBlockerFrame.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ def mobber_list_change_callback(self, mobber_list, driver_index, navigator_index
3535
for index in range(0, mobber_list.__len__()):
3636
tags = ()
3737
name = mobber_list[index]
38-
if self.controller.settings_manager.get_dojo_enabled:
38+
if self.controller.settings_manager.get_dojo_enabled():
3939
if self.controller.dojo_manager.station_drivers.__contains__(name):
4040
name += " <= {}".format(self.controller.dojo_manager.station_drivers[name])
4141
else:
4242
if index == driver_index:
43-
tags = (TAGNAME_CURRENT_MOBBER)
43+
tags = TAGNAME_CURRENT_MOBBER
4444
name += " <= Current"
4545
if index == navigator_index:
4646
name += " <= Next"

Infrastructure/CountdownManager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def __init__(self, root_tk_app):
88
self.minutes = 0
99
self.seconds = 0
1010
self.time_change_callbacks = []
11-
self.count_down_total = datetime.timedelta(minutes=10, seconds=0)
11+
self.count_down_total = datetime.timedelta(days=-1, minutes=0, seconds=0)
1212

1313
self.root_tk_app = root_tk_app
1414
self.refresh_timer()

Infrastructure/DojoManager.py

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
import _thread
22
import random
33
import uuid
4-
54
import paho.mqtt.publish as mqtt_pub
65
import paho.mqtt.client as mqtt
76
import json
87

9-
MOBBER_LIST = "MobberList"
8+
TOPIC_MOBBER_LIST = "MobberList"
109

11-
TIME_CHANGE = "TimeChange"
10+
TOPIC_TIME_CHANGE = "TimeChange"
1211

13-
SAY_HELLO = "SayHello"
12+
TOPIC_SAY_HELLO = "SayHello"
1413

15-
START_TIMER = "StartTimer"
14+
TOPIC_START_TIMER = "StartTimer"
1615

1716

1817
class DojoManager(object):
@@ -24,12 +23,11 @@ def __init__(self, controller):
2423
self.mobber_change_increment = 0
2524
self.session_id = uuid.uuid4().__str__()
2625

27-
2826
self.switch_dictionary = {
29-
MOBBER_LIST: self.sub_mobber_list,
30-
TIME_CHANGE: self.sub_time_change,
31-
SAY_HELLO: self.sub_say_hello,
32-
START_TIMER: self.sub_start_timer,
27+
TOPIC_MOBBER_LIST: self.sub_mobber_list,
28+
TOPIC_TIME_CHANGE: self.sub_time_change,
29+
TOPIC_SAY_HELLO: self.sub_say_hello,
30+
TOPIC_START_TIMER: self.sub_start_timer,
3331
}
3432
self.station_drivers = {}
3533
self.other_stations = []
@@ -42,15 +40,22 @@ def __init__(self, controller):
4240
self.dojo_topic_root = self.controller.settings_manager.get_dojo_topic_root()
4341
self.controller.mobber_manager.subscribe_to_mobber_list_change(self.publish_mobber_list_changes)
4442
self.controller.time_options_manager.subscribe_to_timechange(self.publish_time_change)
43+
self.controller.countdown_manager.subscribe_to_time_changes(self.publish_countdown_change)
4544
self.subscribe_to_time_change()
4645
self.say_hello()
4746

4847
def say_hello(self):
49-
topic = self.generate_topic(SAY_HELLO)
48+
topic = self.generate_topic(TOPIC_SAY_HELLO)
49+
self.publish(topic, "")
50+
51+
def publish_countdown_change(self, negative_if_time_expired, minutes, seconds, origin_station_name=None):
52+
if negative_if_time_expired < 0: return
53+
print("publish_countdown_change" , minutes, seconds)
54+
topic = self.generate_topic(TOPIC_START_TIMER)
5055
self.publish(topic, "")
5156

5257
def publish_time_change(self, time_string, minutes, seconds, origin_station_name=None):
53-
topic = self.generate_topic(TIME_CHANGE)
58+
topic = self.generate_topic(TOPIC_TIME_CHANGE)
5459
station_name = self.dojo_mob_station_name
5560
station_uuid = self.dojo_station_uuid
5661
if origin_station_name is not None:
@@ -65,7 +70,7 @@ def publish_time_change(self, time_string, minutes, seconds, origin_station_name
6570
self.publish(topic, payload)
6671

6772
def publish_mobber_list_changes(self, mobber_list, driver_index, next_driver_index):
68-
topic = self.generate_topic(MOBBER_LIST)
73+
topic = self.generate_topic(TOPIC_MOBBER_LIST)
6974
payload_object = {
7075
"driver_index": driver_index,
7176
"next_driver_index": next_driver_index,
@@ -94,23 +99,24 @@ def on_message(self, client, userdata, msg):
9499
station_uuid = topic_parts[2]
95100
station_name = topic_parts[3]
96101
message_type = topic_parts[4]
97-
print("on_message",msg.topic,"station_uuid",station_uuid)
98-
self.switch_statement_dictionary_trick(station_uuid,station_name, message_type, msg.payload)
102+
print("on_message", msg.topic, "station_uuid", station_uuid)
103+
self.switch_statement_dictionary_trick(station_uuid, station_name, message_type, msg.payload)
99104

100-
def switch_statement_dictionary_trick(self, station_uuid,station_name, message_type, payload):
101-
self.switch_dictionary[message_type](station_uuid,station_name, message_type, payload)
105+
def switch_statement_dictionary_trick(self, station_uuid, station_name, message_type, payload):
106+
self.switch_dictionary[message_type](station_uuid, station_name, message_type, payload)
102107

103-
def sub_mobber_list(self, station_uuid,station_name, message_type, payload):
108+
def sub_mobber_list(self, station_uuid, station_name, message_type, payload):
104109
if not station_uuid == self.dojo_station_uuid:
105110
payload_dictionary = json.loads(payload.decode("utf-8"))
106111
mobber_list = payload_dictionary["mobber_list"]
107-
print("sub_mobber_list",mobber_list)
112+
print("sub_mobber_list", mobber_list)
108113
self.controller.mobber_manager.set_mobber_list(mobber_list)
109114

110115
def generate_topic(self, message_type):
111-
topic = "{}/{}/{}/{}/{}".format(self.dojo_topic_root, self.dojo_session_id,self.dojo_station_uuid, self.dojo_mob_station_name,
112-
message_type)
113-
print("generate_topic",topic)
116+
topic = "{}/{}/{}/{}/{}".format(self.dojo_topic_root, self.dojo_session_id, self.dojo_station_uuid,
117+
self.dojo_mob_station_name,
118+
message_type)
119+
print("generate_topic", topic)
114120
return topic
115121

116122
def sub_time_change(self, station_uuid, station_name, message_type, payload):
@@ -124,11 +130,11 @@ def sub_time_change(self, station_uuid, station_name, message_type, payload):
124130
self.controller.time_options_manager.minutes == minutes and self.controller.time_options_manager.seconds == seconds):
125131
self.controller.time_options_manager.set_countdown_time(minutes, seconds, origin_station_name)
126132

127-
def sub_say_hello(self, station_uuid,station_name, message_type, payload):
133+
def sub_say_hello(self, station_uuid, station_name, message_type, payload):
128134
if not station_uuid == self.dojo_station_uuid:
129135
if not self.other_stations.__contains__(station_name):
130136
self.other_stations.append(station_name)
131-
topic = self.generate_topic(SAY_HELLO)
137+
topic = self.generate_topic(TOPIC_SAY_HELLO)
132138
self.publish(topic, "")
133139

134140
def sub_start_timer(self, station_uuid, station_name, message_type, payload):
@@ -141,4 +147,3 @@ def subscribe_to_dojo(self):
141147
client.on_message = self.on_message
142148
client.connect(self.dojo_broker, self.dojo_port, 60)
143149
client.loop_forever()
144-

Infrastructure/Sessions/6d45f552-e434-11e5-b958-20c9d042e8c0

Whitespace-only changes.

MobTimer.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ extension seconds = 30
3232
extension count = 1
3333

3434
[CODE DOJO]
35-
enable dojo mode = True
35+
enable dojo mode = False
3636
broker = localhost
3737
port = 1883
3838
mob station name = NewName

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Mob Programming Timer – Python
22
# [Download Now](https://github.com/MobProgramming/MobTimer.Python/releases)
3+
## How to install and basic use video
4+
[![MobTimer Install and Tutorial Video](http://img.youtube.com/vi/GxMP8SI6v0k/0.jpg)](http://www.youtube.com/watch?v=GxMP8SI6v0k)
35
## What is Mob Programming?
46
All the brilliant people working on the same thing, at the same time, in the same space, and on the same computer. Find out more at the [Mob Programming site]( http://mobprogramming.org/).
57

0 commit comments

Comments
 (0)