# Path: client.py
# class InteractiveClient(Cmd):
#     def precmd(self, line):
#     def postcmd(self, stop, line):
#     def format_prompt(self, username='', character='', zone=''):
#     def logged_in(self):
#     def do_register(self, args, opts=None):
#     def do_login(self, args, opts=None):
#     def login(self, username, password, charnum=None):
#     def do_create_character(self, args, opts=None):
#     def do_update(self, args=None):
#     def format_messages(self):
#     def do_map(self, args):
#     def clean_dict(self, dirty):
#     def format_object(self, objdata):
#     def get_match(self, objname):
#     def do_detail(self, args):
# 
# Path: settings.py
# CLIENT_UPDATE_FREQ = MSPERSEC/CLIENT_NETWORK_FPS
# 
# Path: helpers.py
# def euclidian(x1, y1, x2, y2):
#     from math import sqrt
#     return sqrt(((x1-x2)**2) + ((y1-y2)**2))


import functools
import datetime
import sys
from PySide.QtCore import Qt, SIGNAL, QSize, QTimer, Slot, Signal
from PySide.QtGui import QDialog, QIcon, QLabel, QLineEdit, QPushButton,\
                         QVBoxLayout, QApplication, QTreeWidget, QTreeWidgetItem,\
                         QWidget, QGraphicsScene, QGraphicsView, QGraphicsWidget,\
                         QGraphicsPixmapItem, QPainter
from client import Client
from settings import CLIENT_UPDATE_FREQ
from helpers import euclidian
        from requests.exceptions import ConnectionError

    def select_character(self, char):
        self.character_chosen.emit(char)
        # We're all done here.
        self.accept()


class WorldViewerDebug(QDialog):
    def __init__(self, worldviewer, parent=None):
        global client
        super(WorldViewerDebug, self).__init__(parent)

        self.setWindowTitle("World Viewer Debug")
        pos = QApplication.instance().desktop().availableGeometry()
        self.move(pos.width()/2, 0)

        self.worldviewer = worldviewer

        self.objects_tree = QTreeWidget()
        self.objects_tree.setColumnCount(2)
        self.objects_tree.setHeaderLabels(["ID", "Name", "Location", "Resource", "Last Modified", "Dist to Player"])
        self.objects_tree.setSortingEnabled(True)

        layout = QVBoxLayout()
        for w in (self.objects_tree,):
            layout.addWidget(w)
        self.setLayout(layout)

        self.obj_update_timer = QTimer(self)
        self.connect(self.obj_update_timer, SIGNAL("timeout()"), self.update)

# Path: client.py
# class InteractiveClient(Cmd):
#     def precmd(self, line):
#     def postcmd(self, stop, line):
#     def format_prompt(self, username='', character='', zone=''):
#     def logged_in(self):
#     def do_register(self, args, opts=None):
#     def do_login(self, args, opts=None):
#     def login(self, username, password, charnum=None):
#     def do_create_character(self, args, opts=None):
#     def do_update(self, args=None):
#     def format_messages(self):
#     def do_map(self, args):
#     def clean_dict(self, dirty):
#     def format_object(self, objdata):
#     def get_match(self, objname):
#     def do_detail(self, args):
# 
# Path: settings.py
# CLIENT_UPDATE_FREQ = MSPERSEC/CLIENT_NETWORK_FPS
# 
# Path: helpers.py
# def euclidian(x1, y1, x2, y2):
#     from math import sqrt
#     return sqrt(((x1-x2)**2) + ((y1-y2)**2))


# Path: qtclient.py
import functools
import datetime
import sys
from PySide.QtCore import Qt, SIGNAL, QSize, QTimer, Slot, Signal
from PySide.QtGui import QDialog, QIcon, QLabel, QLineEdit, QPushButton,\
                         QVBoxLayout, QApplication, QTreeWidget, QTreeWidgetItem,\
                         QWidget, QGraphicsScene, QGraphicsView, QGraphicsWidget,\
                         QGraphicsPixmapItem, QPainter
from client import Client
from settings import CLIENT_UPDATE_FREQ
from helpers import euclidian
        from requests.exceptions import ConnectionError


    def select_character(self, char):
        self.character_chosen.emit(char)
        # We're all done here.
        self.accept()


class WorldViewerDebug(QDialog):
    def __init__(self, worldviewer, parent=None):
        global client
        super(WorldViewerDebug, self).__init__(parent)

        self.setWindowTitle("World Viewer Debug")
        pos = QApplication.instance().desktop().availableGeometry()
        self.move(pos.width()/2, 0)

        self.worldviewer = worldviewer

        self.objects_tree = QTreeWidget()
        self.objects_tree.setColumnCount(2)
        self.objects_tree.setHeaderLabels(["ID", "Name", "Location", "Resource", "Last Modified", "Dist to Player"])
        self.objects_tree.setSortingEnabled(True)

        layout = QVBoxLayout()
        for w in (self.objects_tree,):
            layout.addWidget(w)
        self.setLayout(layout)

        self.obj_update_timer = QTimer(self)
        self.connect(self.obj_update_timer, SIGNAL("timeout()"), self.update)

        self.obj_update_timer.start(CLIENT_UPDATE_FREQ)