summaryrefslogtreecommitdiff
path: root/src/client.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/client.py')
-rw-r--r--src/client.py40
1 files changed, 12 insertions, 28 deletions
diff --git a/src/client.py b/src/client.py
index dfc31f3c..3e6d4fef 100644
--- a/src/client.py
+++ b/src/client.py
@@ -17,6 +17,10 @@
# You should have received a copy of the GNU General Public License
# along with Poezio. If not, see <http://www.gnu.org/licenses/>.
+"""
+Starting point of poezio. Launches both the Connection and Gui
+"""
+
import sys
# disable any printout (this would mess the display)
@@ -26,46 +30,26 @@ sys.stderr = open('errors', 'w')
from connection import Connection
from multiuserchat import MultiUserChat
from config import config
-from handler import Handler
from gui import Gui
from curses import initscr
-import curses
-import threading
from common import exception_handler
import signal
-signal.signal(signal.SIGINT, signal.SIG_IGN)
+signal.signal(signal.SIGINT, signal.SIG_IGN) # ignore ctrl-c
sys.excepthook = exception_handler
-class Client(object):
- """
- Main class
- Just read some configuration and instantiate the classes
- """
- def __init__(self):
- self.handler = Handler()
-
- self.resource = config.get('resource', 'poezio')
- self.server = config.get('server', 'louiz.org')
- self.connection = Connection(self.server, self.resource)
- self.connection.start()
- self.stdscr = initscr()
- self.gui = Gui(self.stdscr, MultiUserChat(self.connection.client))
-
- def launch(self):
- """
- launch the gui
- """
- self.gui.main_loop(self.stdscr)
-
def main():
"""
main function
"""
- client = Client()
- client.launch()
- sys.exit()
+ resource = config.get('resource', 'poezio')
+ server = config.get('server', 'louiz.org')
+ connection = Connection(server, resource)
+ connection.start()
+ stdscr = initscr()
+ gui = Gui(stdscr, MultiUserChat(connection.client))
+ gui.main_loop(stdscr)
if __name__ == '__main__':
main()