Skip to content

Commit 9dfea4b

Browse files
committed
rename QTSettings to AwQtSettings and add aw-server-rust
1 parent a974e2c commit 9dfea4b

File tree

2 files changed

+12
-21
lines changed

2 files changed

+12
-21
lines changed

aw_qt/config.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,25 @@
55

66
default_settings = {
77
"possible_modules": json.dumps(["aw-server",
8+
"aw-server-rust",
89
"aw-watcher-afk",
910
"aw-watcher-window", ]),
10-
"autostart_modules": json.dumps(["aw-server",
11-
"aw-watcher-afk",
12-
"aw-watcher-window", ]),
13-
}
14-
default_testing_settings = {
15-
"possible_modules": json.dumps(["aw-server",
16-
"aw-watcher-afk",
17-
"aw-watcher-window", ]),
18-
"autostart_modules": json.dumps(["aw-server",
11+
"autostart_modules": json.dumps(["aw-server-rust",
12+
"aw-server",
1913
"aw-watcher-afk",
2014
"aw-watcher-window", ]),
2115
}
2216

2317
default_config = ConfigParser()
2418
default_config['aw-qt'] = default_settings
25-
default_config['aw-qt-testing'] = default_testing_settings
19+
# Currently there's no reason to make them differ
20+
default_config['aw-qt-testing'] = default_settings
2621
qt_config = load_config("aw-qt", default_config)
2722

2823

29-
class QTSettings:
24+
class AwQtSettings:
3025
def __init__(self, testing: bool):
3126
config_section = qt_config["aw-qt" if not testing else "aw-qt-testing"]
3227

33-
# TODO: Resolved available modules automatically.
34-
# TODO: Filter away all modules not available on system
3528
self.possible_modules = json.loads(config_section["possible_modules"])
3629
self.autostart_modules = json.loads(config_section["autostart_modules"])

aw_qt/manager.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import aw_core
99

10-
from .config import QTSettings
10+
from .config import AwQtSettings
1111

1212
logger = logging.getLogger(__name__)
1313

@@ -129,22 +129,20 @@ def read_log(self) -> str:
129129

130130
class Manager:
131131
def __init__(self, testing: bool = False) -> None:
132-
self.settings = QTSettings(testing)
132+
self.settings = AwQtSettings(testing)
133133
self.modules = {}
134134
for name in self.settings.possible_modules:
135135
if _locate_executable(name):
136136
self.modules[name] = Module(name, testing=testing)
137137
else:
138-
print("Module '{}' not found".format(name))
138+
logger.warning("Module '{}' not found".format(name))
139139

140140
def get_unexpected_stops(self):
141-
return list(filter(lambda x: x.started and not x.is_alive(), self.modules.values()))
141+
return list(filter(lambda x: x.started and not x.is_alive(), self.modules))
142142

143143
def start(self, module_name):
144-
if module_name in self.modules.keys():
144+
if module_name in self.modules:
145145
self.modules[module_name].start()
146-
else:
147-
logger.error("Unable to start module '{}': No such module".format(module_name))
148146

149147
def autostart(self, autostart_modules):
150148

@@ -163,7 +161,7 @@ def autostart(self, autostart_modules):
163161
self.start(module_name)
164162

165163
def stop_all(self):
166-
for module in filter(lambda m: m.is_alive(), self.modules.values()):
164+
for module in filter(lambda m: m.is_alive(), self.modules):
167165
module.stop()
168166

169167

0 commit comments

Comments
 (0)