• cvp

    You have even a button for this

    posted in Pythonista read more
  • cvp

    @ihf possible and probable, but if action = Apple Shortcut and if this shortcut starts a Pythonista script, your objective is reached, isn't it?

    Edit: sorry, I didn't read correctly the from a locked state

    posted in Pythonista read more
  • cvp

    I got sometimes the same problem and it does not look like the split keyboard, only the supplementary row.

    The problem occurs when I run a script in a editor's tab where the keyboard is visible.
    But not in other tabs, or not if I run a script where the keyboard is hidden.

    posted in Pythonista read more
  • cvp

    @mikael nothing special, why? Any script is ok, it is not really started by an automation but by the shortcut

    posted in Pythonista read more
  • cvp

    I've created a shortcut automation for

    • at a defined time
    • action = "run shortcut" which only contains an "open url Pythonista3:://script?action=run"
      without asking before run

    and it works (in unlocked mode)

    posted in Pythonista read more
  • cvp

    @mikael said:

    timed automations that would work in the background when the device is locked.

    I used successfully Pyto background module to send a remote notification to my iPhone while my iPad was locked but this stops to work after I did install iOS 14.

    Thus I hoped I could replace that by Shortcuts automation. 😥

    posted in Pythonista read more
  • cvp

    @I-L please read this, seems to be still so 7 years later

    posted in General Discussion read more
  • cvp

    For me (or I'm really bad), automation without asking to tap on the notification does only work if I'm logged on my iPad, not if it is black. At least tested with "sending an email"

    posted in Pythonista read more
  • cvp

    @Dylko No way to help you without your code and/or your error

    posted in Pythonista read more
  • cvp

    @tbrown313 A last solution is to copy the standard dialogs source code and modify as you want in your own version.

    posted in Pythonista read more
  • cvp

    @blowhard could you check if after your problem a file _objc_exception.txt has been created or updated in the root of Pythonista. Perhaps is your problem coming from an Objectivec exception. If yes, you can post its content.

    I think about a thread problem

    posted in Pythonista read more
  • cvp

    @soydepr you can also try

        f = dialogs.pick_document() 
    

    .db files are not grayed

    posted in Pythonista read more
  • cvp

    @soydepr other solution: you can share a .db file from the Files app to Pythonista and run the standard "import file" script

    posted in Pythonista read more
  • cvp

    @soydepr said:

    greyes out

    You're right, sorry

    If you use "external files", it will work

    posted in Pythonista read more
  • cvp

    @soydepr you can import the db file into Pythonista but you could even open/access it without importing it, like explained here for a script.

    Here under, how to import

    posted in Pythonista read more
  • cvp

    @tbrown313 don't use dialog if you want to

    • use sheet, popover, ....
    • decide the size of the view
    • make the text non editable
    from objc_util import *
    import ui
    
    def main():
        device = ObjCClass('UIDevice').currentDevice()
        if 'ipad' in str(device.model()).lower():
            w = 500
            h = 500
        else:
            w,h = ui.get_screen_size()
        font = ('Courier',12)       
        lc = ui.measure_string('A', font=font)[0]
        
        tv = ui.TextView()
        tv.frame = (0,0,w,h)
        tv.font = font
        tv.editable = False
        
        tvo = ObjCInstance(tv)
        p = tvo.positionFromPosition_offset_(tvo.beginningOfDocument(), 0)
        rge = tvo.textRangeFromPosition_toPosition_(p,p)
        x = tvo.firstRectForRange_(rge).origin.x
        #x = 5
        
        nc = int((w-2*x)/lc)    
        tv.text = 'A'*nc
        tv.present('sheet')
        
    # Protect against import    
    if __name__ == '__main__':
        main() 
    

    posted in Pythonista read more
  • cvp

    @tbrown313 you could try on your both devices:

    import dialogs
    from objc_util import *
    import ui
    
    def main():
        device = ObjCClass('UIDevice').currentDevice()
        if 'ipad' in str(device.model()).lower():
            w = 500
        else:
            w = ui.get_screen_size()[0]
        font = ('Courier',12)       
        lc = ui.measure_string('A', font=font)[0]
        
        tvo = ObjCInstance(ui.TextView())
        p = tvo.positionFromPosition_offset_(tvo.beginningOfDocument(), 0)
        rge = tvo.textRangeFromPosition_toPosition_(p,p)
        x = tvo.firstRectForRange_(rge).origin.x
        #x = 5
        
        nc = int((w-2*x)/lc)    
        f = dialogs.text_dialog(text='A'*nc, font=font) 
        
    # Protect against import    
    if __name__ == '__main__':
        main() 
    

    posted in Pythonista read more
  • cvp

    @resserone13 said:

    I didn’t want to spend three days

    On this forum you almost never wait during three days for an helping answer 😀
    That's also an advantage of this (marvelous) app.

    posted in General Discussion read more
  • cvp

    @resserone13

    class Employee(object):
        def __init__(self, first_name, last_name, department, employee_id):
            self.first_name = first_name
            self.last_name = last_name
            self.email = '{}.{}@company.com'.format(self.first_name, self.last_name)
            self.department = department
            self.employee_id = employee_id
    
        def __str__(self):
            return '{} {}'.format(self.first_name, self.last_name)
    
        def get_email(self):
            return self.email
            
    emp1 = Employee('mickey', 'mouse', 'EVS', '001')
    
    print(emp1.get_email())
    

    posted in General Discussion read more
  • cvp

    @tbrown313 text_dialog presents the view as a sheet of width=500 which can contain 68 characters with font Courier 12.
    But sheet does not exist on iPhone, doc says

    we call the View.present() method to get the main view on screen. 
    Views can be presented with different styles. 
    On the iPhone, all views are presented in full-screen, but on the iPad, 
    you can choose between 'sheet', 'popover' and 'fullscreen'. 
    

    So...for an iPhone, width will be

    ui.get_screen_size()[0] 
    

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!