コード例 #1
0
behaves according to them can be found in the 'web' submodule of this module.

"""

import collections
import os
import socket

import lcg
import pytis.data as pd
import pytis.presentation as pp
import pytis.util as pu
from pytis.presentation import Field, VGroup, Binding, Action, CodebookSpec, computer
import config

_ = pu.translations('pytis-defs')

ASC = pd.ASCENDENT
DESC = pd.DESCENDANT
ALWAYS = pp.Editable.ALWAYS
ONCE = pp.Editable.ONCE
NEVER = pp.Editable.NEVER


def nextval(seq):
    def conn_spec():
        return config.dbconnection

    counter = pd.DBCounterDefault(seq, conn_spec)
    return lambda transaction=None: counter.next(transaction=transaction)
コード例 #2
0
ファイル: event.py プロジェクト: cerha/pytis
  výhodně využít háček ve funkci 'pytis.util.log()'.

"""

import sys
import _thread
import time

import wx
import wx.aui

import pytis.form
from pytis.util import DEBUG, OPERATIONAL, format_traceback, log, translations


_ = translations('pytis-wx')


class UserBreakException(Exception):
    """Výjimka vyvolávaná při přerušení zpracování události.

    Tato výjimka je používána jednoúčelově pro signalizaci přerušení zpracování
    události uživatelem.

    """
    def __init__(self, *args):
        super(UserBreakException, self).__init__(*args)
        pytis.form.message(_("Stopped..."), beep_=True)


_current_event = None
コード例 #3
0
ファイル: access.py プロジェクト: brailcom/pytis
Everything what is needed to define and handle access permissions to the data
objects is put here.  The set of allowed access rights is defined in the
'Permission' class.  The access rights checking mechanism is implemented in the
class 'AcessRights'.  Access to data objects is regulated in the
'RestrictedData' class.

Access rights violation is signalized exclusively using the
'DataAccessException' class.

"""

from pytis.util import EVENT, log, remove_duplicates, some, translations, xtuple
from data import Data, EQ, MemData, Row
from types_ import sval

_ = translations('pytis-data')


class Permission:
    """Enumerator of permission constants.

    Not all the constants here make sense for all data objects.  For instance,
    it makes no sense to specify 'DELETE' permission for a table column, or the
    user commands will mostly use 'CALL' permission.

    """

    VIEW = 'VIEW'
    """Right to view the contents."""
    INSERT = 'INSERT'
    """Right to insert new records."""
コード例 #4
0
ファイル: access.py プロジェクト: nicLucian/pytis
Everything what is needed to define and handle access permissions to the data
objects is put here.  The set of allowed access rights is defined in the
'Permission' class.  The access rights checking mechanism is implemented in the
class 'AcessRights'.  Access to data objects is regulated in the
'RestrictedData' class.

Access rights violation is signalized exclusively using the
'DataAccessException' class.

"""

from pytis.util import EVENT, log, remove_duplicates, some, translations, xtuple
from data import Data, EQ, MemData, Row
from types_ import sval

_ = translations('pytis-data')


class Permission:
    """Enumerator of permission constants.

    Not all the constants here make sense for all data objects.  For instance,
    it makes no sense to specify 'DELETE' permission for a table column, or the
    user commands will mostly use 'CALL' permission.

    """

    VIEW = 'VIEW'
    """Right to view the contents."""
    INSERT = 'INSERT'
    """Right to insert new records."""
コード例 #5
0
# 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 copy

import pytis.data
import pytis.extensions
from pytis.presentation import Specification, Field, Binding
from pytis.util import rsa_encrypt, translations
from pytis.dbdefs import db_pytis_crypto

_ = translations('pytis')

class NewAdminPasswd(Specification):
    public = True

    data_cls = pytis.data.RestrictedMemData
    title = _(u"Změna administrátorského hesla")

    def fields(self):
        return (
            Field('old_password', _(u'Stávající heslo'), width=20,
                  type=pytis.data.Password, md5=False, verify=False),
            Field('new_password', _(u'Nové heslo'), width=20,
                  type=pytis.data.Password, maxlen=32, minlen=8, md5=False,
                  strength=self._check_strength),
        )
コード例 #6
0
# 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.

from __future__ import unicode_literals

import lcg
import datetime
from pytis.output import UMm, PAGE_WIDTH, PAGE_HEIGHT, PAGE_LANDSCAPE_MODE, PAGE_TOP_MARGIN, \
    PAGE_BOTTOM_MARGIN, PAGE_LEFT_MARGIN, PAGE_RIGHT_MARGIN, HGroup, VGroup, \
    HSpace, f_smaller, PageNumber, PrintSpecification
from pytis.util import translations

_ = translations('pytis-demo')


class ProductPage(PrintSpecification):
    def page_layout(self):
        return {
            PAGE_WIDTH: UMm(210),
            PAGE_HEIGHT: UMm(297),
            PAGE_LANDSCAPE_MODE: False,
            PAGE_TOP_MARGIN: UMm(10),
            PAGE_BOTTOM_MARGIN: UMm(10),
            PAGE_LEFT_MARGIN: UMm(10),
            PAGE_RIGHT_MARGIN: UMm(10),
        }

    def body(self):
コード例 #7
0
ファイル: configuration.py プロジェクト: brailcom/pytis
Celá konfigurace je definována instancí třídy 'Configuration', dokumentace
v této třídě poví více.

"""

import getopt
import imp
import os
import stat
import string
import sys
import time

from pytis.util import Resolver, translations
# The translation domain is pytis-wx because it is only needed with wx applications.
_ = translations('pytis-wx')


class _OrderedDefinitionClass(type):
    """A metaclass allowing us to find out the order of class definitions."""
    _class_counter = 0
    def __init__(cls, name, bases, dict):
        cls._class_definition_order = _OrderedDefinitionClass._class_counter
        _OrderedDefinitionClass._class_counter += 1


class Configuration(object):
    """Definition of configuration and its particular options."""

    class Option(object):
        """Specification of a configuration option (variable).
コード例 #8
0
ファイル: cms.py プロジェクト: nicLucian/pytis
behaves according to them can be found in the 'web' submodule of this module.

"""

import collections
import os
import socket

import lcg
import pytis.data as pd
import pytis.presentation as pp
import pytis.util as pu
from pytis.presentation import Field, VGroup, Binding, Action, CodebookSpec, computer
import config

_ = pu.translations('pytis-defs')

ASC = pd.ASCENDENT
DESC = pd.DESCENDANT
ALWAYS = pp.Editable.ALWAYS
ONCE = pp.Editable.ONCE
NEVER = pp.Editable.NEVER

def nextval(seq):
    def conn_spec():
        return config.dbconnection
    counter = pd.DBCounterDefault(seq, conn_spec)
    return lambda transaction=None: counter.next(transaction=transaction)


class _TreeOrder(pp.PrettyFoldable, pd.String):
コード例 #9
0
ファイル: configuration.py プロジェクト: nicLucian/pytis
v této třídě poví více.

"""

import getopt
import imp
import os
import stat
import string
import sys
import time

from pytis.util import Resolver, translations

# The translation domain is pytis-wx because it is only needed with wx applications.
_ = translations("pytis-wx")


class _OrderedDefinitionClass(type):
    """A metaclass allowing us to find out the order of class definitions."""

    _class_counter = 0

    def __init__(cls, name, bases, dict):
        cls._class_definition_order = _OrderedDefinitionClass._class_counter
        _OrderedDefinitionClass._class_counter += 1


class Configuration(object):
    """Definition of configuration and its particular options."""