get textinput value inside MDApp - class

Good afternoon, I have a great difficulty, which seems easy to solve.
The question is as follows:
I have my TextInput created this way, in my :
KV = """
WindowManager:
ScreenLogin:
ScreenPaginaInicial:
PaginaEntradas:
id: data_scr
ScreenInicioProducao:
PaginaMovInterna:
PaginaMovExterna:
PaginaEditarArtigoOriginalInterna:
PaginaEditarArtigoBob1Interna:
PaginaEditarArtigoBob2Interna:
PaginaEditarArtigoBob3Interna:
PaginaEditarArtigoOriginalExterna:
PaginaEditarArtigoBob1Externa:
PaginaEditarArtigoBob2Externa:
PaginaEditarArtigoBob3Externa:
<ScreenLogin>:
name: "ScreenLogin"
FloatLayout:
canvas.before:
Color:
rgba: 1, 1, 1, 1
Rectangle:
pos: self.pos
size: self.size
Image:
size_hint: .3, .3
pos_hint: {"center_x": .5, "center_y": .75}
source: 'G:\O meu disco\Gestao_Stocks\logo.png'
GridLayout:
cols: 1
spacing: 5
size_hint: .7, .37
pos_hint: {"center_x": .5, "center_y": .3}
Label:
text: "Utilizador"
size_hint_x: .3
text_size: self.size
halign: 'center'
valign: 'middle'
color: 0,0,0,1
allow_copy: True
TextInput:
id: utilizador
multiline: False
halign: 'center'
focus: True
size_hint_x: 5
"""
class PLASbritos(MDApp):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.data_tables = None
def build(self):
return Builder.load_string(KV)
def login(self):
utilizador = self.root.ids.utilizador.text
print(utilizador)
password = '1'
#Implemesta regras para acesso. Exemplo:
if utilizador == '1' and password == '1':
.........................................
.........................................
........................................
else:
........................................
I would like to access the utilizador through the textinput(id: utilizador)
error:
AttributeError: 'super' object has no attribute '__getattr__'
I've already looked for all the information on google, I've seen videos on youtube, and I can't find anything. What seemed to be the easiest, is extremely difficult, if someone can help me, I am extremely grateful.
I thank you in advance for any attention you can give me.
I've already looked for all the information on google, inclusive in stackoverflow similiar problems, I've seen videos on youtube, and I can't find anything. What seemed to be the easiest, is extremely difficult, if someone can help me, I am extremely grateful.

Related

KIVY popup - how do I dismiss it from a compound content

I am trying to create a Kivy popup for general use
From my code below you may see that I am a beginner
I am trying to understand the KIVY language, ids, kivy properties, how to apply rules and the interaction between the KV and Python files
I will appreciate your answers and comments, that may teach me
Ho do I dismiss the popup?
Thank you for your aid
===================================================================
My KV file
'''
<MB_Body>
id: id_body
size_hint: 0.9, 0.9
Label:
id: id_label
size_hint: (0.6, 0.2)
pos_hint: {'x': 0.2, 'top': 0.9}
text: 'Sibs text'
Button:
text: 'Dismiss'
size_hint: 0.8, 0.2
pos_hint: {'x': 0.1, 'y': 0.1}
on_release: root.dismiss_msgbox()
id: pop
auto_dismiss: False
size_hint: 0.6, 0.4
title: 'si8bs title'
canvas.before:
Color:
rgba: 0, 1, 0, 1
Rectangle:
size: self.size
pos: self.pos
MB_Body:
'''
##########################################################
My PY file:
'''
from kivy.app import App
from kivy.uix.popup import Popup
from kivy.uix.floatlayout import FloatLayout
from kivy.properties import StringProperty, ObjectProperty
class MsgBox(Popup):
pass
class MB_Body(FloatLayout):
def dismiss_msgbox(self):
print('In Finis')
print(App.get_running_app())
dismiss() #---> This line is my problem. How do I dismiss the popup???????????
def showMsg(_title, _msg):
mb = MsgBox()
mb.title = _title
mb.content.ids.id_label.text = _msg
mypopup = mb
print(_msg)
mb.open()
'''

Sunmi T2 - Flutter

