Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Commit [r10] Maximize Restore History

Changed directory structure: getting it ready for Distutils. Small

bugfix when closing server.

ardovm 2008-04-26

added /trunk/src/custom-burner-server
added /trunk/src/custom_burner/server/burner_manager.py
added /trunk/src/custom_burner/__init__.py
added /trunk/src/custom-burner-client
added /trunk/src/custom_burner/server/burner.py
added /trunk/src/custom_burner/server/__init__.py
removed /trunk/src/server
copied /trunk/src/server.py -> /trunk/src/custom_burner/server/main.py
copied /trunk/src/burner.py -> /trunk/src/custom_burner/burner.py
/trunk/src/custom-burner-server Diff Switch to side-by-side view
Loading...
/trunk/src/custom_burner/server/burner_manager.py Diff Switch to side-by-side view
Loading...
/trunk/src/custom_burner/__init__.py Diff Switch to side-by-side view
Loading...
/trunk/src/custom-burner-client Diff Switch to side-by-side view
Loading...
/trunk/src/custom_burner/server/burner.py Diff Switch to side-by-side view
Loading...
/trunk/src/custom_burner/server/__init__.py Diff Switch to side-by-side view
Loading...
/trunk/src/server
File was removed.
/trunk/src/server.py to /trunk/src/custom_burner/server/main.py
--- a/trunk/src/server.py
+++ b/trunk/src/custom_burner/server/main.py
@@ -32,10 +32,10 @@
 import socket
 import optparse
 import common
-from server.user_interface import *
-from server.network import *
-from server.burner import *
-from server.burner_manager import *
+from user_interface import *
+from network import *
+from burner import *
+from burner_manager import *
 
 class CustomBurnerServer:
     """A server."""
@@ -66,7 +66,7 @@
                          ("localhost", self.port))
         self.tcpServer = TCPServer(("localhost", self.port),
                                    RequestHandler)
-        self.ui = UserInterface(burnerManager)
+        self.ui = UserInterface(BurnerManager.instance())
         self.listener = NetworkServerThread(self.tcpServer, self)
 
     def live(self):
@@ -75,38 +75,38 @@
         self.ui.live()
         self.quitting = True
         self.listener.join()
-        burnerManager.close()
+        BurnerManager.instance().close()
 
 
 
 ############
-logging.basicConfig(level=logging.DEBUG,
-                    format='%(asctime)s %(name)-18s %(levelname)-8s %(message)s',
-                    datefmt='%d %b %Y %H:%M:%S')
+def ServerMain():
+    """Main"""
+    logging.basicConfig(level=logging.DEBUG,
+                        format='%(asctime)s %(name)-18s %(levelname)-8s %(message)s',
+                        datefmt='%d %b %Y %H:%M:%S')
 
-# Cmd-line arguments
-parser = optparse.OptionParser()
-# Default values
-parser.set_defaults(directory=".",
-                    port=1234)
-parser.add_option("-d", "--dir", dest="directory",
-                  help="specifies the directory containing the isos")
-parser.add_option("-p", "--port", dest="port", type="int",
-                  help="specifies the TCP port for listening")
-(opts, args) = parser.parse_args()
+    # Cmd-line arguments
+    parser = optparse.OptionParser()
+    # Default values
+    parser.set_defaults(directory=".",
+                        port=1234)
+    parser.add_option("-d", "--dir", dest="directory",
+                      help="specifies the directory containing the isos")
+    parser.add_option("-p", "--port", dest="port", type="int",
+                      help="specifies the TCP port for listening")
+    (opts, args) = parser.parse_args()
 
-if len(args) > 0:
-    # We don't want cmdline arguments
-    parser.print_help()
-    sys.exit(-1)
+    if len(args) > 0:
+        # We don't want cmdline arguments
+        parser.print_help()
+        sys.exit(-1)
 
+    try:
+        srv = CustomBurnerServer(opts.directory, opts.port)
+    except socket.error, e:
+        # This may occur during server start
+        sys.stderr.write("Socket error: %s\n" % str(e))
+        sys.exit(-1)
 
