Ejemplo n.º 1
0
__version__ = "$Rev: 1203 $"

import os

import vmc.common.consts as consts
from vmc.common.encoding import _
from vmc.utils.utilities import dict_reverter

AUTH_OPTS_LIST = [
    unicode(_('Default'), 'utf8'),
    unicode(_('PAP'), 'utf8'),
    unicode(_('CHAP'), 'utf8'),
]

AUTH_OPTS_DICT = {
   unicode(_('Default'), 'utf8') : 'default',
   unicode(_('PAP'), 'utf8') : 'PAP',
   unicode(_('CHAP'), 'utf8') : 'CHAP',
}

AUTH_OPTS_DICT_REV = dict_reverter(AUTH_OPTS_DICT)


def get_profiles_list():
    """
    Returns the names of the profiles at ~/.vmc2/dialer-profiles
    """
    return os.listdir(consts.DIALER_PROFILES)
        
Ejemplo n.º 2
0
from vmc.common.encoding import _
from vmc.utils.utilities import dict_reverter

from vmc.common.hardware._dbus import DeviceListener, DbusComponent
if os.name == 'posix':
    from vmc.common.hardware._unixhardwarereg import HardwareRegistry
elif os.name == 'nt':
    from vmc.common.hardware._winhardwarereg import HardwareRegistry

CONN_OPTS_LIST = [
    unicode(_('GPRS only'), 'utf8'),
    unicode(_('3G only'), 'utf8'),
    unicode(_('GPRS preferred'), 'utf8'),
    unicode(_('3G preferred'), 'utf8'),
]

CONN_OPTS_DICT = {
    unicode(_('GPRS only'), 'utf8'): 'GPRSONLY',
    unicode(_('3G only'), 'utf8'): '3GONLY',
    unicode(_('GPRS preferred'), 'utf8'): 'GPRSPREF',
    unicode(_('3G preferred'), 'utf8'): '3GPREF'
}

CONN_OPTS_DICT_REV = dict_reverter(CONN_OPTS_DICT)

__all__ = [
    "CONN_OPTS_LIST", "CONN_OPTS_LIST_REV", "DbusComponent", "DeviceListener",
    "HardwareRegistry"
]
Ejemplo n.º 3
0
import os

from vmc.common.encoding import _
from vmc.utils.utilities import dict_reverter

from vmc.common.hardware._dbus import DeviceListener, DbusComponent
if os.name == 'posix':
    from vmc.common.hardware._unixhardwarereg import HardwareRegistry
elif os.name == 'nt':
    from vmc.common.hardware._winhardwarereg import HardwareRegistry


CONN_OPTS_LIST = [
   unicode(_('GPRS only'), 'utf8'),
   unicode(_('3G only'), 'utf8'),
   unicode(_('GPRS preferred'), 'utf8'),
   unicode(_('3G preferred'), 'utf8'),
]

CONN_OPTS_DICT = {
   unicode(_('GPRS only'), 'utf8') : 'GPRSONLY',
   unicode(_('3G only'), 'utf8') : '3GONLY',
   unicode(_('GPRS preferred'), 'utf8') : 'GPRSPREF',
   unicode(_('3G preferred'), 'utf8') : '3GPREF'
}

CONN_OPTS_DICT_REV = dict_reverter(CONN_OPTS_DICT)

__all__ = ["CONN_OPTS_LIST", "CONN_OPTS_LIST_REV", "DbusComponent",
           "DeviceListener", "HardwareRegistry"]
Ejemplo n.º 4
0
import gobject

from vmc.gtk import ListStoreModel
from vmc.gtk.models.base import BaseWrapperModel

from vmc.utils.utilities import dict_reverter
from vmc.common.encoding import _

VALIDITY_DICT = {
    _('Maximum time').encode('utf8'): 'maximum',
    _('1 week').encode('utf8'): '1week',
    _('3 days').encode('utf8'): '3days',
    _('1 day').encode('utf8'): '1day',
}

