mirror of https://github.com/Syncplay/syncplay
Fixed warning in server enviroment when starting with pygtk installed there with no display
This commit is contained in:
parent
e48a393635
commit
c90ae06d85
|
@ -12,6 +12,7 @@ import codecs
|
|||
import os
|
||||
from string import Template
|
||||
from ircBot import Bot as IRCBot
|
||||
import argparse
|
||||
|
||||
class SyncFactory(Factory):
|
||||
def __init__(self, password = '', motdFilePath = None, httpReplyFilePath= None, ircConfig = None, ircVerbose = False):
|
||||
|
@ -396,3 +397,21 @@ class Watcher(object):
|
|||
if(self._sendStateTimer):
|
||||
self._sendStateTimer.stop()
|
||||
|
||||
class ConfigurationGetter(object):
|
||||
def getConfiguration(self):
|
||||
self._prepareArgParser()
|
||||
self._args = self._argparser.parse_args()
|
||||
if(self._args.port == None):
|
||||
self._args.port = constants.DEFAULT_PORT
|
||||
return self._args
|
||||
|
||||
def _prepareArgParser(self):
|
||||
self._argparser = argparse.ArgumentParser(description=getMessage("en", "server-argument-description"),
|
||||
epilog=getMessage("en", "server-argument-epilog"))
|
||||
self._argparser.add_argument('--port', metavar='port', type=str, nargs='?', help=getMessage("en", "server-port-argument"))
|
||||
self._argparser.add_argument('--password', metavar='password', type=str, nargs='?', help=getMessage("en", "server-password-argument"))
|
||||
self._argparser.add_argument('--isolate-rooms', action='store_true', help=getMessage("en", "server-isolate-room-argument"))
|
||||
self._argparser.add_argument('--motd-file', metavar='file', type=str, nargs='?', help=getMessage("en", "server-motd-argument"))
|
||||
self._argparser.add_argument('--http-reply-file', metavar='file', type=str, nargs='?', help=getMessage("en", "server-http-reply-argument"))
|
||||
self._argparser.add_argument('--irc-verbose', action='store_true', help=getMessage("en", "server-irc-verbose"))
|
||||
self._argparser.add_argument('--irc-config-file', metavar='file', type=str, nargs='?', help=getMessage("en", "server-irc-config"))
|
||||
|
|
|
@ -215,21 +215,3 @@ class ConfigurationGetter(object):
|
|||
self._saveConfig(iniPath)
|
||||
return self._config
|
||||
|
||||
class ServerConfigurationGetter(object):
|
||||
def getConfiguration(self):
|
||||
self._prepareArgParser()
|
||||
self._args = self._argparser.parse_args()
|
||||
if(self._args.port == None):
|
||||
self._args.port = constants.DEFAULT_PORT
|
||||
return self._args
|
||||
|
||||
def _prepareArgParser(self):
|
||||
self._argparser = argparse.ArgumentParser(description=getMessage("en", "server-argument-description"),
|
||||
epilog=getMessage("en", "server-argument-epilog"))
|
||||
self._argparser.add_argument('--port', metavar='port', type=str, nargs='?', help=getMessage("en", "server-port-argument"))
|
||||
self._argparser.add_argument('--password', metavar='password', type=str, nargs='?', help=getMessage("en", "server-password-argument"))
|
||||
self._argparser.add_argument('--isolate-rooms', action='store_true', help=getMessage("en", "server-isolate-room-argument"))
|
||||
self._argparser.add_argument('--motd-file', metavar='file', type=str, nargs='?', help=getMessage("en", "server-motd-argument"))
|
||||
self._argparser.add_argument('--http-reply-file', metavar='file', type=str, nargs='?', help=getMessage("en", "server-http-reply-argument"))
|
||||
self._argparser.add_argument('--irc-verbose', action='store_true', help=getMessage("en", "server-irc-verbose"))
|
||||
self._argparser.add_argument('--irc-config-file', metavar='file', type=str, nargs='?', help=getMessage("en", "server-irc-config"))
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
from twisted.internet import reactor
|
||||
|
||||
from syncplay.server import SyncFactory, SyncIsolatedFactory
|
||||
from syncplay.ui.ConfigurationGetter import ServerConfigurationGetter
|
||||
from syncplay.server import SyncFactory, SyncIsolatedFactory, ConfigurationGetter
|
||||
|
||||
argsGetter = ServerConfigurationGetter()
|
||||
argsGetter = ConfigurationGetter()
|
||||
args = argsGetter.getConfiguration()
|
||||
|
||||
if(not args.isolate_rooms):
|
||||
reactor.listenTCP(int(args.port), SyncFactory(args.password, args.motd_file, args.http_reply_file, args.irc_config_file, args.irc_verbose))
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue