Example #1
0
 def __init__(self):
     super(Project, self).__init__(parent=None)
     self.fully_qualified_name = ""
     self.modules = []
     self.configurations = utils.OrderedDict()
     self.settings = utils.OrderedDict()
     self.templates = {}
     self._srcdir_map = {}
     self.add_configuration(Configuration("Debug", base=None,
                                          is_debug=True))
     self.add_configuration(
         Configuration("Release", base=None, is_debug=False))
Example #2
0
    def __init__(self, SPGoodies):
        """SPGoodies is a class object that SP sets up and will contain references
        to objects, callback methods and observers
        TODO: add more explaination"""
        self.logger = logging.getLogger("childsplay.quiz_general.Activity")
        self.logger.info("Activity started")
        self.SPG = SPGoodies
        self.lang = self.SPG.get_localesetting()[0][:2]
        self.screen = self.SPG.get_screen()
        self.screenclip = self.SPG.get_screenclip()
        self.blit_pos = self.screenclip.left, self.screenclip.top
        self.logo_pos = (600, 200 + self.blit_pos[1])
        self.theme = self.SPG.get_theme()
        self.orgscreen = pygame.Surface(
            self.screenclip.size)  # we use this to restore the screen
        self.orgscreen.blit(self.screen, (0, 0), self.screenclip)
        self.backgr = self.SPG.get_background()
        # The location of the activities Data dir
        self.my_datadir = os.path.join(self.SPG.get_libdir_path(), 'CPData',
                                       'Quiz_generalData')
        self.quiz_datadir = os.path.join(self.SPG.get_libdir_path(), 'CPData',
                                         'Quizengine_Data')
        # Location of the CPData dir which holds some stuff used by multiple activities
        self.CPdatadir = os.path.join(self.SPG.get_libdir_path(), 'CPData')
        self.rchash = utils.read_rcfile(
            os.path.join(self.my_datadir, 'quiz_general.rc'))
        self.rchash['theme'] = self.theme
        self.rchash['lang'] = self.lang
        self.logger.debug("found rc: %s" % self.rchash)
        p = os.path.join(self.CPdatadir, 'good_%s.png' % self.lang)
        if not os.path.exists(p):
            p = os.path.join(self.CPdatadir, 'thumbs.png')
        self.ThumbsUp = SPSpriteUtils.MySprite(utils.load_image(p))
        # Location of the CPData dir which holds some stuff used by multiple activities
        self.CPdatadir = os.path.join(self.SPG.get_libdir_path(), 'CPData')
        # Location of the alphabet sounds dir
        self.absdir = self.SPG.get_absdir_path()  # alphabet sounds dir
        # You MUST call SPInit BEFORE using any of the SpriteUtils stuff
        # it returns a reference to the special CPGroup
        self.actives = SPSpriteUtils.SPInit(self.screen, self.backgr)

        self.num_questions = int(self.rchash[self.theme]['questions'])
        self.AreWeDT = False
        self.sessionresults = utils.OrderedDict()
        self.sessionresults_raw = utils.OrderedDict()
        self.old_level = None
        self.sessionid = time.time()
        self.act_score = 0
        self.act_cycles = 1
        self.act_mean = 0
        self.levelup = 0
Example #3
0
 def __new__(cls, data, time=None, titles=None, subsystems=None, **kwargs):
     if isinstance(data, ExpectationValueTrajectory):
         array = numpy.asarray(data).reshape((1, -1)).view(cls)
         array.evtrajectories = (data, )
     else:
         array = numpy.array(data, **kwargs).view(cls)
         if titles is None:
             titles = []
         else:
             titles = list(titles)
         titles = titles + [None] * (len(data) - len(titles))
         traj = [None] * len(data)
         for i, col in enumerate(data):
             traj[i] = ExpectationValueTrajectory(col, time, titles[i])
         array.evtrajectories = tuple(traj)
     if time is not None:
         array.time = time
     else:
         array.time = getattr(data, "time", None)
     array.subsystems = utils.OrderedDict()
     if subsystems is not None:
         for key, value in subsystems.iteritems():
             array.subsystems[key] = cls(array[value[0]:value[1]:],
                                         array.time,
                                         array.titles[value[0]:value[1]:],
                                         copy=True)
     return array
