[Pykafe-commits] SF.net SVN: pykafe: [153] trunk/pykafe/server
Status: Pre-Alpha
Brought to you by:
jnmbk
|
From: <jn...@us...> - 2008-01-27 08:32:00
|
Revision: 153
http://pykafe.svn.sourceforge.net/pykafe/?rev=153&view=rev
Author: jnmbk
Date: 2008-01-27 00:32:05 -0800 (Sun, 27 Jan 2008)
Log Message:
-----------
add GPL things and begin server
Modified Paths:
--------------
trunk/pykafe/server/main.py
trunk/pykafe/server/mainwindow_server.py
trunk/pykafe/server/tcpserver.py
Added Paths:
-----------
trunk/pykafe/server/defaultsettings.py
Added: trunk/pykafe/server/defaultsettings.py
===================================================================
--- trunk/pykafe/server/defaultsettings.py (rev 0)
+++ trunk/pykafe/server/defaultsettings.py 2008-01-27 08:32:05 UTC (rev 153)
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under GPL v2
+# Copyright 2008, Ugur Cetin
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option)
+# any later version.
+#
+# Please read the COPYING file.
+#
+
+"""A nice place to put default settings"""
+
+from PyQt4 import QtCore
+
+defaultsettings = \
+{
+ "server/port":QtCore.QVariant(23105),
+}
Modified: trunk/pykafe/server/main.py
===================================================================
--- trunk/pykafe/server/main.py 2008-01-26 20:15:05 UTC (rev 152)
+++ trunk/pykafe/server/main.py 2008-01-27 08:32:05 UTC (rev 153)
@@ -1,5 +1,16 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
+#
+# Licensed under GPL v2
+# Copyright 2008, Ugur Cetin
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option)
+# any later version.
+#
+# Please read the COPYING file.
+#
"""PyKafe server main module """
Modified: trunk/pykafe/server/mainwindow_server.py
===================================================================
--- trunk/pykafe/server/mainwindow_server.py 2008-01-26 20:15:05 UTC (rev 152)
+++ trunk/pykafe/server/mainwindow_server.py 2008-01-27 08:32:05 UTC (rev 153)
@@ -1,5 +1,16 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
+#
+# Licensed under GPL v2
+# Copyright 2008, Ugur Cetin
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option)
+# any later version.
+#
+# Please read the COPYING file.
+#
from PyQt4 import QtCore
from PyQt4 import QtGui
Modified: trunk/pykafe/server/tcpserver.py
===================================================================
--- trunk/pykafe/server/tcpserver.py 2008-01-26 20:15:05 UTC (rev 152)
+++ trunk/pykafe/server/tcpserver.py 2008-01-27 08:32:05 UTC (rev 153)
@@ -1,8 +1,38 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
+#
+# Licensed under GPL v2
+# Copyright 2008, Ugur Cetin
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option)
+# any later version.
+#
+# Please read the COPYING file.
+#
+"""Server module"""
+
+from PyQt4 import QtCore
+from PyQt4 import QtGui
from PyQt4 import QtNetwork
+from defaultsettings import defaultsettings
+
class TcpServer(QtNetwork.QTcpServer):
def __init__(self, parent = None):
QtNetwork.QTcpServer.__init__(self, parent)
+ self.mainWindow = parent
+
+ settings = QtCore.QSettings()
+
+ if not self.listen(QtNetwork.QHostAddress(QtNetwork.QHostAddress.Any),
+ settings.value("server/port", defaultsettings["server/port"]).toInt()[0]):
+ QtGui.QMessageBox.critical(self.parent(),
+ QtGui.QApplication.translate("TcpServer", "Connection Error"),
+ QtGui.QApplication.translate("TcpServer", "Unable to start server: %1").arg(self.errorString()))
+
+ def incomingConnection(self, socketDescriptor):
+ # this is called when someone tries to connect
+ pass
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|