Kivy_Text_INPUT_Multiline_app (frames) - kivy

I am developing some app in kivy,I need to display mulitple line of string in a text input.How to do it?
If any examples please do post it.

An example is right here together with description. You didn't provide any code or basically anything I could use, so I'll do it this way:
<Box>:
TextInput:
id: mytextinput
multiline: True ## defaults to True, but so you could see how it works
text: 'something'
Button:
on_release: root.update_text('new value')
this will be your kv file/string for a TextInput no matter where you'll put it and id is identificator of how to access that widget, then in python
class Box(BoxLayout):
def update_text(self, value):
self.ids.mytextinput.text = value
It means that whatever widget you have and TextInput is its child in kv file/string, you will access it through ids dictionary and change its variable text to your desired value with calling custom update_text(<string>) in your class.

Related

I need to add more than one app.root.current in kivy

I am creating an app in kivy in which basically it gives you a poem once you enter a date and password. For this I have created several windows for each poem. My problem is that i made it so that on_release of the button there is a selective-like structure to show the right poem. The problem is that this only works for the last sentence and not all of them at the same time as supposed to.
Button:
font_name: "Georgiai"
font_size: 20
text: "Enter"
size_hint: 0.5, 0.5
background_color: "#00FFCE"
on_release:
app.root.current = "fifth" if date.text == "01.02.2023" and password.text == "Si" else "fourth"
app.root.current = "seis" if date.text == "02.02.2023" and password.text == "te" else "fourth"
I have tried using multiple on_release: app.root.current but it also does not work. This is the only thing left for it to function so I hope someone can help me. I am quite new in programming
You should move the program logic into Python and not include logic in your kivy file. Arguments can be passed like this:
Button:
on_release: app.give_poem(_date.text, _password.text, self)
# or
# on_release: root.give_poem(_date.text, _password.text, self)
I changed your variables by adding an underscore to avoid confusing your variables with other common objects. I am assuming date and password were ids of other kivy objects.
in your python app or top level widget you can employ your logic. Here is the basic signature that your method should have within your app or your top level widget object. This one just prints the arguments sent and you can decide what to do from there.
def give_poem(self, _date, _password, my_button):
print(f"{self}: {_date}: {_password}: {my_button}")

Custom wireshark disector shows value but fieldname is not visible using lua