Example #4
0
    def _read_data_from_source_(self):
        '''
            The implementation of reading data from a local file. It uses a dialog to get data path

            Overridable: if anyone wants to get data from different source, override this function

        :return: An array of ordered dictionary that contains the data.
        '''
        data = []
        # open file
        srcfile = open(self.get_src_datpath(), errors='ignore')
        srcreader = utils.DictReader(srcfile, delimiter=self.delimiter)

        # assert the file has all the expected fields
        man_log.debug('expected fieldnames: %s' % self.col_defs)

        error_flag = False
        for index, col_name in enumerate(self.col_defs):
            if col_name not in srcreader.fieldnames:
                user_error_log.log_mapping_error(
                    col_name,
                    column_id=index + 1,
                    message="this field missing in data file")
                error_flag = True
                continue

        if error_flag:
            raise self.TemplateError(
                ('expected columns not '
                 'found in source datafile, with fields: %s') %
                (list(srcreader.fieldnames)))

        # load each row with each col's parser
        for rowid, datarow in enumerate(srcreader):
            man_log.info('loading row %s' % rowid)
            man_log.debug('parsing row %s : %s' % (rowid, datarow))

            row = utils.OrderedDict()
            for col in self.col_defs:
                try:
                    # the parser name is defined as "parse_" + col.col_name
                    # e.g, for source_col "subjectID", the parser will be "parse_subjectID"
                    row[col] = self._parse_value_with_corresponding_parser_(
                        datarow[col], col)

                except Exception as e:
                    man_log.debug('Exception while parsing %s: %s' % (col, e))
                    row[col] = self.NoDataError('%s' % e)

            data.append(row)

        return data
Example #5
0
    def __init__(self, SPGoodies):
        """SPGoodies is a class object that SP sets up and will contain references
        to objects, callback methods and observers
        TODO: add more explaination"""
        self.logger = logging.getLogger("childsplay.dltr.Activity")
        self.logger.info("Activity started")
        self.SPG = SPGoodies
        self.scoredisplay = self.SPG.get_scoredisplay()
        self.theme = self.SPG.get_theme()
        self.screen = self.SPG.get_screen()
        self.screenclip = self.SPG.get_screenclip()
        self.blit_pos = self.screenclip.left, self.screenclip.top
        self.orgscreen = pygame.Surface(
            self.screenclip.size)  # we use this to restore the screen
        self.orgscreen.blit(self.screen, (0, 0), self.screenclip)
        self.backgr = self.SPG.get_background()
        # The location of the activities Data dir
        self.my_datadir = os.path.join(self.SPG.get_libdir_path(), 'CPData',
                                       'dltrData')
        # Location of the CPData dir which holds some stuff used by multiple activities
        self.CPdatadir = os.path.join(self.SPG.get_libdir_path(), 'CPData')
        # Location of the alphabet sounds dir
        self.absdir = self.SPG.get_absdir_path()  # alphabet sounds dir
        self.rchash = utils.read_rcfile(
            os.path.join(self.my_datadir, 'dltr.rc'))

        # You MUST call SPInit BEFORE using any of the SpriteUtils stuff
        # it returns a reference to the special CPGroup
        self.actives = SPSpriteUtils.SPInit(self.screen, self.backgr)

        self.runme = True
        self.sessionresults = utils.OrderedDict()
        self.sessionresults_raw = utils.OrderedDict()
        self.backsquare = utils.load_image(
            os.path.join(self.my_datadir, 'background.png'))

        self.sessionid = time.time()