VALIDITY_DICT_REV = dict_reverter(VALIDITY_DICT)

transform_validity = {
    'maximum': timedelta(days=63),
    '1week': timedelta(days=7),
    '3days': timedelta(days=3),
    '1day': timedelta(days=1),
}


class PreferencesModel(BaseWrapperModel):
    """Model for the preferences window"""
    def __init__(self, wrapper):
        super(PreferencesModel, self).__init__(wrapper)

Ejemplo n.º 5
0
"""

__version__ = "$Rev: 1172 $"

from vmc.gtk import Controller
from vmc.utils.utilities import dict_reverter

TV_DICT = {
    0: 'inbox_treeview',
    1: 'inbox_treeview',
    2: 'drafts_treeview',
    3: 'sent_treeview',
    4: 'contacts_treeview'
}

TV_DICT_REV = dict_reverter(TV_DICT)


class WidgetController(Controller):
    """I maintain a list of widgets"""
    def __init__(self, model):
        super(WidgetController, self).__init__(model)
        self._widgets = []

    def hide_widgets(self):
        """Hides all the widgets that we're weeping track of"""
        for widget in self._widgets:
            try:
                widget.close()
            except:
                pass
import gobject

from vmc.gtk import ListStoreModel
from vmc.gtk.models.base import BaseWrapperModel

from vmc.utils.utilities import dict_reverter
from vmc.common.encoding import _

VALIDITY_DICT = {
     _('Maximum time').encode('utf8') : 'maximum',
     _('1 week').encode('utf8') : '1week',
     _('3 days').encode('utf8') : '3days',
     _('1 day').encode('utf8') : '1day',
}

VALIDITY_DICT_REV = dict_reverter(VALIDITY_DICT)

transform_validity = {
    'maximum' : timedelta(days=63),
    '1week' : timedelta(days=7),
    '3days' : timedelta(days=3),
    '1day' : timedelta(days=1),
}
    
class PreferencesModel(BaseWrapperModel):
    """Model for the preferences window"""
    
    def __init__(self, wrapper):
        super(PreferencesModel, self).__init__(wrapper)

class SMSCListStoreModel(ListStoreModel):
Ejemplo n.º 7
0
"""

__version__ = "$Rev: 1203 $"

import os

import vmc.common.consts as consts
from vmc.common.encoding import _
from vmc.utils.utilities import dict_reverter

AUTH_OPTS_LIST = [
    unicode(_('Default'), 'utf8'),
    unicode(_('PAP'), 'utf8'),
    unicode(_('CHAP'), 'utf8'),
]

AUTH_OPTS_DICT = {
    unicode(_('Default'), 'utf8'): 'default',
    unicode(_('PAP'), 'utf8'): 'PAP',
    unicode(_('CHAP'), 'utf8'): 'CHAP',
}

AUTH_OPTS_DICT_REV = dict_reverter(AUTH_OPTS_DICT)


def get_profiles_list():
    """
    Returns the names of the profiles at ~/.vmc2/dialer-profiles
    """
    return os.listdir(consts.DIALER_PROFILES)
Ejemplo n.º 8
0
"""
Base classes for Controllers
"""

__version__ = "$Rev: 1172 $"

from vmc.gtk import Controller
from vmc.utils.utilities import dict_reverter

TV_DICT = {0 : 'inbox_treeview',
           1 : 'inbox_treeview',
           2 : 'drafts_treeview',
           3 : 'sent_treeview',
           4 : 'contacts_treeview'}

TV_DICT_REV = dict_reverter(TV_DICT)

class WidgetController(Controller):
    """I maintain a list of widgets"""
    def __init__(self, model):
        super(WidgetController, self).__init__(model)
        self._widgets = []
    
    def hide_widgets(self):
        """Hides all the widgets that we're weeping track of"""
        for widget in self._widgets:
            try:
                widget.close()
            except:
                pass