-
Notifications
You must be signed in to change notification settings - Fork 0
/
FluidNexus.py
executable file
·73 lines (63 loc) · 2.66 KB
/
FluidNexus.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env python
# vim: set fileencoding=utf-8
# Copyright (C) 2011, Nicholas Knouf
#
# This file is part of Fluid Nexus
#
# Fluid Nexus 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.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import logging
from optparse import OptionParser
import multiprocessing
import os
import sys
import FluidNexus
from FluidNexus.Cmdline import get_optparser
def start(verbosity = 0, headless = False):
if (verbosity >= 3):
level = logging.DEBUG
elif (verbosity == 2):
level = logging.INFO
elif (verbosity == 1):
level = logging.WARNING
else:
level = logging.ERROR
if (headless):
from PyQt4 import QtCore
from FluidNexus.Networking import BluetoothServerVer3
settings = QtCore.QSettings("fluidnexus.net", "Fluid Nexus")
dataDir = unicode(settings.value("app/dataDir").toString())
name = unicode(settings.value("database/name").toString())
logPath = os.path.join(dataDir, "FluidNexus.log")
databaseDir = os.path.join(dataDir, name)
databaseType = unicode(settings.value("database/type").toString())
btServer = BluetoothServerVer3(databaseDir = dataDir, databaseType = databaseType, logPath = logPath, level = level)
btServer.run()
else:
from PyQt4 import QtGui
from FluidNexus.GUI import FluidNexusDesktop
app = QtGui.QApplication(sys.argv)
fluidNexus = FluidNexusDesktop(level = level)
fluidNexus.show()
sys.exit(app.exec_())
if __name__ == "__main__":
multiprocessing.freeze_support()
# TODO
# Better short option...
# Disabling headless until we're able to figure out how to handle all of the threads, the sleeping, etc.
#parser.add_option("-e", "--headless", dest = "headless", action = "store_true", help = "Whether to run the network services without the GUI")
parser = get_optparser()
(options, args) = parser.parse_args()
#start(verbosity = options.verbosity, headless = options.headless)
start(verbosity = options.verbosity)