Example #6
0
    def __init__(self, **kwargs):
        ''' calls the super Manager init. then adds specific ss Manager stuff'''
        self.template_fields = utils.OrderedDict()
        self.template_fields['id'] = 'default_id_col'
        self.template_fields['col_name'] = 'default_colname'

        # Col_defs are the columns for the dataf file for both input and output. They are the
        # row of the mapping files
        self.col_defs = []

        self.row_pointer_for_iter = 0
        # ordered list of col objects in the data files

        # The mapping_manager for this specific manager
        self.mapping_manager = None
Example #7
0
 def _get_data(self, target):
     self.logger.debug("Getting data for target %s" % target)
     acthash = utils.OrderedDict()
     orm, session = self.SPG.get_orm('dt_sequence', 'user')
     rows = session.query(orm).filter(orm.target == target).order_by(
         orm.order).all()
     for row in rows:
         hash = {}
         hash['fortune'] = row.fortune
         hash['name'] = row.act_name
         hash['group'] = row.group
         hash['level'] = row.level
         hash['cycles'] = row.cycles
         hash['target'] = row.target
         hash['order'] = row.order
         acthash[row.act_name] = hash
     self.logger.debug("Found data: %s" % acthash)
     return acthash
Example #8
0
    def __init__(self, pos, maxlen=0, length=300, height=2, message='', fsize = 14, border=True, \
                 ttf='arial', fgcol=None, bgcol=None, bold=False, password_mode=False):
        """Text input box with multiple lines. The height of the box is determined
        by the fontsize used times the height. You can get the actual height in pixels by calling
        the "get_height" method.
        message - input prompt
        pos - position to display the box
        maxlen - is the maximum number of input characters.
        length - length of the display in pixels.
        height - height in characters lines, 2 means two lines of text.
        fsize - font size
        border - One pixel border around the box
        ttf - family of fonts
        """
        self.height = height
        self.TEs = utils.OrderedDict()
        self.currentline = 0
        self.maxline = height - 1
        sizey = 0
        tepos = (pos[0] + 1, pos[1] + 1)
        for line in range(height):
            te = TEB_TextEntry(pos=tepos, maxlen=maxlen, \
                            length=length, message=message,\
                            fsize = fsize, border=False, ttf='arial',\
                            fgcol=fgcol, bgcol=fgcol, bold=bold, \
                            password_mode=False)
            te.disconnect_callback()
            te.connect_callback(self._cbf, [KEYDOWN, MOUSEBUTTONDOWN])
            sizey += te.get_sprite_height()
            tepos = (tepos[0], tepos[1] + te.get_sprite_height())
            te.line = line
            self.TEs[line] = te
        sizex = te.get_sprite_width()  # length stays the same for all lines
        self.image = pygame.Surface((sizex + 2, sizey + 2))
        Widget.__init__(self, self.image)
        self.image.fill(self.THEME['textentry_bg_color'])

        y = 0
        for te in self.TEs.values():
            self.image.blit(te.get_surface(), (0, y))
            y += te.get_sprite_height()
        if border:
            pygame.draw.rect(self.image, BLACK, self.rect, 1)
        self.moveto(pos)
Example #9
0
def parse_xml(xml):
    """Parses the whole xml tree into a hash with lists. Each list contains hashes
    with the elelements from a 'activity' element.
    """
    logger = logging.getLogger("childsplay.quiz_general.parse_xml")
    logger.debug("Starting to parse: %s" % xml)

    tree = ElementTree()
    tree.parse(xml)
    xml = {}
    # here we start the parsing
    acts = tree.findall('activity')
    logger.debug("found %s activities in total" % len(acts))
    acthash = utils.OrderedDict()
    for act in acts:
        e = act.find('cycles')
        acthash[act.get('name')] = {'cycles': int(e.text)}
    logger.debug("xml hash:%s" % acthash)
    return acthash
