Example #1
0
# Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
#

import gripe
import gripe.db
import gripe.smtp
import gripe.pgsql
import grumble.model
import grumble.property
import grumble.reference
import gripe.auth
import gripe.managedobject
import gripe.role
import gripe.url

logger = gripe.get_logger("grizzle")


@grumble.model.flat
class UserGroup(grumble.model.Model, gripe.auth.AbstractUserGroup):
    _flat = True
    group = grumble.property.TextProperty(is_key=True)
    description = grumble.property.TextProperty(is_label=True)
    has_roles = grumble.property.ListProperty()

    def gid(self):
        return self.group

    objid = gid

    def objectlabel(self):
Example #2
0
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

import array
import collections
import struct
import threading

from commons import format_list

import gripe

_logger = gripe.get_logger(__name__)


class Message(object):
    class ID:
        INVALID = 0x00

        # Configuration messages
        UNASSIGN_CHANNEL = 0x41
        ASSIGN_CHANNEL = 0x42
        SET_CHANNEL_ID = 0x51
        SET_CHANNEL_PERIOD = 0x43
        SET_CHANNEL_SEARCH_TIMEOUT = 0x44
        SET_CHANNEL_RF_FREQ = 0x45
        SET_NETWORK_KEY = 0x46
        SET_TRANSMIT_POWER = 0x47
Example #3
0
from PyQt5.QtCore import QObject
from PyQt5.QtCore import pyqtSignal

import gripe
import gripe.db
import grizzle
import grumble.property
import grumpy.bg.bg
import grumpy.bg.job
import sweattrails.qt.imports
import sweattrails.qt.mainwindow
import sweattrails.qt.session.details
import sweattrails.session
import sweattrails.withings

logger = gripe.get_logger(__name__)


class NotAuthenticatedException(gripe.AuthException):
    def __str__(self):
        return "Not authenticated"


class SweatTrailsCore:
    refresh = pyqtSignal(QObject, name="refresh")

    def __init__(self):
        self.user = self.user_id = None
        save = False
        if "qtapp" not in gripe.Config:
            gripe.Config.qtapp = {}
Example #4
0
__author__ = "jan"
__date__ = "$24-Feb-2013 11:13:48 AM$"

import gripe
import gripe.db
import gripe.smtp
import gripe.pgsql
import grumble.model
import grumble.property
import grumble.reference
import gripe.auth
import gripe.role

logger = gripe.get_logger("grizzle")

@grumble.model.flat
class UserGroup(grumble.model.Model, gripe.auth.AbstractUserGroup):
    _flat = True
    group = grumble.property.TextProperty(is_key = True)
    description = grumble.property.TextProperty(is_label = True)
    has_roles = grumble.property.ListProperty()

    def gid(self):
        return self.group

    def _explicit_roles(self):
        return set(self.has_roles)

class GroupManager():
    def get(self, gid):
        ret = UserGroup.get_by_key(gid)
Example #5
0
from datetime import time

import Util
from Athlete import CriticalPowerDef
from Model.Config import SessionType
from Session import GeoData
from Session import Interval
from Session import SessionFile
from Session import Waypoint
from xml_processor import XMLProcessor

import gripe
import grumble.geopt
import sweattrails.session

logger = gripe.get_logger("sweattrails.datamodel.session")

class Policy():
    DONT_UPDATE, UPDATE_WITH_OFFSET, UPDATE_ABSOLUTE = range(3)

    def __init__(self, distance, duration):
        self.distance = distance
        self.duration = duration

class CritPower():
    def __init__(self, waypoints, cpdef):
        self.waypoints = waypoints
        self.cpdef = cpdef
        self.duration = cpdef.duration
        self.start = 0
        self.power = None
Example #6
0
'''
Created on Feb 13, 2014

@author: jan
'''

import gripe

logger = gripe.get_logger("gripe")

class ObjectExists(gripe.AuthException):
    def __init__(self, cls, idval):
        self._cls = cls
        self._idval = idval
        logger.debug(str(self))

    def __str__(self):
        return "%s with ID %s already exists" % (self._cls.__name__, self._idval)

_temp_mo_meta = None
_temp_mo_map = None

class ManagedObjectMetaClass(type):
    def __init__(cls, name, bases, dct):
        global _temp_mo_meta, _temp_mo_map
        cls._meta = _temp_mo_meta if _temp_mo_meta is not None else { } 
        cls._map = _temp_mo_map if _temp_mo_map is not None else { } 
        _temp_mo_meta = None
        _temp_mo_map = None
        cls._objects = {}
        cls._accessors = {}
Example #7
0
from Athlete import CriticalPowerDef
from Session import CriticalPower
from Session import Session
from Session import Interval
from Session import SessionFile
from Session import Waypoint
from Session import GeoData
from Model.Config import SessionType
from xml_processor import XMLProcessor
import Util

import gripe
import grumble.geopt
import sweattrails.session

logger = gripe.get_logger("sweattrails.session")

class Policy():
    DONT_UPDATE, UPDATE_WITH_OFFSET, UPDATE_ABSOLUTE = range(3)

    def __init__(self, distance, duration):
        self.distance = distance
        self.duration = duration

class CritPower():
    def __init__(self, waypoints, cpdef):
        self.waypoints = waypoints
        self.cpdef = cpdef
        self.duration = cpdef.duration
        self.start = 0
        self.power = None
Example #8
0
# 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 gripe

logger = gripe.get_logger("gripe")

class ObjectExists(gripe.AuthException):
    def __init__(self, cls, idval):
        self._cls = cls
        self._idval = idval
        logger.debug(str(self))

    def __str__(self):
        return "%s with ID %s already exists" % (self._cls.__name__, self._idval)

_temp_mo_meta = None
_temp_mo_map = None

class ManagedObjectMetaClass(type):
    def __init__(cls, name, bases, dct):
Example #9
0
import datetime
import gripe
import gripe.db
import gripe.smtp
import grumble

import threading
import Queue

logger = gripe.get_logger("grudge")

# TODO:
#  If action returns status, and this is the first action in the list to do so,
#    apply status
#

class Worker(object):
    def __init__(self, q, ix):
        self._ix = ix
        self._queue = q

    def __call__(self):
        while True:
            action = self._queue.get()
            assert action, "Message Queue takes sequence as action"
            a = action[0]
            if a:
                args = action[1] if len(action) > 1 else []
                args = args or []
                kwargs = action[2] if len(action) > 2 else {}
                kwargs = kwargs or {}
Example #10
0
#
# 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 datetime
import gripe
import gripe.db
import gripe.smtp
import grumble

import threading
import Queue

logger = gripe.get_logger("grudge")

# TODO:
#  If action returns status, and this is the first action in the list to do so,
#    apply status
#


class Worker(object):
    def __init__(self, q, ix):
        self._ix = ix
        self._queue = q

    def __call__(self):
        while True:
            action = self._queue.get()