I am testing some network packets of my Organisation's product. We already have custom plugins. I am trying to add some some more fields into those existing plugins (like conversion of 2 byte code to a string and assign it to a field)
Thankyou in advance for reading my query.
--edit
Wireshark version : 2.4.5 (organization's plugins dont work on latest wireshark application)
--edit
Problem statement:
I am able to add field and show value, but fieldname is not displayed as defined.
I cannot share the entire .lua file but i will try to explain What i did:
Below is the image where I have a field aprint.type. this is a two byte field. In .lua file, for display purpose it is appended with corresponding description using a custom function int_to_enum.
I want to add one more proto field aprint.typetext which will show the text.
What I did:
Added a protofield f_apr_msg_type_txt = ProtoField.string("aprint.typetxt","aprint_type_text") (Tried f_apr_msg_type_txt = ProtoField.string("aprint.typetxt","aprint_type_text",FT_STRING) also)
Below the code where subtree aprint.type is shown, added my required field as subtree:add(f_apr_msg_type_txt, msg_type_string) (Below is image of code extract)
I am able to see the text but field Name is shown as Wireshark Lua text (_ws.lua.text)
Normally displaying strings based on numeric values is accomplished by a value string lookup, so you'd have something like so:
local aprint_type_vals = {
[1] = "Foo",
[2] = "Bar",
[9] = "State alarm"
}
f_apr_msg_type = ProtoField.uint16("aprint.type", "Type", base.DEC, aprint_type_vals)
f_apr_msg_type_txt = ProtoField.string("aprint.typetxt","aprint_type_text", base.ASCII)
... then
local msg_type = tvb(offset, 2):le_uint()
subtree:add_le(f_apr_msg_type, tvb(offset, 2))
subtree:add(f_apr_msg_type_txt, tvb(offset, 2), (aprint_type_vals[msg_type] or "Unknown"))
--[[
Alternatively:
subtree:add(f_apr_msg_type_txt, tvb(offset, 2)):set_text("aprint_type_text: " .. (aprint_type_vals[msg_type] or "Unknown"))
--]]
I'm also not sure why you need the extra field with only the text when the text is already displayed with the existing field, but that's basically how you'd do it.

Telegraf Processor value to fieldname

I have points from my Input like these two:
http,Location=Foo Key="Humidity",Value=68 1659704523000000000
http,Location=Foo Key="Temperature",Value=24,1 1659704523000000000
But I have to store them like these:
http,Location=Foo Humidity=68 1659704523000000000
http,Location=Foo Temperature=24,1 1659704523000000000
I saw almost all of Processor plugin docs, but I still not sure it is possible to use field value as a field name. Isn't it?
I still not sure it is possible to use field value as a field name. Isn't it?
Yep! The starlark processor will do this. The 'pivot' example is what you are after.
The following will create a new field based on the values of Key and Value and then remove the original values:
[[processors.starlark]]
source = '''
def apply(metric):
metric.fields[str(metric.fields['Key'])] = metric.fields['Value']
metric.fields.pop('Key',None)
metric.fields.pop('Value',None)
return metric
'''

Variable to change label on thingsboard

I would like to see if they can help me with the creation of a variable, where I can change the labels of the MQTT message that is sent from my IoT devices, in order to make it easier and to select the correct parameters when creating a dashboard. .
Example:
This is the message received to my server.
[{"n": "model", "d": "iot-zigbee1783"}, {"n": "Relay", "ap": true}, {"t": "gateway", "ma": "0035DDf45VAIoT215"}]
What I want is to change the label "d" for "deviceIoT" and "ap" for "door sensor" also if it is possible to change the true or false of the door sensor for open and closed.
You can do this with the help of Thingsboards rule-chain.
There is also an official tutorial for this:
https://thingsboard.io/docs/user-guide/rule-engine-2-0/tutorials/transform-incoming-telemetry/
They use the transformation-rule-node called script to convert temperatures from [°F] to [°C].
While this is not your use case, it shows you how to handle incoming telemetry before it is saved to the database.
You could do a mapping of value-keys like this:
var theCustomizedMessage = {};
theCustomizedMessage['customizedKey'] = msg['originalIncomingKey'];
return {msg: theCustomizedMessage, metadata: metadata, msgType: msgType};
Keep in mind that this might be contra-productive since you have to update the rule-node scripts, when something changes.
As an alternative option you can rename the key labels in the widget configuration. This will not help your dashboard developers. But a documentation document will do :)
I strongly recommend against the replacement of boolean values with strings ('closed', 'opened'). This is a job for the widgets (e.g. their value format functions).

Queries related to JIRA-Scripted Field

Is scripted field appear on ISSUE EDIT or any transition screen?
For me, it appear on issue view screen only and unable to see on issue edit screen.
I want it to appear on EDIT screen as well as a readonly.
(have verified by just keeping - "free text template" and - return "some value").
Another:
When I have use below script on scripted field then it shows me error while execute:
Error message as below:
The indexer for this field expects a java.lang.String but
the script returned a com.atlassian.jira.issue.fields.CustomFieldImpl - this will cause problems.
Code:
import com.atlassian.jira.ComponentManager.
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.CustomFieldManager
CustomFieldManager customFieldManager = componentManager.getCustomFieldManager()
def componentManager = ComponentManager.getInstance()
def issueLinkManager = componentManager.getIssueLinkManager()
def selectedValues = customFieldManager.getCustomFieldObject("customfield_11447")
//custom field has multi selected values as it is a "multi select" field type.
return selectedValues
How I could use scripted field in issue edit/transition screen and also resolve above error.
For the first part of your question, no a scripted field wont be displayed on a Create, Edit or Transition screen. There is a work around for transition screens but I have not tried it https://gist.github.com/jechlin/5380119
Now the second part of your question. You are returning an object of CustomeField and you should be returning a String. What you want to do is
change this
def selectedValues = customFieldManager.getCustomFieldObject("customfield_11447")
to this
def cf = customFieldManager.getCustomFieldObject("customfield_11447")
def selectedValues = cf.getValue(issue)
Here is a link to the api documentation for JIRA (6.0.4):
https://developer.atlassian.com/static/javadoc/jira/6.0.4/reference/packages.html

Resources