Browse Source

Only interfaces inside "ui"

master
Julio Biason 16 years ago
parent
commit
0f8c64163c
  1. 104
      mitter
  2. 0
      mitterlib/ui/cmd.py
  3. 0
      mitterlib/ui/helpers/__init__.py
  4. 0
      mitterlib/ui/helpers/console_utils.py
  5. 0
      mitterlib/ui/helpers/notify.py
  6. 0
      mitterlib/ui/helpers/timesince.py
  7. 0
      mitterlib/ui/helpers/utils.py
  8. 0
      mitterlib/ui/mh.py
  9. 0
      mitterlib/ui/pygtk.py
  10. 0
      mitterlib/ui/tty.py

104
mitter

@ -0,0 +1,104 @@
#!/usr/bin/python2.5
# -*- coding: utf-8 -*-
# Mitter, a Maemo client for Twitter.
# Copyright (C) 2007, 2008 Julio Biason
#
# This program 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.
#
# 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, see <http://www.gnu.org/licenses/>.
import time
import urllib
import os
import logging
import warnings
import mitterlib.network as network
from mitterlib.configopt import ConfigOpt
from mitterlib.network import Networks
from mitterlib.ui import Interfaces
log = logging.getLogger('mitter')
def main():
"""Main function."""
# options
options = ConfigOpt()
options.add_group('General', 'General options')
options.add_option('-d', '--debug',
group='General',
option='debug',
action='store_true',
help='Display debugging information.',
default=False,
is_config_option=False)
options.add_option('-i', '--interface',
group='General',
option='interface',
default=None,
metavar='INTERFACE',
help='Interface to be used.')
# Ask networks to add their options
connection = Networks(options)
# Ask interfaces to add their options
interfaces = Interfaces()
interfaces.options(options)
# Parse the command line options and the config file
options()
# start the logging service
if options['General']['debug']:
logging.basicConfig(level=logging.DEBUG)
else:
logging.basicConfig(level=logging.INFO)
log = logging.getLogger('mitter')
# disable the warnings. Interfaces may choose to receive the warnings
# changing the filter to "error"
warnings.simplefilter('ignore')
# select an interface (preferably, the one the user selected in the
# command line)
preferred_interface = options['General']['interface']
log.debug('Config interface: %s', preferred_interface)
if 'interface' in options.conflicts:
preferred_interface = options.conflicts['interface']
log.debug('Command line interface: %s', preferred_interface)
interface = interfaces(preferred_interface)
if interface is None:
log.error('Sorry, no interface could be found for your system')
return
display = interface.Interface(connection, options)
# display the interface (the interface should take care of updating
# itself)
display()
options.save()
if __name__ == '__main__':
main()

0
mitterlib/ui/ui_cmd.py → mitterlib/ui/cmd.py

0
mitterlib/ui/helpers/__init__.py

0
mitterlib/ui/console_utils.py → mitterlib/ui/helpers/console_utils.py

0
mitterlib/ui/notify.py → mitterlib/ui/helpers/notify.py

0
mitterlib/ui/timesince.py → mitterlib/ui/helpers/timesince.py

0
mitterlib/ui/utils.py → mitterlib/ui/helpers/utils.py

0
mitterlib/ui/ui_mh.py → mitterlib/ui/mh.py

0
mitterlib/ui/ui_pygtk.py → mitterlib/ui/pygtk.py

0
mitterlib/ui/ui_tty.py → mitterlib/ui/tty.py

Loading…
Cancel
Save