Revision 4d2b7a46
Added by Vincent Le Goff over 4 years ago
src/client.py | ||
---|---|---|
32 | 32 |
|
33 | 33 |
""" |
34 | 34 |
|
35 |
import os |
|
35 | 36 |
import re |
36 | 37 |
from telnetlib import Telnet, WONT, WILL, ECHO |
37 | 38 |
import threading |
... | ... | |
104 | 105 |
if self.client: |
105 | 106 |
self.client.set_option_negotiation_callback(self.handle_option) |
106 | 107 |
|
108 |
def load_script(self, world): |
|
109 |
"""Load the config.set script.""" |
|
110 |
path = world.path |
|
111 |
path = os.path.join(path, "config.set") |
|
112 |
if os.path.exists(path): |
|
113 |
file = open(path, "r") |
|
114 |
content = file.read() |
|
115 |
file.close() |
|
116 |
|
|
117 |
# Execute the script |
|
118 |
self.sharp_engine.execute(content) |
|
119 |
|
|
107 | 120 |
def link_window(self, window): |
108 | 121 |
"""Link to a window (a GUI object). |
109 | 122 |
|
... | ... | |
116 | 129 |
""" |
117 | 130 |
self.window = window |
118 | 131 |
window.client = self |
132 |
self.load_script(window.world) |
|
119 | 133 |
|
120 | 134 |
def handle_message(self, msg): |
121 | 135 |
"""When the client receives a message.""" |
Also available in: Unified diff
Replace pygame by winsound to play sounds (faster although not portable)