Example #10
0
def statistics(request):
    from django.db.models import Count, Q, Sum
    from datetime import datetime, timedelta
    import json
    import utils as collections
    person = Person.objects.values('pekerjaan').filter(
        pekerjaan__isnull=False).annotate(
            dcount=Count('pekerjaan')).order_by('-dcount')[:6]
    total = Person.objects.all().count()
    suma = 0
    pekerjaan = []
    for p in person:
        from member.models import Pekerjaan
        emp = Pekerjaan.objects.get(pk=p['pekerjaan'])
        pekerjaan.append({
            'label': emp.pekerjaan.title(),
            'value': p['dcount']
        })
        suma = suma + int(p['dcount'])
    sisa = total - suma
    pekerjaan.append({'label': 'Lainnya', 'value': sisa})

    person = Person.objects.values('tema_informasi').filter(
        tema_informasi__isnull=False).annotate(
            dcount=Count('tema_informasi')).order_by('-dcount')[:6]
    informasi = []
    for p in person:
        info = TemaInformasi.objects.get(pk=p['tema_informasi'])
        informasi.append({
            'label': info.tema_informasi.title(),
            'value': p['dcount']
        })

    usia = Usia.objects.all()
    today = datetime.today()
    prsn = []
    for u in usia:
        end = today - timedelta(days=365 * int(u.umur_min))
        start = today - timedelta(days=365 * int(u.umur_max))
        p = Person.objects.filter(tanggal_lahir__gte=start,
                                  tanggal_lahir__lte=end).count()
        prsn.append({'label': u.name, 'value': p})

    goldar = GolonganDarah.objects.all()
    gldrh = []
    for g in goldar:
        p = Person.objects.filter(golongan_darah=g).count()
        gldrh.append({'label': g.golongan_darah, 'value': p})

    start = today - timedelta(days=30)
    smsout = Log.objects.extra({
        'published': "date(date)"
    }).filter(date__gte=start).values('published').annotate(total=Count('id'))
    smsin = Queue.objects.extra({
        'published': "date(date)"
    }).filter(date__gte=start).values('published').annotate(total=Count('id'))
    data = {}
    for out in smsout:
        data[out['published'].strftime("%m/%d")] = {'out': out['total']}
    for sin in smsin:
        try:
            data[sin['published'].strftime("%m/%d")]['in'] = sin['total']
        except:
            data[sin['published'].strftime("%m/%d")] = {'in': sin['total']}
    import time
    tlkmsl = query_operator("TELKOMSEL")
    indst = query_operator("INDOSAT")
    xls = query_operator("XL")
    three = query_operator("THREE")
    axis = query_operator("AXIS")
    lain = query_operator("LAINNYA")
    oprtr = [{
        'label': 'TELKOMSEL',
        'value': tlkmsl
    }, {
        'label': 'INDOSAT',
        'value': indst
    }, {
        'label': 'XL',
        'value': xls
    }, {
        'label': 'THREE',
        'value': three
    }, {
        'label': 'AXIS',
        'value': axis
    }, {
        'label': 'LAINNYA',
        'value': lain
    }]

    most_active = Log.objects.values('persons').exclude(persons=None).annotate(
        dcount=Count('persons')).order_by('-dcount')[:6]
    pma = []
    for pp in most_active:
        if pp['persons']:
            nama = Person.objects.get(id=pp['persons'])
            pma.append({'label': nama.nama_lengkap, 'value': pp['dcount']})

    sms = collections.OrderedDict(sorted(data.items()))

    txt = Log.objects.all()
    xcld = [
        "kita", "tes", "test", "iso", "tak", "wis", "wib.", "bn2013", "atas",
        "mas", "mbak", "simak", "kirim", "sek", "bro", "idul", "fitri", "adha",
        "lahir", "bathin", "bathin", "kesalahan", "tanya", "jawab",
        "smsangkringan", "smskomunitas", "angkringan", "dari", "dr", "ini",
        "itu", "karena", "krn", "bahwa", "bhw", "yang", "yg", "ke", "untuk",
        "utk", "oleh", "saya", "sy", "aku", "anda", "mereka", "mrk",
        "sehingga", "shg", "hingga", "hanya", "cuma", "hny", "satu", "pertama",
        "dua", "kedua", "tiga", "ketiga", "empat", "keempat", "lima", "kelima",
        "enam", "keenam", "tujuh", "ketujuh", "delapan", "kedelapan",
        "sembilan", "kesembilan", "sepuluh", "kesepuluh", "1", "2", "3", "4",
        "5", "6", "7", "8", "9", "0", "seperti", "spt", "bisa", "akan", "mau",
        "biasa", "tujuan", "nanti", "kemarin", "besok", "pagi", "siang",
        "sore", "malam", "mlm", "selamat", "slmt", "ulang", "tahun", "th",
        "thn", "mohon", "maaf", "hari", "hr", "tanggal", "tgl", "jam", "wib",
        "jadilah", "selalu", "kekasih", "terhebat", "seperti", "lagu", "anji",
        "yuk", "aktifkan", "iringnya", "cuma", "rp0", "1", "per3hr", "sms",
        "ketik", "anji", "808", "berlaku", "perpanjangan", "rp.3190", "per7hr",
        "invite", "ulang", "pinku", "yaa", "pin", "mksih", "apa", "siapa",
        "bagaimana", "bgm", "bgmn", "mana", "dimana", "kemana", "cara",
        "terima", "kasih", "terimakasih", "thx", "trmksh", "telah", "tlh",
        "sudah", "sdh", "menjadi", "mjd", "pelanggan", "indosat", "kenalan",
        "tanpa", "batas", "dan", "bonus", "gratis", "nelpon", "telpon",
        "telepon", "telp", "alamat", "60", "menit", "hub", "hubungi", "*955*1",
        "lalu", "ya/ok", "topup", "pulsa", "rp", "rupiah", "berhasil", "via",
        "atm", "bri", "kode", "trx", "1006191302714505", "pulsa", "saat",
        "ini", "menggunakan", "pakai", "memakai", "pakai", "keluar", "masuk",
        "msk", "selesai", "mulai", "indosat", "telkomsel", "telkom", "xl",
        "im3", "nomor", "nomer", "no", "ya", "yes", "memasuki", "masa",
        "tenggang", "isi", "ulang", "hari", "&dapatkan", "dpt", "sms",
        "kesesama", "2hari", "hanya", "diberikan1x", "info", "100.gp471",
        "jangan", "lewatkan", "promo", "ketik", "ya", "919", "gratis", "telp",
        "seharian", "sesama", "cuma", "terakhir", "mau", "punya", "barang",
        "artis", "tablet", "voucher", "belanja", "aktfkan", "iring",
        "di*808*18", "kumpulkan", "poin", "tukar", "hadiah", "pilihanmu",
        "www.indosat.com/iring80818", "pelanggan", "&", "+", "dsb", "dll",
        "harap", "mohon", "minta", "penawaran", "kak", "kok", "asalamualaikum",
        "wrwb", "swt", "otw", "www", "aq", "bapak", "bpk", "ibu", "sdr", "yth",
        "ybs", "akan", "dan", "oleh", "ada", "nek", "ya", "ya?", "kiri",
        "dengan", "kalau", "kalo", "lha", "lah", "kan", "2014", "2013", "2015",
        "ring", "edisi", "lewat", "gang", "pak"
    ]
    tt = {}
    for msg in txt:
        psn = msg.message.split()
        for k in psn:
            if len(k) > 2:
                if k.lower().strip().replace('#', '') not in xcld:
                    try:
                        tt[k] = tt[k] + 1
                    except:
                        tt[k] = 1
    import operator
    sorted_tt = sorted(tt.items(), key=operator.itemgetter(1))
    sorted_tt.reverse()
    cloud_text = sorted_tt[:52]

    return render_to_response("message/statistik.html", {
        "pekerjaan": json.dumps(pekerjaan),
        "informasi": json.dumps(informasi),
        "usia": json.dumps(prsn),
        "golongandarah": json.dumps(gldrh),
        "sms": sms,
        "operator": json.dumps(oprtr),
        "active": json.dumps(pma),
        "cloud": cloud_text
    },
                              context_instance=RequestContext(request))
