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
@ihf I had seen and answered in GitHub but here is my answer:
Finally, this trace does not help me....sorry
The set_content_inset function only contains one line which could not crash. I already have thought to modify all my script without the ui.TableView by building my own scroll view and sub views for all rows.
Long work and one disadvantage: all cells have to be created at start, not when they are displayed, but I think that TableView generates some bugs. I think, buT far from to be sure, that ObjectiveC methods I use for this TableView generate all our problems... Thus, I plan to try to rebuild the script, but not for next week (not a lot free) hoping you can still use actual version.
@cvp thanks. I will certainly continue to use the script. Have a great weekend!
JonB last edited by
@cvp Are you logging function enter AND exit? What could have happened is set_content_inset was the last method called, but then whatever the calling function was failed
@JonB we are not yet sure, we only one trace that the crash is always at same line
@on_main_thread def set_content_inset(self,bb): mytrace(inspect.stack()) # Standard TextView has a top positive inset by default ObjCInstance(bb).textContainerInset = UIEdgeInsets(0,0,0,0)
called in TableView_cell_for_row but a lot of lines after that...I can't trace all
See a comment "a lot of segmentation errors when we scroll"
Sincerely, as the errors are not reproductive, il is almost impossible to debug.
self.set_content_inset(bb) bb.row = row ObjCInstance(bb).tv = bb bb.text = txt bb.text_color = 'blue' #bb.border_width = 1 bb.font = ft bb.number_of_lines = 0 #bb.frame = (x,0,self.width-x-4,ft) w = bb.width bb.size_to_fit() ho = bb.height bb.frame = (bb.x,bb.y,w,ho) #print('bb:',self.font_size,ho) if self.select: bb.touch_enabled = False else: swipe(bb, self.swipe_left_handler,direction=LEFT) swipe(bb, self.swipe_right_handler,direction=RIGHT) #bb.border_width = 1 cell.content_view.add_subview(bb) if not hidden: # separation line if self.show_lines_separator == 'yes': sep = ui.Label() sep.frame = (0,hrow-1,self.tv.width,1) sep.border_width = 1 sep.border_color = 'lightgray' cell.content_view.add_subview(sep) self.redraw_textview_attributes(bb,opts) # a lot of segmentation errors when we scroll (which set_cursor) # does only if last action = add row if row == self.cursor and len(self.undo_multiples) > 0: if self.undo_multiples[-1] in ['CR','tab','back']:# or (row == 0 and txt == ''): bb.begin_editing() ui.delay(partial(self.textview_did_begin_editing,bb),0.1) c = self.cursor if c >= len(bb.text): c = max(0,len(bb.text)) #bb.selected_range = (c,c) # Pythonista does not allow to set c = len(text) to put cursor at end range = NSRange(c,c) ObjCInstance(bb).setSelectedRange_(range)
@ihf New V01.00 and outline.versions with
Version V01.00 - add some traces in tableview_cell_for_row at place supposed to be crash origin
@ihf New V01.01 and outline.versions with
Version V01.01 - use only one InputAccessoryView and share it for TextView of each row, adviced by @jonB to gain memory
@ihf Finally, I feel too lazy to convert the TableView to a ScrollvView, with the risk of encountering the same scrolling issues. On the other hand, I am always available to continue to try to correct problems if they are clearly identifiable.
@cvp this is not at all urgent but perhaps you could add it to the to do list. I wanted someone else to try out outline and I realized that there are several files that they need to download in order to make it work. Would it be possible to either check for those files and download what is needed in the script or if that doesn’t make sense, perhaps a set up script that they could run once?
@ihf I think, if I remember, that you only need now the outline.versions.
The outline.prm is automatically created if it does not exist.
I've moved the program elsewhere and run it, it seems to work (I wrote"it works" but I don't dare anymore to say that something works) Plus some imported modules of course.
As soon as possible, I'll do a version that will check if all needed files are present
@ihf V01.02 and outline.versions with
Version V01.02 - check if all imported modules exist and, if not, print their list and url's where to find them
Not sure all are there but wait and see with first new user.
Added in my todo list to automatically download missing ones but not for coming days.
Needed files ============ SetTextFieldPad.py at https://github.com/cvpe/Pythonista-scripts/blob/master/SetTextFieldPad.py File_Picker.py at https://github.com/cvpe/Pythonista-scripts/blob/master/File_Picker.py gestures.py at https://github.com/mikaelho/pythonista-gestures/blob/master/gestures.py blackmamba folder at https://github.com/zrzka/blackmamba/tree/master/blackmamba swizzle.py at https://github.com/jsbain/objc_hacks/blob/master/swizzle.py all previous modules should be copied in site-packages outline.versions at https://github.com/cvpe/Pythonista-scripts/blob/master/Gists/outline.versions previous file should be copied in same folder as outline.py
@cvp The menu that permits setting bold, italic, etc. is no longer coming up.
The menu that permits setting bold, italic, etc. is no longer coming up.
You know that some text needs to be selected first.
If so, and you select "bold..." in the popup menu, that works.
But the "bold" key does not work.
It seems that from V01.01 where I had put a modification to share the same InputAccessoryView for all rows prevents the keys of keyboard extra row to work. Not only the "bold" key but also promote
and demote keys.
Thus next version will remove this modification.
V01.03 and outline.versions with
Version V01.03 - remove sharing of one InputAccessoryView (set V01.01) which prevent keys of keyboard extra row to work
JonB last edited by
I'm curious why that broke -- are you holding onto a reference to the text view itself? That seems dangerous unless you store tableviewcells after creation so that you can reuse the actual cell and its contents when cell_for_row is called.
cvp last edited by ccc
@JonB sorry, never seen this post. I'm in holidays for some days. i'll answer this weekend
are you holding onto a reference to the text view itself?
No but I store the TableView row into the InputAccessoryView. Then, when a key is pressed in the supplementary keyboard row, I can call textview_should_change with the right row which is the index in TableView. And I don't need anything more, even the TextView it-self.
@cvp when I type a new outline item, and I hit the return, the keyboard disappears. I think it would be better if the keyboard remained so that you could continue typing since you are positioned on the next outline line. Does that make sense?
when I type a new outline item, and I hit the return, the keyboard disappears. I think it would be better if the keyboard remained so that you could continue typing since you are positioned on the next outline line. Does that make sense?
Yes sir. I had remarked this problem yesterday, sorry for you. I'll try to correct it tomorrow.
That should be an old bug and I can't remember if I have already tried to solve it, and if yes, obviously without success
@ihf V01.04 and outline.versions with
Version V01.04 - correction of bug "keyboard was disappearing after an enter to create a new outline row"
This bug was not so old, it should have appeared from V00.96 when I removed the undo/redo process and a part of this process variables is checked for cursor process.
@cvp This is a (low priority) idea for the wish list: I sometimes want to read my outlines on the Mac. What I do now is save them in pdf or some other format that the Mac understands. This works fine but I have to remember to do it after any change so that the outline will be up-to-date. A reader script in python would permit me to view an outline on the Mac or on anything that runs python and has access to the iCloud files.
ccc last edited by ccc
Given that this is the 1,002nd entry in this thread, perhaps it would be good to stop adding to this thread and create a new one to continue the discussion.
The Forum software is not very efficient at buffering up and paginating tons of content especially when it contains images. Thoughts?