I am using the sunmi_printer_t1mini for my sunmi T2 printer to print tokens, the printing seems to be going fine, but the token paper in not being cut, I checked if there is any function for cutting the paper but I couldn't find any, can anyone please help me with this.
Below I have attached my code which I run to print.
_testPrint() {
Log.print('Test Print');
try {
Printer.text("Printer OK!",
styles: PrintStyle(
bold: true, align: PrintAlign.center, size: PrintSize.mdd));
Printer.text("Powered by Grapes IDMR",
styles: PrintStyle(
bold: true, align: PrintAlign.center, size: PrintSize.mdd));
Printer.cutPaper();
} catch (e, s) {
Completer().completeError(e, s);
}
}
simply use
SunmiFlutterPrint.autoOutPaper();
not that this also should be imported:
import 'package:sunmi_flutter_print/sunmi_flutter_print.dart';

Kivy popup size relative to content

I am trying to set the height of a popup in kivy so that it varies to fit its content. However, I cannot use height: self.minimum_height, as Popup has no attribute minimum_height.
I have also tried setting the height of the popup equal to the height of the content, but the result is far from ideal (and especially wouldn't be consistent across different screen sizes).
This is my code:
#:set row_height '35sp'
<ConfirmPopup#Popup>:
box: box
message: message
noButton: noButton
yesButton: yesButton
size_hint: .8, None
height: box.height + sp(80)
auto_dismiss: False
StackLayout:
id: box
orientation: 'lr-tb'
size_hint: 1, None
height: self.minimum_height
padding: main_padding
Label:
id: message
text: "" # This text is updated later from the py script
text_size: self.width, None
size_hint: None, None
width: self.parent.width
height: self.texture_size[1]
Label: # just empty space
size_hint: .15, None
Button:
id: noButton
size_hint: .3, None
height: row_height
Label:
size_hint: .1, None
Button:
id: yesButton
size_hint: .3, None
height: row_height
Label:
size_hint: .15, None

Algolia bug with Infinite Search

Currently using the infinite search method that Algolia supplies through their instantSearch.js.
The following scenario is happening:
Search for an item
Refine the list
Load more pages up to page 5
Scroll back to the top and change refinement
Nothing happens
By the looks of it - it's appending the results of the new refinement to the results that are already there. I'm looking to make it resent the results, not sure if this is a bug with instant search itself?
search.addWidget(
instantsearch.widgets.numericRefinementList({
container: '#price',
attributeName: 'salePrice',
options: [
{name: 'All'},
{end: 20, name: 'less than 20'},
{end: 50, name: 'less than 50'},
{start: 50, end: 100, name: 'between 50 and 100'},
{start: 100, end: 300, name: 'Expensive'},
{start: 300, name: 'Very Expensive'}
],
templates: {
header: 'Price'
}
})
);
And the infinite search code:
search.addWidget(
instantsearch.widgets.infiniteHits({
container: '#infinite-hits-container',
templates: {
empty: 'No results',
item: hitTemplate
},
hitsPerPage: 3
})
);
This issues is fixed in 1.11.15 (instructions for getting the new version is here)

Fill PDF form using perl or node

I need to fill PDF form, Which contains radio buttons too. I tried to fill it with perl, CAM::PDF module and with node, pdf-fill-form module.
In node, the radio's value is always undefined:
{
name: 'Op1',
page: 14,
value: undefined,
id: 983128,
type: 'radio'
}
In perl, the object's value looks like this (if the first option is checked is S, second: XL, third: 2XL etc):
'V'=> bless({
'gennum'=>0,
'value'=>'S',
'type'=>'label',
'objnum'=>988
},
'CAM: : PDF: : Node')
If I change the S to XL, nothing happens in the PDF.
Has somebody any idea, How to fill the radio box?
You can do with node js npm pdf-fill-form module.
let say you are trying to set gender:
your radio button must be formed this way.
{ name: 'gender',
page: 0,
value: false,
id: 65558,
caption: 'male',
type: 'radio' },
{ name: 'gender',
page: 0,
value: false,
id: 65559,
caption: 'female',
type: 'radio' }
Here caption is the important one.
if you trying to set gender is male means just do this
{ gender: 'male'}