Example #11
0
 def __init__(self, parent, source_pos):
     super(Module, self).__init__(parent, source_pos)
     self.targets = utils.OrderedDict()
     self.project.modules.append(self)
     self.imports = set()
Example #12
0
 def _clone_into(self, clone):
     clone.source_pos = self.source_pos
     # variables must be copied, but shallow copy is OK for them
     clone.variables = utils.OrderedDict()
     for k, v in self.variables.iteritems():
         clone.variables[k] = copy.copy(v)
Example #13
0
 def __init__(self, parent, source_pos=None):
     self.parent = parent
     self.variables = utils.OrderedDict()
     self.source_pos = source_pos
Example #14
0
    def _read_data_from_source_(self):
        '''
        Follow the api for read data
        :return:
        '''
        data = []

        con = pyodbc.connect("DSN=wtp_data")

        # To test the primary key. The primary key can be familyid and twin or just familyid.
        table_type = self.check_table_type(self.data_table[0], con)
        join_cmd = self.get_join_stmt(self.data_table, table_type)
        cursor = con.cursor()
        cursor.execute(join_cmd)
        desc = cursor.description
        fieldnames = self._get_fieldnames_(desc)

        #import ipdb;ipdb.set_trace();
        # assert the data source has all the source fields defined in the template
        # so that no col_defs will map to nothing in the data source
        man_log.debug('expected fieldnames: %s' % self.col_defs)
        for col_name in self.col_defs:
            if col_name not in fieldnames:
                raise self.TemplateError(
                    ('expected column %s not '
                     'found in source datafile, with fields: %s') %
                    (col_name, list(fieldnames)))

        sql_data = cursor.fetchall()
        # load each row
        for rowid, datarow in enumerate(sql_data):
            man_log.info('loading row %s' % rowid)
            man_log.debug('parsing row %s : %s' % (rowid, datarow))
            row = utils.OrderedDict()
            for col in self.col_defs:
                try:
                    # Find the data position due to the fact that you can only access the data in datarow
                    # with index
                    col_name = col.col_name
                    index = fieldnames.index(col_name)

                    # prepare parser
                    col_parser_name = 'parse_' + str(col)
                    man_log.debug('parsing %s from %s using %s' %
                                  (col, datarow[index], col_parser_name))
                    col_parser = getattr(self, col_parser_name,
                                         self.default_parser)

                    # The empty item in db will be translated into None in python.
                    # Thus, clean the None into ""
                    if str(datarow[index]) == "None":
                        datarow[index] = ""

                    # I parse everything into datarow
                    row[col] = col_parser(str(datarow[index]), col)

                except Exception as e:
                    man_log.debug('Exception while parsing %s: %s' % (col, e))
                    row[col] = self.NoDataError('%s' % e)
            data.append(row)
        con.close()
        return data
