123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- #!/usr/bin/env python3.5
- # Copyright 2017 Digital
- #
- # This file is part of BeeWatch.
- #
- # BeeWatch 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 3 of the License, or
- # (at your option) any later version.
- #
- # BeeWatch 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 BeeWatch. If not, see <http://www.gnu.org/licenses/>.
- #
- ## Imports
- # Python Libraries
- import argparse
- import gi
- gi.require_version('Gtk', '3.0')
- from gi.repository import Gtk
- from gi.repository import Gdk
- import logging
- import random
- import string
- import sys
- import time
- import traceback
- import yaml
- # add the source dir to the path, python finds the beewatch module.
- sys.path.insert(0,"src")
- # My Libraries
- import beewatch
- import beewatch.gui
- import digilib.gui
- import digilib.misc
- lgui = logging.getLogger(__name__+".gui")
- parser = argparse.ArgumentParser(
- # usage="use this to play",
- description="BeeWatch Client",
- )
- parser.add_argument(
- "host",
- type=str,
- help="hostname/ip address/filename (only if --use-file was specified)"
- )
- parser.add_argument(
- "port",
- type=int,
- default=8054,
- nargs="?",
- help="the port on wich the client will connect to. ignored if --use-file \
- is given"
- )
- parser.add_argument(
- "-d","--debug",
- default=False,
- action="store_true",
- help="enables logging"
- )
- group_af_family = parser.add_mutually_exclusive_group(required=True)
- group_af_family.add_argument(
- "-u","--af-unix",
- dest="af_family",
- # default=False,
- action="store_const",
- const="AF_UNIX",
- help="""use an AF_UNIX socket (a file). can't be used in combination with
- --af-inet."""
- # " will be used \
- # instead of an AF_INET socket (hostname/ip address + port)."
- )
- group_af_family.add_argument(
- "-i","--af_inet",
- default="AF_INET",
- dest="af_family",
- action="store_const",
- const="AF_INET",
- help="""use an AF_INET socket (hostname/ip address + port). can't be used
- with --af-unix"""
- )
- args = parser.parse_args()
- if args.debug:
- digilib.misc.load_files("config/logging.yaml",logging.config.dictConfig)
- win = beewatch.gui.BeeWindow(
- host=args.host,
- port=args.port,
- af_family=args.af_family
- )
- win.start()
- #
|