Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    ungern84
    @ungern84
    I want to display data with multiple columns and rows using beeware on a mobile phone. Is toga.Table the right widget? I need to access the data from a web database. I am currently storing the data in MongoDB but as mentioned by @freakboy3742 pymongo is a package with binary dependencies and cannot be used in beeware. Has someone a setup (web-database + package) that can be used to display data in beeware?
    Rafael Cordones
    @rafacm

    Hi! I’m using rubicon-objc and I am currently stuck implementing a handler method in Python and passing it as a handler to an Objective-C instance method defined as:

    typedef void (^MLCGraphCompletionHandler)(MLCTensor *resultTensor, NSError *error, NSTimeInterval executionTime);

    This is my current attempt:

    from rubicon.objc import ObjCClass, objc_method, NSTimeInterval, NSObject, Block
    
    ...
    MLCTensor = ObjCClass('MLCTensor')
    ...
    NSError = ObjCClass('NSError')
    
    @Block
    def completionHandler(result_tensor: MLCTensor, error: NSError, time_interval: NSTimeInterval) -> None:
        print(f'result_tensor: {result_tensor}')
        print(f'error: {error}')
        print(f'time_interval: {time_interval}')

    but I am getting the following error:

    Traceback (most recent call last):
      File "/usr/local/Cellar/python@3.8/3.8.6_1/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ctypes/__init__.py", line 99, in CFUNCTYPE
        return _c_functype_cache[(restype, argtypes, flags)]
    KeyError: (None, (<class 'ctypes.c_void_p'>, <rubicon.objc.api.ObjCClass: MLCTensor at 0x7fff88516c10>, <rubicon.objc.api.ObjCClass: NSError at 0x7fff884f46a8>, <class 'ctypes.c_double'>), 1)
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/.../test_rubicon.py", line 107, in <module>
        def handler(result_tensor: MLCTensor, error: NSError, time_interval: NSTimeInterval) -> None:
      File "/usr/local/lib/python3.8/site-packages/rubicon/objc/api.py", line 1767, in __init__
        self.cfunc_type = CFUNCTYPE(restype, c_void_p, *signature)
      File "/usr/local/Cellar/python@3.8/3.8.6_1/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ctypes/__init__.py", line 101, in CFUNCTYPE
        class CFunctionType(_CFuncPtr):
    TypeError: item 2 in _argtypes_ has no from_param method

    My interpretation of “TypeError: item 2 in argtypes has no from_param method” is that the issue is occurring when rubicon-objc tries to register the completionHandler definition to the Objective-C runtime. Any help highly appreciated!

    dgelessus
    @dgelessus
    @rafacm Hi! At the moment rubicon-objc doesn't support using actual Objective-C classes inside function argument/return type annotations. For now you need to use the generic ObjCInstance class when declaring an Objective-C object parameter, instead of a specific Objective-C class like NSError or MLCTensor.
    (This only applies to Objective-C classes/objects though. For C integers, structs, etc. you always have to declare the exact type, or the calls won't work properly.)
    geogriff
    @geogriff
    Hey there beeware devs! I'm currently blocked behind beeware/briefcase-linux-appimage-template#3 and I'm wondering if there's any reason not to merge it soon besides the small change I suggested there?
    Russell Keith-Magee
    @freakboy3742
    @ungern84 Table would be the right widget - except that Table isn't currently implemented for mobile.
    @geogriff The change looks good to me; apologies for the slow response on the PR itself. I've been moving house, so my life has been... busy... the last few months :-) I'll add this one to my list to address ASAP.
    geogriff
    @geogriff
    Ah thanks, no worries @freakboy3742, just wanted to let you know so you'd know at least one person is interested in the issue.
    Tom
    @t-arn
    When I change version in pyproject.toml and then do briefcase update android and then briefcase build android I notice that the version in AndroidManifest.xml is not updated. Only when I delete the generated android directory and do a briefcase create android and then a briefcase build android the version in AndroidManifest.xml is updated correctly. Shouldn't briefcase update update the AndroidManifest.xml from the data in pyproject.toml? Am I missing something?
    Russell Keith-Magee
    @freakboy3742
    @t-arn You’re not missing anything; that’s a limitation of Briefcase as it currently stands. Update only updates the code in your project (plus dependencies if you add -d).
    It’s certainly conceivable that update should update AndroidManifest (or any other metadata file). The bigger question is whether it should.
    It really comes down to a philosophical thing - whether the artefacts produced by briefcase are “permanent” and should be version controlled, or whether they’re transient.
    My personal perspective is that they should be transient. You should be able to rebuild an app at any time without losing anything. Update exists as a convenience for debugging physical builds, rather than being a long term management strategy
    Tom
    @t-arn
    ok, thanks for the explanation. I found that versionCode is created based on versionand build. Is it possible to control versionCode in AndroidManifest directly?
    Tom
    @t-arn
    very cool, thanks! I'm getting close to publishing my calculator - it works pretty good on Windows, Android and macOS. I still have strange problems with iOS. The gui controls are not all displayed, but the app does respond to the controls that are shown. I have not yet found out, why some simple labels are not shown...this will be my next task, once the other 3 platforms are published
    also, the iOS log does not show any helpful infos
    I'll try to go from the working tutorial code and add my own controls one by one
    floherzler
    @floherzler
    Hello BeeWare Devs, I am trying to build an Android App that lets the user pick a .txt file via the open_file_dialog method and display some Images in PNG format that were created from the .txt in another script. I didn't find a method to do that in Android (e.g. ImageView is not for Android as it seems), is there currently no way to display images on Android at all? Thanks in advance!
    Russell Keith-Magee
    @freakboy3742
    @floherzler ImageView is implemented on Android... what gave you the impression that it wasn't? open_file_dialog, however, won't be implemented.
    @t-arn That's definitely interesting behavior; if you are able to generate a reproduction test case, that would be helpful.
    floherzler
    @floherzler
    Thank you @freakboy3742 , I took my information from the Toga Docs: The ImageView Box is not Ticked for Android in the Documentation (https://toga.readthedocs.io/en/latest/reference/api/widgets/imageview.html) , whereas the MainWindow(with open_file_dialog in it) is implemented on all platforms (https://toga.readthedocs.io/en/latest/reference/api/mainwindow.html). I only tested in dev mode so far as I have to Upgrade my windows to be able to see it in a Android emulator. How would i go about selecting a file on Android then? Thank you!
    kwyatt14
    @kwyatt14
    Hi all, first thing, thanks for BeeWare and for your time
    I 'm trying developing a simple app for andorid that downloads a picture using requests
    problem is I have no write privileges
    do I have to write the picture to an specific directory (I tried with ./ and with /data/local/tmp/)
    but I failed I get the following in logcat
    PermissionError: [Errno 13] Permission denied: '/data/local/tmp/
    anyhint?
    kwyatt14
    @kwyatt14
    got it! I can write here: /data/data/ap_name/files/
    Russell Keith-Magee
    @freakboy3742
    @kwyatt14 Looks like you've sorted the problem - but yes; Android has very strict write permissions. There is a limited number o places where you can write files; the intention is that those locations will be exposed as myapp.paths. The stub for that exists, but the locations haven't been set correctly.
    Tom
    @t-arn

    @freakboy3742 I found the reason for my strange iOS problem. I had this code:

    input_box = toga.Box(style=Pack(direction=ROW, padding=5))
    self.ti_input = toga.TextInput(style=Pack(flex=1, font_size=16))
    input_box.add(self.ti_input)
    self.main_box.add(input_box)
    # registers
    box_r0 = toga.Box(style=Pack(direction=ROW, padding=5))
    self.reg_r0 = toga.Label('', style=Pack(font_size=16))
    box_r0.add(self.reg_r0)
    self.main_box.add(box_r0)
    box_r1 = toga.Box(style=Pack(direction=ROW, padding=5))
    box_r1.add(toga.Label('r1', style=Pack(font_size=12, padding_right=8)))

    and the label 'r1' and all controls below where not displayed. The reason is that toga.Label on iOS does not seem to work with empty strings. I changed the code as follows:

    self.reg_r0 = toga.Label(' ', style=Pack(font_size=16))

    and then it worked!

    Jacob-Heff
    @Jacob-Heff
    Probably the obvious answer, but is Toga the only Briefcase supported library that Beeware works with in terms of mobile support?
    Russell Keith-Magee
    @freakboy3742
    @t-arn When you say "empty string label didn't work"... i'm intrigued to know what beheavior you were expecting. i.e., how would you tell the difference between "a label that isn't displayed" and "a label with no content that you can't see"?
    @Jacob-Heff There's nothing technically preventing Briefcase from being able to support other mobile toolkits; however, Toga is the only one it supports at present.
    On the first pass, the limitation isn't Briefcase - it's the toolkits themselves. You can't "just make WxWindows work on mobile" - the toolkit itself needs to support mobile platforms.
    For those platforms that do support mobile (Kivy, Qt?) the only thing standing in the way of support is a template & support package that satisfies the needs of those platforms. My focus is very much on getting Toga working, rather than supporting other platforms; but if someone wants to contribute patches needed to make support for other platforms easier, I'm totally in favour of that.
    Tom
    @t-arn
    @freakboy3742 Well, it is clear that you can't see reg_r0 as long as it has no value - it gets a value programmatically later. The point is that all other controls like the r1 Label and all buttons further down were also not visible.
    Marco
    @Maradonna90
    So I get a an Error:
    ModuleNotFoundError: No module named 'zlib'
    When importin the zlib lib. Its a default python library. But I can't include it in the project.toml requires.
    Any ideas?
    Marco
    @Maradonna90
    ahhh might be the linux packagin issue
    Marco
    @Maradonna90
    grafik.png
    other question. My GUI is cut off like that on windows. Works fine on mac and linux. What might cause this?
    Russell Keith-Magee
    @freakboy3742
    @Maradonna90 Hrm - that's definitely odd. Are you hard-setting any widths of the boxes?
    Marco
    @Maradonna90
    just in this lines
     self.main_box.style.update(direction=COLUMN, padding=10, alignment='center', width=600, height=1000)
     self.main_window = toga.MainWindow(title=self.formal_name, size=(1000, 600))
    Shaima Alghamdi
    @shimaaMoh
    Hi everyone,
    I have a problem starting the android emulator
    I followed all the steps in the beeware tutorial and plugged in Android phone but I still get that Android emulator was unable to start. Do you have any idea how to solve this problem?
    Tom
    @t-arn
    The emulator does not need a plugged in phone. What is the error message?
    kiptip
    @kiptip
    The Android scroll widget cannot directly support children, you have to set the content to a container that does support children. The toga documentation suggests the toga scroll view widget accepts children so if I implement an android implementation of the scrollview widget do I need to auto include a container within it?