Example #15
0
    def __init__(self, actname, milestone, screen):
        self.logger = logging.getLogger("childsplay.SPDebugDialog.Debugscreen")
        self.orgscreen = pygame.display.get_surface()
        self.act_name = actname
        self.currentmilestone = milestone
        self.screen = screen
        self.screenshotpath = self._make_screenshot()

        id_pos = (60, 0)
        txt_0_pos = (60, 450)
        short_descr_pos = (60, 80)
        long_descr_pos = (60, 120)
        milestone_pos = (60, 360)
        component_pos = (60, 400)
        prio_pos = (550, 360)
        assigned_pos = (270, 360)
        name_pos = (270, 400)
        txt_1_pos = (60, 40)
        but_pos = (40, 500)
        fsize12 = 11
        fsize14 = 14

        self.labels = []
        self.buttons = []
        self.entries = []

        self.buthash = utils.OrderedDict()
        self.buthash = {"Cancel":self.on_quit_clicked, \
                        "Mail log":self.on_mail_logfile_clicked,\
                         "Mail scrshot":self.on_mail_scrshot_clicked, \
                         "Mail log+scrshot":self.on_mail_all_clicked,\
                         "Update from GIT":self.on_git_pull_clicked}

        # labels
        self.txt0_lbl = SPWidgets.Label("Your IP, Mac address and the date will be included in the mail.", \
                                txt_0_pos, fsize12, transparent=True)
        self.labels.append(self.txt0_lbl)
        self.txt1_lbl = SPWidgets.Label("Entries marked with a '*' are required fields without it your mail will not be send.", \
                                txt_1_pos, fsize14, bgcol=ORANGERED1)
        self.labels.append(self.txt1_lbl)
        short_descr_lbl = SPWidgets.Label("* Give a short description of the problem (Min 10 chars):", \
                                short_descr_pos, fsize12, transparent=True)
        self.labels.append(short_descr_lbl)
        long_descr_lbl = SPWidgets.Label("* Give a proper description of the issue and steps to reproduce it (Min 50 chars):", \
                               long_descr_pos, fsize12, transparent=True)
        self.labels.append(long_descr_lbl)
        milestone_lbl = SPWidgets.Label("Milestone:",
                                        milestone_pos,
                                        fsize12,
                                        transparent=True)
        self.labels.append(milestone_lbl)
        component_lbl = SPWidgets.Label("Component:",
                                        component_pos,
                                        fsize12,
                                        transparent=True)
        self.labels.append(component_lbl)
        prio_lbl = SPWidgets.Label("Priority:",
                                   prio_pos,
                                   fsize12,
                                   transparent=True)
        self.labels.append(prio_lbl)
        assigned_lbl = SPWidgets.Label("Assigned to:",
                                       assigned_pos,
                                       fsize12,
                                       transparent=True)
        self.labels.append(assigned_lbl)
        name_lbl = SPWidgets.Label("* Your name (Min 2 chars):",
                                   name_pos,
                                   fsize12,
                                   transparent=True)
        self.labels.append(name_lbl)
        # entries
        self.short_descr_te = SPWidgets.TextEntry((short_descr_pos[0] + short_descr_lbl.get_sprite_width()+12, short_descr_pos[1]), \
                                    length=300, fsize=fsize12, border=1)
        self.entries.append(self.short_descr_te)
        self.long_descr_te = SPWidgets.TextEntryBox((long_descr_pos[0]+12, long_descr_pos[1]+24),\
                                    height=10, length=600, fsize=fsize12)
        self.entries += self.long_descr_te.get_actives()
        self.labels.append(self.long_descr_te)
        self.milestone_te = SPWidgets.TextEntry((milestone_pos[0] + milestone_lbl.get_sprite_width()+12, milestone_pos[1]), \
                                    length=100, message=self.currentmilestone, fsize=fsize12, border=1)
        self.entries.append(self.milestone_te)
        self.component_te = SPWidgets.TextEntry((component_pos[0] + component_lbl.get_sprite_width()+12, component_pos[1]), \
                                    length=100, fsize=fsize12, border=1)
        self.entries.append(self.component_te)
        self.prio_te = SPWidgets.TextEntry((prio_pos[0] + prio_lbl.get_sprite_width()+12, prio_pos[1]), \
                                    length=100, message='3', fsize=fsize12, border=1)
        self.entries.append(self.prio_te)
        self.assigned_te = SPWidgets.TextEntry((assigned_pos[0] + assigned_lbl.get_sprite_width()+12, assigned_pos[1]), \
                                    length=150, message='Rene', fsize=fsize12, border=1)
        self.entries.append(self.assigned_te)
        self.name_te = SPWidgets.TextEntry((name_pos[0] + name_lbl.get_sprite_width()+12, name_pos[1]), \
                                    length=150, fsize=fsize12, border=1)
        self.entries.append(self.name_te)
        # buttons
        for label, func in self.buthash.items():
            b = SPWidgets.Button(label,
                                 but_pos,
                                 fsize=16,
                                 padding=8,
                                 name=label)
            b.connect_callback(func, MOUSEBUTTONDOWN, label)
            self.buttons.append(b)
            but_pos = (but_pos[0] + b.get_sprite_width() + 12, but_pos[1])

        self._build_screen()
Example #16
0
 def add_row(self):
     self.data.append(utils.OrderedDict())