-burnerManager = BurnerManager.instance()
-try:
-    srv = CustomBurnerServer(opts.directory, opts.port)
-except socket.error, e:
-    # This may occur during server start
-    sys.stderr.write("Socket error: %s\n" % str(e))
-    sys.exit(-1)
-
-srv.live()
+    srv.live()
/trunk/src/burner.py to /trunk/src/custom_burner/burner.py
--- a/trunk/src/burner.py
+++ b/trunk/src/custom_burner/burner.py
@@ -1,7 +1,6 @@
-#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
-"""Custom Burner client
+"""Custom Burner client main module
 Copyright 2008 Arrigo Marchiori
 This program is distributed under the terms of the GNU General Public
 License, as specified in the COPYING file.
@@ -268,48 +267,51 @@
 
 
 ############
-logging.basicConfig(level=logging.DEBUG,
-                    format='%(asctime)s %(name)-18s %(levelname)-8s %(message)s',
-                    datefmt='%d %b %Y %H:%M:%S')
-
-
-# Cmd-line arguments
-parser = optparse.OptionParser()
-# Default values
-parser.set_defaults(name="Toaster",
-                    command="wodim driveropts=burnfree -data %s",
-                    server="127.0.0.1",
-                    directory=".",
-                    port=1235,
-                    serverport=1234)
-parser.add_option("-n", "--name", dest="name", help="sets the burner name")
-parser.add_option("-d", "--dir", dest="directory",
-                  help="specifies the directory containing the isos")
-parser.add_option("-c", "--cmd", dest="command",
-                  help="specifies the command to burn an iso named %s")
-parser.add_option("-p", "--port", dest="port", type="int",
-                  help="specifies the TCP port for listening")
-parser.add_option("-s", "--server", dest="server",
-                  help="specifies the hostname or IP address of the server")
-parser.add_option("-t", "--serverport", dest="serverport", type="int",
-                  help="specifies the server'sTCP port")
-(opts, args) = parser.parse_args()
-
-if len(args) > 0:
-    # We don't want cmdline arguments
-    parser.print_help()
-    sys.exit(-1)
-
-try:
-    burner = CustomBurnerClient(opts.name, opts.directory, opts.command,
-                                opts.port, opts.server, opts.serverport)
-except socket.error, e:
-    # This may occur during server start
-    sys.stderr.write("Socket error: %s\n" % str(e))
-    sys.exit(-1)
-
-try:
-    burner.live()
-except KeyboardInterrupt:
-    # User killed this application, but the server is still running.
-    burner.sayGoodbye()
+def BurnerMain():
+    """Main"""
+    global burner
+    logging.basicConfig(level=logging.DEBUG,
+                        format='%(asctime)s %(name)-18s %(levelname)-8s %(message)s',
+                        datefmt='%d %b %Y %H:%M:%S')
+
+
+    # Cmd-line arguments
+    parser = optparse.OptionParser()
+    # Default values
+    parser.set_defaults(name="Toaster",
+                        command="wodim driveropts=burnfree -data %s",
+                        server="127.0.0.1",
+                        directory=".",
+                        port=1235,
+                        serverport=1234)
+    parser.add_option("-n", "--name", dest="name", help="sets the burner name")
+    parser.add_option("-d", "--dir", dest="directory",
+                      help="specifies the directory containing the isos")
+    parser.add_option("-c", "--cmd", dest="command",
+                      help="specifies the command to burn an iso named %s")
+    parser.add_option("-p", "--port", dest="port", type="int",
+                      help="specifies the TCP port for listening")
+    parser.add_option("-s", "--server", dest="server",
+                      help="specifies the hostname or IP address of the server")
+    parser.add_option("-t", "--serverport", dest="serverport", type="int",
+                      help="specifies the server'sTCP port")
+    (opts, args) = parser.parse_args()
+
+    if len(args) > 0:
+        # We don't want cmdline arguments
+        parser.print_help()
+        sys.exit(-1)
+
+    try:
+        burner = CustomBurnerClient(opts.name, opts.directory, opts.command,
+                                    opts.port, opts.server, opts.serverport)
+    except socket.error, e:
+        # This may occur during server start
+        sys.stderr.write("Socket error: %s\n" % str(e))
+        sys.exit(-1)
+
+    try:
+        burner.live()
+    except KeyboardInterrupt:
+        # User killed this application, but the server is still running.
+        burner.sayGoodbye()