Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Outliner with drag/drop reordering - part 2
-
@cvp I tried the above script again after restarting Pythonista and I get the same error about a missing objective-C class. I presume you are running iOS 15?
-
@cvp I’m in landscape mode and the line I’m talking about is to the left of hide children in the pop-up menu. The interesting thing is that this line which is one line of an outline isn’t going away regardless of which item I touch even if I change outlines. It even persists if I start a new outline and touch 1.0 in the new outline.
-
@ihf said:
I presume you are running iOS 15
Yes.
aren't you?
But this ObjectiveC class exists from ios4...
Did you try on a device where Pythonista is authorized to access calendar?Could you try on iPad please?
Edit: same problem as you on my iPhone.
-
@ihf said:
I’m in landscape mode and the line I’m talking about is to the left of hide children in the pop-up menu. The interesting thing is that this line which is one line of an outline isn’t going away regardless of which item I touch even if I change outlines. It even persists if I start a new outline and touch 1.0 in the new outline
Ok, understood, you didn't say you work with horizontal popup (which has a bug). Will correct it.
-
@ihf V01.15 and outline.versions with
Version V01.15 - when copy selected rows, outlines and texts are also copied in standard IOS PasteBoard for eventual paste in another app - correction of bug "left title of horizontal popup does not show the tapped outline but the text of another line, even from a previous file"
-
@cvp I just tested the copy/paste function and got a strange result. I selected two lines that were at level one in an outline and then I created a new outline and did a paste. I got the two lines, the first at level one and the second at level 2.15.
-
@ihf V01.16 and outline.versions with
Version V01.16 - correction of bug "paste lines of same level gave bad numbering results" - correction of bug "popup option paste crashes if no dates defined in copied lines"
-
@JonB Perhaps could you know why
EKEventEditViewController = ObjCClass('EKEventEditViewController').new().autorelease()
Gives this error, on some devices only (IOS 15.0.2 Pythonista v3.3 330025)
Solved: needs load_framework('EventKitUI') but why on some devices only? Perhaps different startup.
File "/var/containers/Bundle/Application/8778D1CF-1C08-48BA-9714-9D2CFE524EA1/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 429, in __init__ raise ValueError('no Objective-C class named \'%s\' found' % (name,)) ValueError: no Objective-C class named 'b'EKEventEditViewController'' found
-
@ihf did you test the paste in another app? Is that like you hoped?
-
@cvp yes, I also pasted discontiguous parts of an outline to another app and it looks perfect. Thanks!
-
@ihf at least one good news
-
@ihf did you test my little script of the standard iOS calendar event edit on iPad?
And, if yes, do you like this standard screen?
If it does not work on iPhone, I would need to program a part of the fields and we would need to decide which ones. -
@cvp The traceback I posted above is from my iPad.
-
@ihf Thus the problem may occur on iPad or iPhone. I don't understand why objc_until could be different.
Solved: needs (sometimes?)
load_framework('EventKitUI')
Script edited
Thus, please, try it and tell me if you would be happy with this event editer .
-
I need help...
Next script works correctly, event is canceled or added but my delegate method is not called.
What is wrong? Thanks for helping me.import ui from objc_util import * load_framework('EventKitUI') EKEventEditViewController = ObjCClass('EKEventEditViewController') def eventEditViewController_didCompleteWith_(_self, _cmd, _controller, _action): controller = ObjCInstance(_controller) action = ObjCInstance(_action) print(action) controller.dismissViewControllerAnimated_completion_(True, None) try: MyEventEditViewDelegate = ObjCClass('MyEventEditViewDelegate') except: MyEventEditViewDelegate = create_objc_class( 'MyEventEditViewDelegate', methods=[eventEditViewController_didCompleteWith_,], protocols=['EKEventEditViewDelegate'] ) @on_main_thread def EventEdit(title=None): v = ui.View() if title: v.name = title v.rgb = None vc = ObjCInstance(v) store = ObjCClass('EKEventStore').alloc().init() calendar = None for cal in store.calendars(): #print(cal.title()) if str(cal.title()) == 'Outline': calendar = cal break EventEditViewController = EKEventEditViewController.new().autorelease() #print(dir(EventEditViewController)) EventEditViewController.editViewDelegate = MyEventEditViewDelegate.alloc().init() EventEditViewController.eventStore = store event = ObjCClass('EKEvent').eventWithEventStore_(store) event.title = 'Todo: text line' event.setCalendar_(calendar) EventEditViewController.event = event clview = EventEditViewController.view() w,h = ui.get_screen_size() v.frame = (0,0,w,h) vc.addSubview_(clview) v.present('fullscreen') #v.wait_modal() return EventEdit()
-
@cvp Perhaps i have not thought this through, but would the event editor be used to set the default for events or would it be used to edit any event that has been added? If the latter, then I’m not sure what the advantage is to performing the edit within Pythonista as opposed to going to the calendar and editing it.
-
@ihf As you asked to be able to add some fields (2nd alarm, repeat) to a newly added due date event, I searched the easiest way which is this standard screen. But I did not wanted to allow editing, only adding.
But if you want....In French, we say "le client est roi" (I leave you translate 😀)
If you think you only need a few fields, please tell me which ones and I will program them instead of using this standard screen. -
@cvp I think the English expression is “the customer is always right“, but it sounds better in French :-) The only fields that I was thinking of were repeat and alarm but I suppose that if I view the due date feature as a way to manage ToDo events generally, you might as well use the standard edit panel.
-
@ihf Said:
you might as well use the standard edit panel.
As you have seen in my other post, I need help to get feedback of the standard screen.
-
@cvp I'm not sure, but I think the method name needs to be
eventEditViewController_didCompleteWithAction_
Not
eventEditViewController_didCompleteWith_
Although objc_util let's you call using the shortcut
eventEditViewController_didCompleteWith(action=obj)
, it dies that by trying kwarg names as the "nouns" when trying to find matching selectors that start the same. But the actual selector has the "noun" ("Action") in the selector name, and the underlying delegate mechanism is looking for the exact selector. Actually, I think you will find, since you confirmed to the protocol, that there actually is a method so named in your object, and that's the method getting called.The apple reference docs usually default to swift, which has its own name mangling approach -- make sure you always change the drop-down to objc.