mirror of
git://git.psyced.org/git/pypsyc
synced 2024-08-15 03:20:04 +00:00
added new pypsyc as 'mjacob2'
This commit is contained in:
parent
0abc7a0888
commit
9f7c4147c7
46 changed files with 7243 additions and 0 deletions
42
mjacob2/bin/pypsyc
Executable file
42
mjacob2/bin/pypsyc
Executable file
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/env python
|
||||
"""
|
||||
:copyright: 2010 by Manuel Jacob
|
||||
:license: MIT
|
||||
"""
|
||||
import logging
|
||||
logging.basicConfig()
|
||||
from optparse import OptionParser
|
||||
from os import path, mkdir
|
||||
|
||||
|
||||
def main():
|
||||
parser = OptionParser()
|
||||
parser.add_option('-c', '--config', dest='config_dir',
|
||||
default=path.expanduser(path.join('~', '.pypsyc')))
|
||||
options, args = parser.parse_args()
|
||||
|
||||
if not path.exists(options.config_dir):
|
||||
mkdir(options.config_dir)
|
||||
|
||||
accounts_file = path.join(options.config_dir, 'accounts')
|
||||
if not path.exists(accounts_file):
|
||||
with open(accounts_file, 'w') as f:
|
||||
f.write('[]')
|
||||
|
||||
from twisted.internet import gtk2reactor
|
||||
gtk2reactor.install()
|
||||
|
||||
from pypsyc.client.controller import MainController
|
||||
from pypsyc.client.model import Client
|
||||
from pypsyc.client.view import MainView
|
||||
|
||||
model = Client(accounts_file=accounts_file)
|
||||
view = MainView()
|
||||
MainController(model, view)
|
||||
model.load_accounts()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
from twisted.internet import reactor
|
||||
reactor.run()
|
45
mjacob2/bin/pypsycd
Executable file
45
mjacob2/bin/pypsycd
Executable file
|
@ -0,0 +1,45 @@
|
|||
#!/usr/bin/env python
|
||||
"""
|
||||
:copyright: 2010 by Manuel Jacob
|
||||
:license: MIT
|
||||
"""
|
||||
import logging
|
||||
logging.basicConfig()
|
||||
from optparse import OptionParser
|
||||
from os import path, mkdir
|
||||
from socket import gethostname
|
||||
|
||||
from twisted.internet import reactor
|
||||
|
||||
from pypsyc.server import Server
|
||||
|
||||
|
||||
def main():
|
||||
parser = OptionParser()
|
||||
parser.add_option('-d', '--directory', dest='directory',
|
||||
default=path.expanduser(path.join('~', '.pypsycd')),
|
||||
help="directory where the database is stored "
|
||||
"(defaults to ~/.pypsycd)")
|
||||
parser.add_option('-H', '--hostname', dest='hostname',
|
||||
help="hostname of the psyc server")
|
||||
parser.add_option('-i', '--interface', dest='interface', default='',
|
||||
help="interface to bind to (defaults to all)")
|
||||
parser.add_option('-p', '--psyc-port', type='int', default=4404,
|
||||
help="port to listen for incoming psyc connections "
|
||||
"or 0 to disable them (defaults to 4404)")
|
||||
parser.add_option('-w', '--webif-port', type='int', default=8080,
|
||||
help="port of the web interface or 0 to disable it "
|
||||
"(defaults to 8080)")
|
||||
options = parser.parse_args()[0]
|
||||
|
||||
if not path.exists(options.directory):
|
||||
mkdir(options.directory)
|
||||
Server(hostname=options.hostname or gethostname(),
|
||||
interface=options.interface,
|
||||
psyc_port=options.psyc_port,
|
||||
webif_port=options.webif_port,
|
||||
db_file=path.join(options.directory, 'database'))
|
||||
reactor.run()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
Add table
Add a link
Reference in a new issue