def build(self): lb_error = Label(text='Corrupted PPMT File\nCreate new PPMT File, type in terminal:\n' '\n[i]pampamt-create[/i]') lb_error.markup = True return lb_error # project = ProjectPPMT() # project.project = 'Borborema' # project.path_file_ppmt = '/home/patrick/.PampaMT/teste' # # project.save( # arq = '/home/patrick/z16/z16.ppmt' # # # project = read_ppmt_file(arq) # print(project.name) # print(project.path_file_ppmt) # lis_site = project.sites # # print(lis_site[1].name) # # lis_asc = lis_site[1].files_asc # # file = lis_asc[1] # print(file.name) # print(file.processingZ) #make_file_band_asc(bor602a)
def __init__(self, **kwargs): super().__init__(**kwargs) self.orientation = 'vertical' # simple label label1 = Label() label1.text = 'Hello Florian, \nWhat\'s up ?' label1.font_size = 42 label1.bold = True label1.underline = True label1.halign = 'center' label1.color = (0, 1, 0, 1) self.add_widget(label1) # markup text label2 = Label() label2.text = '[size=30]I try to [u]code[/u] a [b]kivy app[/b] ![/size]' label2.halign = 'center' label2.markup = True label2.color = (0, 0, 1, 1) self.add_widget(label2) # unicode text label3 = Label() label3.text = 'هل يمكن تأجير عربات للأطفال؟' label3.font_name = 'DejaVuSans' self.add_widget(label3) # Icons text label4 = Label() label4.font_size = 60 label4.text = '\uF00A' label4.font_name = 'Icons' self.add_widget(label4)
def build(self): lb_error = Label( text='Corrupted PPMT File\nCreate new PPMT File, type in terminal:\n' '\n[i]pampamt-create[/i]') lb_error.markup = True return lb_error # project = ProjectPPMT() # project.project = 'Borborema' # project.path_file_ppmt = '/home/patrick/.PampaMT/teste' # # project.save( # arq = '/home/patrick/z16/z16.ppmt' # # # project = read_ppmt_file(arq) # print(project.name) # print(project.path_file_ppmt) # lis_site = project.sites # # print(lis_site[1].name) # # lis_asc = lis_site[1].files_asc # # file = lis_asc[1] # print(file.name) # print(file.processingZ) #make_file_band_asc(bor602a)
def addHeaders(self,grid): """Funcion que crea todas las celdas para utilizarse como encabezado de los grids""" grid.bind(minimum_height=grid.setter('height'), minimum_width=grid.setter('width')) grid.filas += 1 for col in range(grid.columnas): hdr = GridHeader() hdr.id = "hdr_col{0}".format(col) hdr.width = grid.colSizes[col] clabel = Label() clabel.padding=[5,5] clabel.text='[color=ffffff][b][size=16]{0}[/size][/b][/color]'.format(grid.colHeaders[col]) clabel.halign='center' clabel.valign='middle' clabel.markup=True clabel.text_size=hdr.size hdr.add_widget(clabel) grid.add_widget(hdr)
def getCellLabel(self,fila,columna,Texto,Halign='left',Disabled = False,Size=200,Tipo="txt",Valign='middle'): """Funcion que devuelve una celda completa para manejo de etiquitas""" cell = GridRow() cell.id = "row{0}_col{1}".format(fila,columna) if Tipo == "key": cell.key = Texto cell.width = Size clabel = Label() clabel.id=Tipo clabel.padding=[5,5] clabel.text='[color=000000]{0}[/color]'.format(Texto) clabel.halign=Halign clabel.valign=Valign clabel.disabled=Disabled clabel.markup=True clabel.text_size=cell.size cell.add_widget(clabel) return cell
def gerarTelaDietaAtual(self,*args): if db.getConfig('DietaAlterada') == '1': auxBoxLayout = self.ids['scDietaDia_Buttons_BoxLayout'] auxBoxLayout.bind(minimum_height=auxBoxLayout.setter('height')) auxBoxLayout.clear_widgets() df = db.retDF_DietaAtual() if len(df) != 0: strRefeicao = '#####' for index,row in df.iterrows(): if strRefeicao != row['strRefeicao']: if strRefeicao != '#####': btnRef.criar() auxBoxLayout.add_widget(btnRef) strRefeicao = row['strRefeicao'] # Cria novo widBtnRef btnRef = widBtnRef() btnRef.bind(on_press = partial(btnRef.evento_click,self.manager)) btnRef.iniciar(row['strRefeicao'],db.strHrBr(row['hrHora'])) btnRef.optAppend(row['strOpt']) else: btnRef.optAppend(row['strOpt']) # Ao final deve adicionar o último botão criado if strRefeicao != '#####': btnRef.criar() auxBoxLayout.add_widget(btnRef) db.setConfig('DietaAlterada','0') # Ao alterar a Dieta Atual seja consumindo algo ou etc, preciso refazer essa tela ou mandar excluir o botao else: lbAux = Label(text='Você já consumiu todos os alimentos de hoje!') lbAux.halign = 'center' lbAux.valign = 'middle' lbAux.text_size = 300, None lbAux.font_size = '20sp' lbAux.markup = True lbAux.size_hint_y = None lbAux.height = 100 auxBoxLayout.add_widget(lbAux)
def constroi_mensagem(self): grid = GridLayout(cols=1, size_hint_y=None) grid.bind(minimum_height=grid.setter("height")) for log in self.logs: #print("criando: ", log) log = "[color=008080]" + log + "[/color]" label = Label(text=log) label.size_hint_y = None label.height = self.height * .1 label.markup = True label.font_size = self.fonte_padrao label.text_size = self.width * .9, self.height * 1 label.halign = label.valign = "center" grid.add_widget(label) scroll = ScrollView(size_hint_y=None) scroll.height = self.height * .6 scroll.width = self.width scroll.add_widget(grid) box = GridLayout(cols=1) box.add_widget(scroll) return box
def update_palette(self, x, y, tile, tile_tex, tile_prob): # print('\ntile, tile_tex, tile_prob, tile_prob_tex') # print(tile) # print(tile_prob) self.clear_prob_palette() self.selected_lbl.text = 'Tile: %s\nAt: (%s, %s)' % (tile, x, y) self.lbl_rect.texture = tile_tex # with self.selected_lbl.canvas: for key, val_list in tile_prob.items(): prob = val_list[0] rect_texture = val_list[1] lbl = Label( text='Tile: %s\nProb: %s' % (key, prob), # size_hint=(1, 1) size_hint=(None, None), width=150, height=80) lbl.text_size = lbl.size lbl.markup = True lbl.valign = 'middle' lbl.halign = 'left' with lbl.canvas: lbl_rect_prob = Rectangle(size=self.displayed_tile_size, texture=rect_texture) # lbl_rect_prob.texture.mag_filter = 'nearest' self.bind(pos=partial(self.update_lbl_rect, lbl, lbl_rect_prob), size=partial(self.update_lbl_rect, lbl, lbl_rect_prob)) self.rect_list.append(lbl_rect_prob) self.rect_lbl.append(lbl) self.prob_layout.add_widget(lbl) # self.update_lbl_rect(lbl, lbl_rect_prob) Clock.schedule_once(self.refresh_lbl, 0.01) self.prob_layout.bind(minimum_height=self.prob_layout.setter('height'))
def add_unit(self,num): print('fffffffffff') self.QuestionList.append(BoxLayout()) self.QuestionList[-1].orientation = 'vertical' self.QuestionList[-1].size_hint = (None,None) self.QuestionList[-1].size = self.unitSize self.QuestionList[-1].center_x = self.center_x self.QuestionList[-1].canvas.add(Color(0.5,0.5,0.5)) self.QuestionList[-1].rect = Rectangle(size=self.unitSize,pos=(self.padding[0],self.top-self.padding[1]-len(self.QuestionList)*self.unitheight-(len(self.QuestionList)-1)*self.spacing[1])) self.QuestionList[-1].canvas.add(self.QuestionList[-1].rect) self.QuestionList[-1].opacity = 0.01 self.QuestionList[-1].chagingopacity = 1 self.QuestionList[-1].opacitypace = 2/fps BaseElement = self.BaseSearch(num) CurNum = str(self.QuestionCounter) self.QuestionList[-1].CurNum = self.QuestionCounter self.QuestionList[-1].IdInBase = num self.QuestionCounter += 1 TextNumberLabel = Label() TextNumberLabel.italic = True TextNumberLabel.markup = True TextNumberLabel.text = str("[color=292929]Question [/color]" + CurNum + ".") if BaseElement['isQuest'] else str("Diag") TextNumberLabel.color = (0,0,0,0.2) if BaseElement['isQuest'] else (0.5,0,0.08,0.6) TextNumberLabel.bold = False if BaseElement['isQuest'] else True TextNumberLabel.font_size = Window.size[1]*0.025 self.QuestionList[-1].TextNumberLabel = TextNumberLabel self.QuestionList[-1].add_widget(TextNumberLabel) QuestLabel = Label() QuestLabel.text = self.BaseSearch(num)['text'] if BaseElement['isQuest'] else ' '+self.BaseSearch(num)['text'] QuestLabel.color = (1,1,1,0.9) QuestLabel.font_size = Window.size[1]*0.03 QuestLabel.text_size = (self.unitwidth*0.9,None) QuestLabel.size_hint_y = 0.9 if BaseElement['isQuest'] else 0.1 QuestLabel.bold = False if BaseElement['isQuest'] else True self.QuestionList[-1].QuestLabel = QuestLabel self.QuestionList[-1].add_widget(QuestLabel) JustBlueLine = Widget() JustBlueLine.size_hint_y = 1 if BaseElement['isQuest'] else 1 self.QuestionList[-1].bluelinerect = Rectangle(size=(self.unitwidth*0.98,self.unitheight*0.025),pos=(self.padding[0]+self.unitwidth*0.01,self.QuestionList[-1].rect.pos[1]+self.unitheight*0.28)) JustBlueLine.canvas.add(Color(0.26, 0.63, 0.75)) JustBlueLine.canvas.add(self.QuestionList[-1].bluelinerect) self.QuestionList[-1].JustBlueLine = JustBlueLine self.QuestionList[-1].add_widget(JustBlueLine) FakeWidget = Widget(size_hint_y = 0.5) self.QuestionList[-1].add_widget(FakeWidget) if(BaseElement['isQuest'] == True): CheckBoxGroup=BoxLayout(size_hint_y=1.4) CheckBoxGroup.orientation = "horizontal" CheckBoxGroup.id = "checkgroup" CheckBoxGroup.IdInBase = num CheckBoxYes = CheckBox(group="ilness"+CurNum) CheckBoxYes.bind(active=self.MakeChoice) CheckBoxYes.type = 'yes' CheckBoxNo = CheckBox(group="ilness"+CurNum) CheckBoxNo.bind(active=self.MakeChoice) CheckBoxNo.type = 'no' CheckBoxNotStated = CheckBox(group="ilness"+CurNum) CheckBoxNotStated.bind(active=self.MakeChoice) CheckBoxNotStated.type = 'notstated' CheckBoxFlaseWidget = Widget() CheckBoxGroup.add_widget(CheckBoxYes) CheckBoxGroup.add_widget(Label(text="Yes.",color = (1,1,1,0.6),font_size=Window.size[1]*0.026,bold=True,halign='left')) CheckBoxGroup.add_widget(copy.copy(CheckBoxFlaseWidget)) CheckBoxGroup.add_widget(CheckBoxNo) CheckBoxGroup.add_widget(Label(text="No.",color = (1,1,1,0.6),font_size=Window.size[1]*0.026,bold=True)) CheckBoxGroup.add_widget(copy.copy(CheckBoxFlaseWidget)) CheckBoxGroup.add_widget(CheckBoxNotStated) CheckBoxGroup.add_widget(Label(text="NaN",color = (1,1,1,0.5),font_size=Window.size[1]*0.026,bold=False,size_hint_x=2)) CheckBoxGroup.add_widget(Widget(size_hint_x=0.4)) self.QuestionList[-1].add_widget(CheckBoxGroup) else: a = self.unitSize ButtonGroup = BoxLayout(orientation='horizontal',spacing=self.unitwidth*0.1,padding=(a[0]*0.05,a[1]*0.05,a[0]*0.05,a[1]*0.05)) BackToMenu = Button() BackToMenu.text = "main" BackToMenu.color = (0,0,0,1) BackToMenu.font_size = fullapp.size[1]*0.025 BackToMenu.italic = True BackToMenu.on_press = self.MenuButton.return_menu RestartSearch = Button() RestartSearch.text = 'exit' RestartSearch.color = (0,0,0,1) RestartSearch.font_size = fullapp.size[1]*0.025 RestartSearch.italic = True RestartSearch.on_press = self.restart ButtonGroup.add_widget(BackToMenu) ButtonGroup.add_widget(RestartSearch) self.QuestionList[-1].add_widget(ButtonGroup) self.add_widget(self.QuestionList[-1])
def build(self): self.title = u"Etiket Uygulaması" etiket = Label(text = u"Merhaba\nKivy") etiket.markup = True return etiket
def build(self): etiket = Label(text='[ref=Selam Melike !] Merhaba Fatih ![/ref]') etiket.markup=True etiket.bind(on_ref_press=self.yazdir) return etiket
def draws_lines_Z(x0, y0, dx, dy, fzoom,fzoomy, border, xmin, xmax, ymin, ymax, limx, limy, label_y, scale_y, component): xf = x0 + dx yf = y0 + dy deca_x = range(xmin, xmax + 1) deca_y = range(ymin, ymax, 5) # if limy == 90: # lb_y = [0, 45, 90] # elif limy == 180: # lb_y = [0, 90, 180] lb_y = [-15, -10, -5, 0, 5, 10, 15] #lb_y = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] scale = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000, 100000, 200000, 300000, 400000, 500000, 600000, 700000, 800000, 900000, 1000000, 2000000, 3000000, 4000000, 5000000, 6000000, 7000000, 8000000, 9000000, 10000000, 20000000, 30000000, 40000000, 50000000, 60000000, 70000000, 80000000, 90000000, 100000000] scale_log = [] for i in scale: scale_log.append(log10(i)) scale_log_zoom = [] for i in scale_log: scale_log_zoom.append(i * fzoom) lay = FloatLayout() with lay.canvas: Color(rgba=[0, 0, 0, 1]) Line(points=[x0, y0, xf, y0], width=border) Color(rgba=[0, 0, 0, 1]) Line(points=[x0, y0, x0, yf], width=border) Color(rgba=[0, 0, 0, 1]) Line(points=[xf, y0, xf, yf], width=border) Color(rgba=[0, 0, 0, 1]) Line(points=[x0, yf, xf, yf], width=border) Color(rgba=[0, 0, 0, 1]) Color(rgba=[.2, .2, .2, 1.]) Ellipse(size=[6, 6], pos=[int(((dx / 3) * 2) + x0 + 5), yf + 10]) c = 0 for i in scale_log_zoom: if scale[c] > limx: continue else: Color(rgba=[0., 0., 0., 1.]) Line(points=[i + x0, y0, i + x0, y0 - 5]) c += 1 for i in deca_y: i = int(i * fzoomy) Color(rgba=[0., 0., 0., 1.]) Line(points=[x0 - 5, i + y0, x0, i + y0]) for i in deca_y: i = int(i * fzoomy) Color(rgba=[0., 0., 0., 1.]) Line(points=[xf + 5, i + y0, xf, i + y0]) if scale_y == True: for i in lb_y: lb_phi = Label() lb_phi.color = [0, 0, 0, 1] lb_phi.markup = True lb_phi.text = str(i) lb_phi.size_hint = None, None lb_phi.height = 30 lb_phi.width = 30 if limy == 180: y = (i/2 * fzoomy) + y0 elif limy == 90: y = ((i+15) * fzoomy) + y0 lb_phi.center_x = xf + 25 lb_phi.center_y = y lay.add_widget(lb_phi) for i in deca_x: if deca_x[0] < 0: pos = -deca_x[0] lb = Label() lb.color = [0,0,0,1] lb.markup = True lb.text = '10' + '[sup][size=10]' + str(i) + '[/size][/sup]' lb.size_hint = None, None lb.height = 30 lb.width = 30 x = int((x0 - 15) + ((i + pos) * fzoom)) lb.pos = x, y0 - 30 lay.add_widget(lb) lb_title = Label() lb_title.color = [0, 0, 0, 1.] lb_title.font_size = 17 lb_title.text = 'Z' + component lb_title.size_hint = None, None lb_title.height = 30 lb_title.width = 370 lb_title.center_x = int((lb_title.width/2) + x0) - 25 lb_title.center_y = yf + 15 #lay.add_widget(lb_title) if label_y == True: lb_rho_ohm_meter = LabelRot() lb_rho_ohm_meter.size_hint = None, None lb_rho_ohm_meter.height = 100 lb_rho_ohm_meter.width = 25 lb_rho_ohm_meter.markup =True lb_rho_ohm_meter.italic = True lb_rho_ohm_meter.text = 'φ (graus)' lb_rho_ohm_meter.color = [0., 0., 0., 1.] lb_rho_ohm_meter.center_x = x0 - 40 lb_rho_ohm_meter.center_y = int(y0 + dy/2) lay.add_widget(lb_rho_ohm_meter) bt_rho_xy = PointPlotEX() bt_rho_xy.center_x = int(((dx / 3) + x0) - 50) bt_rho_xy.center_y = yf + 14 lb_rho_xy = Label() lb_rho_xy.size_hint = None, None lb_rho_xy.height = 30 lb_rho_xy.width = 30 lb_rho_xy.center_x = int((dx / 3) + x0 - 20) lb_rho_xy.center_y = yf + 15 lb_rho_xy.markup = True lb_rho_xy.text = 'Re Z[sub][size=15]'+ component +'[/size][/sub]' lb_rho_xy.color = [.2, .2, .2, 1.] lb_rho_xy.font_size = 17 lay.add_widget(bt_rho_xy) lay.add_widget(lb_rho_xy) lb_rho_yx = Label() lb_rho_yx.size_hint = None, None lb_rho_yx.height = 30 lb_rho_yx.width = 30 lb_rho_yx.center_x = int(((dx / 3) * 2) + x0 + 40) lb_rho_yx.center_y = yf + 15 lb_rho_yx.markup = True lb_rho_yx.text = 'Im Z[sub][size=15]'+ component +'[/size][/sub]' lb_rho_yx.color = [.2, .2, .2, 1.] lb_rho_yx.font_size = 17 lay.add_widget(lb_rho_yx) return lay
def draws_lines_rho( x0, y0, dx, dy, fzoom, border, xmin, xmax, ymin, ymax, limx, limy, label_y): xf = x0 + dx yf = y0 + dy deca_x = range(xmin, xmax + 1) deca_y = range(ymin, ymax + 1) scale = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000, 100000, 200000, 300000, 400000, 500000, 600000, 700000, 800000, 900000, 1000000, 2000000, 3000000, 4000000, 5000000, 6000000, 7000000, 8000000, 9000000, 10000000, 20000000, 30000000, 40000000, 50000000, 60000000, 70000000, 80000000, 90000000, 100000000] scale_log = [] for i in scale: scale_log.append(log10(i)) scale_log_zoom = [] for i in scale_log: scale_log_zoom.append(i * fzoom) lay = FloatLayout() with lay.canvas: Color(rgba=[0, 0, 0, 1]) Line(points=[x0, y0, xf, y0], width=border) Color(rgba=[0, 0, 0, 1]) Line(points=[x0, y0, x0, yf], width=border) Color(rgba=[0, 0, 0, 1]) Line(points=[xf, y0, xf, yf], width=border) Color(rgba=[0, 0, 0, 1]) Line(points=[x0, yf, xf, yf], width=border) Color(rgba=[0, 0, 0, 1]) Color(rgba=[.2, .2, .2, 1.]) Ellipse(size=[6, 6], pos=[int(((dx / 3) * 2) + x0 - 23), yf + 7]) c = 0 for i in scale_log_zoom: if scale[c] > limx: continue else: Color(rgba=[0., 0., 0., 1.]) Line(points=[i + x0, y0, i + x0, y0 - 5]) c += 1 c = 0 for i in scale_log_zoom: if scale[c] > limy: continue else: Color(rgba=[0, 0, 0, 1]) Line(points=[x0, i + y0, x0 - 5, i + y0]) c += 1 c = 0 for i in scale_log_zoom: if scale[c] > limy: continue else: Color(rgba=[0, 0, 0, 1]) Line(points=[xf, i + y0, xf + 5, i + y0]) c += 1 for i in deca_y: if deca_y[0] < 0: pos = -deca_y[0] lb = Label() lb.color = [0, 0, 0, 1] lb.markup = True lb.text = '10' + '[sup][size=10]' + str(i) + '[/size][/sup]' lb.size_hint = None, None lb.height = 30 lb.width = 30 y = int((y0 - 20) + ((i + pos) * fzoom)) lb.pos = x0 - 35, y lay.add_widget(lb) for i in deca_x: if deca_x[0] < 0: pos = -deca_x[0] lb = Label() lb.color = [0, 0, 0, 1] lb.markup = True lb.text = '10' + '[sup][size=10]' + str(i) + '[/size][/sup]' lb.size_hint = None, None lb.height = 30 lb.width = 30 x = int((x0 - 20) + ((i + pos) * fzoom)) lb.pos = x + 5, y0 - 35 lay.add_widget(lb) if label_y == True: lb_rho_ohm_meter = LabelRot() lb_rho_ohm_meter.size_hint = None, None lb_rho_ohm_meter.height = 100 lb_rho_ohm_meter.width = 25 lb_rho_ohm_meter.markup = True lb_rho_ohm_meter.italic = True lb_rho_ohm_meter.text = 'ρ (Ω.m)' lb_rho_ohm_meter.color = [0., 0., 0., 1.] lb_rho_ohm_meter.center_x = x0 - 40 lb_rho_ohm_meter.center_y = int(y0 + dy / 2) lay.add_widget(lb_rho_ohm_meter) bt_rho_xy = PointPlotEX() bt_rho_xy.center_x = int(((dx/3) + x0)-20) bt_rho_xy.center_y = yf + 10 lb_rho_xy = Label() lb_rho_xy.size_hint = None, None lb_rho_xy.height = 30 lb_rho_xy.width = 30 lb_rho_xy.center_x = int((dx/3) + x0) lb_rho_xy.center_y = yf + 15 lb_rho_xy.markup = True lb_rho_xy.text = 'ρ[sub]xy[/sub]' lb_rho_xy.color = [.2, .2, .2, 1.] lb_rho_xy.font_size = 23 lay.add_widget(bt_rho_xy) lay.add_widget(lb_rho_xy) lb_rho_yx = Label() lb_rho_yx.size_hint = None, None lb_rho_yx.height = 30 lb_rho_yx.width = 30 lb_rho_yx.center_x = int(((dx / 3) * 2) + x0) lb_rho_yx.center_y = yf + 15 lb_rho_yx.markup = True lb_rho_yx.text = 'ρ[sub]yx[/sub]' lb_rho_yx.color = [.2, .2, .2, 1.] lb_rho_yx.font_size = 23 lay.add_widget(lb_rho_yx) return lay
def create_label(label_text, x, y): label = Label(text=label_text) label.markup = True label.pos_hint = {'center_x': x, 'center_y': y} return label