Forum Archive

Outliner with drag/drop reordering

ihf

I am looking for an outliner tool (app) that would permit me to create an outline using either the Roman numeral (I. A. a., ii. ) or numeric format (1. 1.1 1.11 1.111). and that would support drag and drop reordering of items. I have searched unsuccessfully for such an app. I think this ought to be possible with Pythonista but I am not skilled enough to do that. Has anyone done this with Pythonista or seen an app to do this?

cvp

@ihf no idea about an app but it is sure that it would be possible in Pythonista.
How do you imagine that? A full editor with support of fonts, colors etc...
or a simple TextView where each set of successive tabs should be replaced by an outline style?
Not a script of some hours but not so difficult in this last case.

ihf

@cvp I would be happy with something that would let me enter and easily edit an outline. Aesthetic features would be nice but are not absolutely essential. The key is something that understands one or two outline formats and allows for promotion demotion and drag and drop reordering of Parent and child nodes. For years I used an app called Notebook on the NeXT computer and later on the Mac. Sadly, it is no longer maintained and is not compatible with the latest OSX. It was far and away the best note taking and outliner app I have used. I have tried to get several vendors who have note taking apps and primitive outlining to add these basic features but so far to no avail. There are some mind map apps out there that may do what I am looking for but they all seem to have a subscription model which I am not interested in. I often find that organizing my thoughts with an outline is very effective. Obviously, I could use some thing like onenote but as feature rich as it is, it has no ability to easily move nodes within the outline.

cvp

@ihf I agree to try to develop a script for you, but
- you should be ready to answer to a lot of questions
- nice functionalities would be for later
- font selection
- color selection
- outline style selection
- drag and move of lines with automatic red-outlining (do we say that?)
- you should be very very patient
- you should be ready for testing because I hate that
- and surely a lot of other conditions

Of course, you will be the master and I don't promise anything.

My first questions before starting a skeleton:
- is tab the begin of indentation with outline?
- is it possible to have outline in a line that does not begin with a tab (ex: azerty 1. Level 1)

ihf

@cvp Wow, that's quite a nice offer. Of course, I would be happy to test whatever you write and I am in no hurry. Typically, the way outliner/notetaking apps work is that you have a blank page which could just have ordinary text but if you change mode (click a button) to enter outline mode, then each line typed before a CR is formatted to be part of the outline using the outline format chosen (assuming you support more than 1). Tab before the line puts the typed line at the next level of the outline and each successive line adds another item at the current outline level. Back tab before typing the line goes back up one level (for each time it is used)
For example, if the format is the Alphanumeric.variety:

I.  Highest level
    A. Child node
    B. Second Child node
II. Second level.
   A. Child node
   B. 2nd child
      i. Next level
     ii. etc.
       a. etc.
or in the Decimal format 
1.0 Item
2.0 Item
   2.1 Child
   2.2 Child
     2.2.1 Child at next level

Here is a description of several formats: https://en.wikipedia.org/wiki/Outline_(list)

If I were to select one format to start with, it would be the Decimal format. There are many aesthetic niceties in outlining apps (none of which is absolutely essential). For example some outlines give the ability to click on a symbol next to the item to hide all child nodes thus making it possible to see only certain levels of a complex outline.

cvp

@ihf This is very clear. of course nice things would be for later, surely easier that base process.
I terminate first for @RocketBlaster05 , then I'll begin to study your script. (Small) News tomorrow.

cvp

@ihf said:

Back tab

How do you tap that on Pythonista keyboard? Left delete should be ok because we delete so a level of indentation.

ihf

Yes, Back tab would be on an external keyboard. a button added to the editor (often how it is done) or left delete would also be good.

cvp

@ihf said:

left delete would also be good.

I don't know why I asked that, I'm not yet so far...šŸ¤”

cvp

@ihf As tab generated an indentation/outline, is it allowed to use tab at other places,
Exemple: azertytab

ihf

Yes, it would only be at the beginning of the line that it would change the level/indentation.

cvp

@ihf Just to show'that I don't forget you. But I don't yet have a version that I could give you for initial tests. Only normal characters, tab and linefeed are "supported" (this word does not mean bugfree).
As soon that A version supports backspace, I'll post it, only to be sure I don't go far from your hopes.

For info, outlines will be colored (via AttributedText) only to differentiate with typed characters.

The format button is only there to be nicer, actually only decimal is supported

Version size = 231 lines, just to prove it does almost nothing.

cvp

@ihf 30 minutes later, it now supports (partially?) alphanumeric format

But quid if higher than Z,z,....?

don't worry actually about alignment of outlines, not yet even thought

cvp

@ihf and now, traditional (I postpone the moment when I'll have to develop the backspace šŸ™„)

mikael

@cvp, suggestion: use TableView for easy reordering, swipe left & right to change outline level.

Copying would need extra support, though.

cvp

@mikael I had hesitated because this choice has also other consequences...
I have already begun (400 lines) with a TextView.
But you are perhaps right.
I have to choose quickly before I'm to far.
I'll decide this week-end, I hope, because enough busy with my smala visiting me.

cvp

@mikael said:

swipe left & right to change outline level.

Normally, tab increases level
Left delete decreases level

Quicker than swiping, I think

mikael

@cvp, true, if you have an external keyboard. iPhone keyboard does not even have a tab key. 😁

cvp

@mikael is that not a tab key? Ha ok, sorry, this is an iPad...

cvp

@mikael and user does not really need a left tab key.
Left tab is used to set cursor at previous tab, that's not the case here, it could need to delete a tab to decrease level, thus left delete is good for that

cvp

@mikael and another problem is that you need a TextField at each row...
Sincerely, except move/drag features, I'm not sure of which is the best.

mikael

@cvp, sure, there’s pros and cons, and @ihf’s use case should provide some guidance here.

But you can have a TextView that resizes to fit the paragraph, and TableView rows that also resize to their contents.

cvp

@mikael Agree, not easy to choose. I'll actually go on with TextView until I meet to much problems.
Sure TableView could be easier for some functionalities.
You disturb me because I had hesitated two days before I took my decision 😢

ihf

Shift tab is often used to do the back tab (demote) function.

cvp

@ihf You see that I don't forget you...I'll send some screen copies to prove it šŸ˜‚

cvp

@ihf

cvp

@ihf

cvp

@ihf but I don't dare to send you this current version because a lot of open bugs.
But, if you want to have it, it is ok, but it is very far to be clean and to offer full functionalities

cvp

@ihf last for today, I stop until tomorrow

cvp

@ihf because, you insist šŸ˜‚ Github but don't come cry, it is full bugs and limits

ihf

@cvp I am very impressed by what you have working already!
I presume that an external keyboard is required at this point since there is no tab otherwise. I am able to create an outline (of course, without shift-tab I can’t go up a level) and moving items is not there but it’s a great start. Obviously , there is a need to be able to save and read the outline.

ihf

Ordinarily, I would expect that tab (or shft-tab) would promote (or demote) a line regardless of when it is hit. In other words if I am on a line and I do tab it would indent and change levels (likewise but reversed for shift -tab). If tab is needed in the text for some reason then promote/demote buttons could be used instead of tab but I have never needed tabs in my text.

cvp

@ihf I said you that this initial version was far from perfect. Of course we will need file new/save/load functions but they are not yet needed for testing thƩ Ʃdition part. Please, don't rush me

I didn't know that you used an iPhone.
Thus, we need to add buttons for tab and shift/tab. What do you prefer:
- in the title bar of the script
- in a supplementary row above the keyboard?

Please let me know and you will need to be patient: you will not get all functionalities briefly

cvp

@ihf example of what it could be on iPhone SE (small)

Icons would be at your own choice among iOS SFSymbols

cvp

@ihf If I can use shift-tab anywhere in a line, it is sure I can't use left-delete as key.
Thus I need to have a "new" key (like in my example just above).
So I also can use another key than tab for indentation, thus ok also in my example above.
So normal tab and normal left-delete will keep their original signification.

Ok with that and this additional row of specialized keys?

ihf

@cvp Firstly, please don't take any of my messages as indicating impatience. I am very grateful that you are taking on this project and am in no particular hurry at all. In so far as iPhone or iPad, I use both. As to special keys, I leave it to you for the best way to do it but I have no problem with dedicated keys given the absence of the tab key (when not using an external keyboard).

cvp

@ihf ok, sorry, I was afraid you could be hurry.
I'll go on with these dedicated keys, so you can have it on iPhone where there is no tab key.
After your future tests , we would decide how you prefer to use the script.
But I'm not yet far enough for a second version. I've been very busy this week-end, first sunny days since 3 weeks.

cvp

@ihf you will not have news before some days because we have our fist sunny days since a long time and I take some holidays.

cvp

@ihf I don't forget you. I'll send something testable, not perfect, end of next week, sorry for the delay.

cvp

@ihf Hello, I'm sorry but currently i can't concentrate well. Thus my script does not evolve a lot.
You will find in GitHub the last version but a lot of functionalities are still missing or buggy
You can already test the two additional keys but only at end of file because renumbering does not work correctly.
You can also test the Files sub-options new, open, save. This part of the script uses modules that you will also find in GitHub: File_Picker.py and Folder_Picker.py.
Thus here is outline.py.
The script uses any editable file (aaaa.bbb or aaaa) but creates a aaaa.content partner file with needed infos.
don't be angry if there are too many bugs, I try to find the motivation to go on...

ihf

@cvp if this is what you can do when you can’t concentrate well I can only imagine what happens if you have a cup of coffee (LOL). Do you want me to tell you about each bug I fall across or should I wait until you have a chance to do more testing of your own? One small thing, I noticed that when you start a new file you must hit tab before the outline begins. Unless you can see a reason for that, you might as well start the outline in the selected format immediately. Also would be nice if it continued with the last used file just to simplify continuing to edit an outline. I realize that move and copy, much less drag and drop, are still in the future, but what you have already done is very impressive.

cvp

@ihf said:

Do you want me to tell you about each bug

Not yet please, I know there are a lot of bugs actually...

cvp

@ihf said:

when you start a new file you must hit tab before the outline begins

Yes, because I thought that you want to start with a title line without outline.
I'll change that

cvp

@ihf said:

what you have already done is very impressive.

No

cvp

@ihf new Github available with

Version V00.03
  - at program end, outline.prm written with path and name of last edited file
  - automatic open last edited file at program start
  - automatic generation of first outline when new file
cvp

@ihf For those times when I don't have the motivation to think about automatic renumbering, can you explain how you see the move / copy / drag and drop?

cvp

@ihf how do you force a line to have same (invisible?) outline level than previous line?
If this functionality is allowed, the outline should be invisible but actually, the script displays
It in gray, just to be sure there is an outline

ihf

@cvp I created a new outline and enter a line (1.0), then a line under that (1.1), then CR which gave me (1.2), then a backtab made that 3.0 instead of 2.0
As far as move and copy, it was a pull down that said not implemented (in an earlier version). My hope is that you will somehow eventually be able to do drag and drop of parent and child nodes so that the outline can be reordered flexibly.

ihf

@cvp I found a few anomalies that I thought were easiest to show you with a screen recording. Please let me know if this works.
https://vimeo.com/560665894

cvp

@ihf said:

few anomalies that I thought were easiest to show you with a screen recording

It is good idea, and yes it works.

About the bugs, I knew them, coming from my "automatic renumbering" part, really not ready.

cvp

@ihf said:

My hope is that you will somehow eventually be able to do drag and drop of parent and child nodes so that the outline can be reordered flexibly.

I understand that. But, I can't do that before he normal process which is buggy in its renumbering part.
Drop will need automatic renumbering.

Could you explain me how you see this drag and drop?
How do you want to select what to drag?
How do you want the dragging operation?
How do you want to indicate where to drop?

And I promise that I'll at least try to process this drag and drop

cvp

@ihf New Github available with

Version V00.04
  - correction of (one) bug of automatic renumbering after line feed
  - correction of (one) bug of automatic renumbering after tab
  - correction of (one) bug of automatic renumbering after back tab
  - if outline is exactly the same as previous line, display it in gray
    nb: - actually, this should not be authorized but automatic renumbering
          sometimes generates such invalid cases
        - if this functionnality is allowed, the outline would become invisible
  - hide/show children supported (also saved for next run)
    nb: actually, for testing, not really hidden but small characters to check
        which lines would be hidden

I'm now open for bugs description and waiting for your move/drag explanation.

ihf

I envision drag/drop where I do a long press on a line which selects it together with any child nodes and then dragging it to another place in the outline where everything is then appropriately renumbered. Ideally, this paradigm would also work for promoting and demoting of parts of the outline. In other words, long press with drag to move elsewhere in the outline, and long press and slide to right to demote or slide to left to promote.

cvp

@ihf

it will probably not be exactly like that...

But I'll think about it...

cvp

@ihf before end of the day (European time), you will get a version to test "my vision of" drag.
Not yet a drop, just only to ask if you like it (please, answer sincerely).
This initial post only to warn you that the version will import @mikael 's module gestures.py.
Thus, up to you to already install it in your site-packages

cvp

@ihf New Github available with

Version V00.05
  - remove the "move" option from the popup menu when tapping an outline
  - to start a drag operation, long press anywhere on a line
    - hold your finger on the screen
    - pressed line and its children lines are set in a little mobile label
    - this label is above your finger so it stays visible why moving your finger
    - move the mobile label so its top/left blue point falls on a line
    - drop process is still to be developped, wait and see
      nb: actual drop process drops the entire text (outlines included) 
          at specified location

ihf

@cvp i just tried to run it and got name long_press is not defined (is that from gestures.py) if so perhaps my version is out of date?

cvp

@ihf long_press should come from gestures, try to download the last version

ihf

@cvp I think that once again i need to send a video but from another app called Notebook that is the best implementation of this that I have ever come across. Alternatively, we could do a Zoom so that I could share a window and show it to you.

cvp

@ihf That will say you don't like the way I do a drag and drop?
Ok for a video, no private dialog if possible

ihf

Here is a quick screen recording. The outline has controls on each line (optional) to make it easy to select with a mouse. Using drag/drop I think the finger (or pen) would just touch the line and long-press. This does not show all of the various ways that the outline can be re-ordered but it may give you some ideas. I can do more if that would be helpful.

https://vimeo.com/manage/videos/561037612

cvp

@ihf access denied, your link was not correct, ok if changed in vimeo.com/561037612

cvp

@ihf did you try my way? It is the solution of long press anywhere on a line to get it with its children for moving. Is that not what you asked? I thought it was exactly what you wanted by your sentence "Using drag/drop I think the finger (or pen) would just touch the line and long-press"

ihf

@cvp Yes that is correct but ideally it should only show the line(s) that are moving as you drag.

cvp

@ihf but, you asked to move the pressed line and it's children lines, what I did
In my example, I pressed the 2.3 ne the moving area contains 2.3, 2.3.1 and 2.3.2

cvp

@ihf and I could only move vertically, forcing the x at left, like

cvp

@ihf said:

as you drag

Do you want to say that I would only show the moving area if and only if I move my finger?

Ɖdit: I stop for today but, if you have still time, answer to the last question.., thanks

ihf

Showing the area to be moved before you actually move your finger is fine. My only concern was that it not be a box larger than the area of the text otherwise it can block out part of what you’re moving to (if that makes any sense).

cvp

@ihf ok, understood, it will be so

cvp

@ihf the next version will contain, for promote/demote by gestures, two ways:
- either by a long press on one line and moving the dragging box left or right on the same line
- either by a left or right swipe on one line (what I prefer)

You should try both ways and tell me which one to keep in the script, or we can keep both

edev7666

I would recommend an app called SpringNotes which does what you are looking for. It is an outliner that supports drag and drop for lists and auto numbers and syncs across Mac and iOS
https://springNotes.app

cvp

@edev7666 Thanks for the info. It is true that I never had searched for this kind of application.
I'll let @ihf decide

cvp

@ihf Anyway, a new Github version is available with

Version V00.06
  - moving box for dragging limited to text it contains
  - during dragging, a red line indicates where the moving text would be inserted
  - font button for font selection
  - font size button for font size selection
  - promote/demote by gestures:
    - either by a long press on one line and moving the dragging box left or right 
      on the same line
    - either by a left or right swipe on one line 

Don't forget that drop process is not yet programmed.

I'll stop my development until you have decided if you prefer your own script with a few functionalities or an app like adviced just above.

Please, tell me.

Nb: no qualms or regrets if you find an app that suits you better

cvp

@ihf Waiting for your decision, and for my own fun, Github up to date

Version V00.07
  - tap popup menu y-centered on the tapped line
  - popup menu now horizontal in more standard aspect
  - locally built icon for font size button
  - locally built icon for font button
  - correction of (one) bug of cursor always set at end of text
  - support outline bullets format
  - height of outline format types menu computed in function of types number
  - font size introduction via integer keyboard in popover TextField

Remark that's a third way to promote/demote outlines

harryjack

I am William Smith, a woo commercial builder and I have developed many plugins like WooCommerce Banner Images, WooCommerce Banner Images (Products, Post, Categories) plugin allows you to add Banners for sale, flash marketing, and other functions to promote your Product Categories, Pages, Products, Cart, Checkout and Thankyou Pages. The controller has full control of the plugin to enable or disable Banners throughout the store.

ihf

@cvp I have not yet looked at the app that is referenced above so I can’t directly comment on its functionalities relative to my needs. On the one hand, I am in awe of how much you have managed to accomplish up to this point and I love the idea of having an app, even with more limited functionality, written in python and extendable by others (at least potentially). However, I also don’t want to impose on you, so I completely understand if you would rather move onto another project. If you decide to continue, I am very happy to continue testing and making suggestions for improvements.

ihf

@cvp I took a quick look at the website and at the video of the springnotes app and it looks very nice but it is missing crucial features (at least as far as I can tell). In particular I don’t see any mention of outline format such as legal, or other conventional formats. It could be that they just didn’t mention it but that would be a reason for me not to use it.

cvp

@ihf said:

. If you decide to continue, I am very happy to continue testing and making suggestions for improvements.

Ok, let's continue the adventure but don't worry if I prefer develop new funny features than debugging hard bugs (I'll do it but you will obviously think that I'm too slow).

After you did read the V00.07 features, please answer to next questions.
1) First of all, what do you prefer as popup menu: horizontal black or vertical?
2) Do you agree for double tap instead single tap for this menu?
3) What gesture do you prefer for promote /demote: long press and move left/right or swipe?
4) Do I keep also these promote/demote in the popup menu?
5) as there is a red line to show where the moving text would be inserted, is the blue point needed?

As we will manage this program our-selves, we will be free for our imagination...
Thus, feel free to ask any improvement.
And please, don't forget that there are obviously a lot of bugs in the standard part, sorry for that

cvp

@ihf sorry, I just edited my questions while you arrived.

cvp

@ihf I'll force my-self: next week will be reserved for debugging (exception perhaps for very attractive new functionalities šŸ˜€)

ihf

@cvp I was about to test the latest version on a new iPad and I am getting an error at this line
from SetTextFieldPad import SetTextFieldPad
Module not found. Did I forget to install something on this tablet?

cvp

@ihf sorry, I forgot to mention it, to be downloaded here

ihf

@cvp
1. Not a strong preference but probably vertical
2. Double-tap is fine but sometimes it seems to work and other times it just brings up the cut/copy/paste and this error is appearing at gestures line 402: not enough values to unpack
3. Again no strong feeling but when I long press to move an item it should take the children with it. I may need to think about this and play with the Mac outliner to see how this is handled if you only want to move part of a level to another place. I assume you know that right now, when moving items, they are not renumbered correctly. (e.g., what you see here shouldn’t be possible https://imgur.com/a/TplSrjF?s=sms)
4. I think they are convenient to have there although Mai g to right or left should be able to demote or promote.
5. I don’t think the blue dot is needed.

cvp

@ihf said:

although Mai g to right or left

No comprendo

cvp

@ihf said:

when moving items, they are not renumbered correctly

That's drop, not yet programmed at all.

cvp

@ihf said:

Not a strong preference but probably vertical

I'll provide settings (new functionality) and this will be the first one: horizontal or vertical...

cvp

@ihf said:

what you see here shouldn’t be possible https://imgur.com/a/TplSrjF?s=sms

As I said, dropping is not yet programmed and standard process pastes entire text, including outlines seen as text, not as outline, reason why they are blue instead of red.
Thus, not a real bug because not really programmed. No panic for this one

ihf

@cvp Mai g =moving

cvp

@ihf some questions:
1 Is drag and drop used only for move or also for copy?
2 If yes, how do you want to differentiate both?
3 when you type a long text without CR, bigger than screen width, do you want the same alignment on the next line, without outline?
4 do you want a way to pass to next line, without outline but without long text?

If you want some little esthetic modifications (color, size, ....) don't hesitate.
If you want additional functionalities, don't hesitate to tell me, sometimes I want some fun when I'm too long busy on debugging šŸ˜€

If you are not in a hurry for a finished app, don't panic, we will overcome.

cvp

@ihf said:

Double-tap is fine but sometimes it seems to work and other times it just brings up the cut/copy/paste

I think it depends if you have your keyboard displayed or not.
Copy/paste menu is the standard menu if you tap on a selected area

Perhaps, it could be difficult to live with
- double tap for popup menu
- long press for dragging
- single tap for selecting
- single tap on selected for copy/paste menu
- single tap to set cursor

cvp

@ihf New Github available.

Could you, please, at least try new functionalities, not entire tests.

Version V00.08
  - no more blue dot at top/left of moving box
  - new settings button in main menu
  - support "popup menu orientation" 
    - new general setting
    - support both vertical and horizontal orientations of popup menu
  - bugs
    - correction of bug of two successive tabs on same line
  - support of drop
    - check no drop of a box of text into it-self
    - support of drop for move operation only 
      nb: draft process, several renumbering bugs subsist, be patient
  - support of "force a new line with same outline"
    - new general setting
    - new option in popup menu
      - with special icon if horizontal popup menu
    - generates an outline, same as previous line
    - no renumbering of next lines will occur
    nb: long lines automatically (by ui.TextView) break and should generate a same outline on next line, but this is not yet supported. 
    Force same outline functionality may be a workaround
  - support "same outline invisibility" 
    - new general setting
    - support both invisible or light gray (tests) same outline
  - begin of future (eventual) development for details of outline format types
    - better parametrization of format types
    - accessory info button in format types popup menu gives more details





haribol

Greetings friends,

Wow, @cvp , amazing and generous of you to develop this app on spec for @ihf .

Can't help but wondering, if anyone has looked at or considered the apps Dynalist or Workflowy. Both nicely featured outliners. Not to diminish the work done here, but thought I'd mention it.

I used to use Dynalist to keep all my notes and to-dos for a while; ended up going back to using Markdown files in a cloud folder, with Obsidian on laptop/desktop, and Editorial on mobile (which I purchased years ago). Have been stable with this setup for a while and like it quite a bit; experimenting a bit more with workflows and python in Editorial lately, and also Pythonista.

Anyway, thought I'd at least mention those, in case it's helpful.

There's another decent outliner I tried, but can't remember the name right now. Will try to look it up later.

cvp

@haribol thanks but only if I meet more fun than (my) bugs šŸ™„

cvp

@haribol Sincerely, I had never used an outliner thus I did not search for an app, but I guess that @ihf did not find the functionalities he wanted.

haribol

@cvp said:

@haribol thanks but only if I meet more fun than (my) bugs šŸ™„

Haha, can relate. Always nice to have a fun project to work on, while it's still fun, and if it can be a useful project for the future ...

cvp

New V00.09 available (normally, you should also read news from V00.08) with

Version V00.09
  - bugs
    - correction of bug of crash when "drop before first line"
      nb: new renumbering bug has appeared, not yet solved
    - correction of bug of crash with "'Outliner' object has no attribute 'target'"
    - hidden but identic (invisible) outlines do not have the font size of hidden
    - tapping outside textfield (font size, searched text) closes the entire app
    - same outlines (gray) do not have same font_size as normal ones
  - moving box
    - will now contain coloured outlines
    - the moving box was displayed above the finger position to allow to always
      see where it would be inserted, but, at the top of the text, the box was
      outside the screen, thus invisible. Now, this box will be drawn at right
      of the finger.
  - search in lines
    - new main button for searching
    - display an ui.TextField to enter the searched text
    - display only lines containing the search text (case,accents non sensitive)
      nb: displayed lines vary in real time
    - press enter to close the TextField and come back to full display
  - review .content file for future improvements like outline hidden, style etc...

Finished for today, promised

ihf

@cvp As far as I can tell, neither of the apps mentioned above are able to format the outline in the Legal, Harvard, or other standards. I also don’t know if they allow drag and drop to reorder. I’m not saying that there isn’t an app out there that does these things but so far I haven’t come across it. There are MANY outliner apps available. Some require a monthly subscription, others require logging into a commercial server, But the ones that I know about have all sorts of features that I don’t have much use for and don’t have the features of interest to me. My guess is that Emacs can do the formatting but would lack any GUI. I am amazed as to what @cvp has already accomplished and as long as he is willing to continue working on it, I am happy to provide further feedback.:-)

cvp

@ihf Please send me some feedback, even negative, about all new functionalities.
And, I know that there are a lot of bugs in the renumbering.
I'll use next week to try to solve most of them

cvp

@ihf New V00.10 available with correction of two bugs that could lock you if you find some time for testing

Version V00.10
  - bugs
    - correction of bug "tab crashes on replaceObjectsInRange out of bounds"
    - correction of bug "incorrect renumbering lines after CR"

And, now time for sleeping

ihf

@cvp I tried creating a simple outline and then moving parts of it using long-press but I did not get very far. (https://vimeo.com/562564194) Perhaps I am making some simple error in use. I also tried reopening an outline and positioned the cursor at the end, hit return, and got an arror "UnboundLocalError" on line 533 (textview_should_change). I will continue to try and see if I can create a simple outline and move parts of it. Does the move take all children of a node with it?

cvp

@ihf I your video, I see that you use version V00.05 but the last version I sent you was V00.10, thus you use a very old version.
You have to install each time the last version or you will find bugs, perhaps already solved in a newer version. I'll never be able to reproduce the same problems as you because I don't keep old versions.

cvp

@ihf said:

Does the move take all children of a node with it?

Yes, as you asked.

For example, here I long pressed on the 5.2 line to get this moving box

cvp

@ihf New V00.11 with correction of some bugs. please be sure to install it before any new tests.

Version V00.11
  - bugs
    - correction of bug "characters insertion before an outline was allowed"
    - correction of bug "CR before an outline was allowed"
    - correction of bug "CR before a line without outline crashed"
    - correction of bug "CR at begin of file before an outline was incorrect" 
  - support CR in the middle of a line, with renumbering of following lines

I'm busy to do some tests, really not full time, but I think that when I change one line to correct a bug, I generate two new ones, thus, don't' be angry but it will take some time, sorry for that.

ihf

@cvp sorry about that…i downloaded a new version but had an old version open…won’t happen again :-) i tried the new version and when i typed a char on the 1st line, I got an IndexError at line 1088.

cvp

@ihf I want to cry... I'm sure this did not occur previously.
Sorry, I get too much problems, I need to correct them.
Sorry, sorry, sorry

Please stop all until I warn you.

I've too much new bugs each time I correct a bug...
I'll try to find the patience to review the whole code, at least this part.

And I'm not so much free this week

Tomorrow: tab key
- at begin of file if empty (actually ok)
- at begin of file if only one line without outline (actually ok)
- at begin of file if only one line with outline (actually ok)
- at first line if outlines 1.0 and 2.0 exist and tab on 1. 0 (actually bug)
- at first line if outlines 1.0 and 2.0 exist and tab on 2.0 (actually bug)
and so on

Sorry to be so slow

cvp

@ihf Perhaps I become too old for this stuff

cvp

@ihf New V00.12 available with

Version V00.12
  - bugs
    - full review of tab process and checks
    - full review of backtab process and checks
    - correction of bug "typing a tab or backtab before an outline was now allowed"

You may restart tests about tab and back tab and their automatic renumbering.
And if it seems ok, you can test drag and drop (renumbering part after delete original lines not yet full ok )

cvp

@ihf Weather is very hot here, I don't want to debug more today.
But some free time for some questions about new functionalities or updates:

  1. you know that you can use standard copy and paste. It would be easier for me to not allow paste of text containing one or more CR. Is it acceptable for you?
  2. when I present the moving box, the text has a particular font and font size, but would you prefer that I use the same font and font size as in the TextView?
  3. you know that drag and drop is a move, buT do you want also to support copy of some lines and their outlines. If yes, how to choose move or copy? I could ask a question just at drop.
  4. you had asked me if I drag the selected line with its children. The answer is yes but do you want to support with and without children. If yes, how to choose it?
ihf
  1. I think that would be fine. I rarely need CR within an item
  2. Yes, I think the same font would be better
  3. For the drag/drop UI only move but copy/paste with the usual menu.
  4. I think always move with children (but not siblings)
cvp

@ihf said:

For the drag/drop UI only move but copy/paste with the usual menu.

What do call the usual menu?
Standard menu of Apple copy/paste =select....
Or the popup menu of the

ihf

I was referring to the standard Apple copy/paste menu.

cvp

@ihf but tHe copy with the standard menu does not allow the drag operation of a line and its children

ihf

That is true although i just tried doing a copy/paste with the notebook app and somehow it knows to copy the parent with its children although i think i found a bug with that, so maybe ignore that case.

Unrelated, i just did a few drags using the latest version and got this.
https://imgur.com/a/RCH9NQo

cvp

@ihf said:

did a few drags using the latest version and got this.

Sure I have still problems with drop.
Please test only tab, back tab and CR to see if their renumbering works..

cvp

@ihf said:

copy the parent with its children

Would you like to have a new option in the popup menu of the app (remember, you have to double tap on a line having an outline): "Copy line with its children"?

The script could
- display the moving box like if you had long pressed the line
- intercept your finger that will touch and move the box and drop it like for a move
- copy the lines of the box without deleting the original lines

You will even get the same bugs as for the move process šŸ˜‚

cvp

@ihf said:

Unrelated, i just did a few drags using the latest version and got this.
https://imgur.com/a/RCH9NQo

I am interested to receive photos of before (including the moving box and the red line showing where you will drop) and after the drop

Like in this example, you see, all has been ok, renumbering included

ihf

@cvp I am not quite sure how I created that outline and got the error but here’s another video which gives a list index out of range. It may or may not be related. There is a small problem I found where if I don’t save the outline and then the next time I try to create a new outline with the same name it says that the file already exists but if I try to load that empty file I get an error.
https://vimeo.com/562914682
I will try to be more systematic and record what I do before getting an error.

ihf

@cvp different error: https://vimeo.com/562920493

cvp

@ihf New V00.13 available. I've spent a lot of time for debugging, version should be cleaner but there are still some renumbering bugs. Also, a new functionality to see easily where are located the original area of dragged lines.

Enough for today...

Version V00.13
  - bugs
    - correction of bug "new file was saved as first use, even if not asked"
    - correction of bug "enter in font size did not close the textfield"
    - correction of bug "error 'list index out of range' at end of file"
    - correction of bug "error 'list index out of range' in renumbering"
      if last line has a CR"
    - full review for renumbering for 
      - tab" 
      - "lf " 
      - "backtab" still in progress
      - "dropped lines" 
      - "removed lines of dropped original" 
  - text in moving box will have same font and font size as TextView text
  - support "show original area" 
    - new general setting
    - display or no a coloured rectangle on the original dragged area

ihf

@cvp Line 1150 tap is not defined. Did i lose something?

cvp

@ihf did you get an error, if yes, post the full traceback

cvp

@ihf when you download my script, do you change sometHing?

ihf

I did not knowingly change anything but I decided to test on an iPhone so it is possible i lost something.
Traceback (most recent call last):
File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/outline.py", line 1869, in
main()
File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/outline.py", line 1865, in main
mv = Outliner()
File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/outline.py", line 527, in init
doubletap(self.tv, self.doubletap_handler)
NameError: name 'doubletap' is not defined

cvp

@ihf perhaps you did not install the last version of gestures in your iPhone

ihf

@cvp I was virtually certain that I had but I just redid it and it seems to be working again. I find that doing a long press on the iPhone, especially given the size of the font, is rather difficult. I just created an outline and did some moves and ended up with the following:
1.0_a
2.0_g
3.0_cc
3.0_b
3.2_dd
3.2.1_eee
3.2.2_fff
4.0_h

cvp

@ihf did you some backtab? I know that it generates still bad renumbering.
Or you send me a video like usual.

But, I don't work anymore today

cvp

@ihf said:

. I find that doing a long press on the iPhone, especially given the size of the font, is rather difficult

Sure, if you like it, I could add the move option in the popup menu that you get by a double tap.

cvp

@ihf said:

I was virtually certain that I had

It was on your iPad, I guess.

ihf

@cvp running the latest version. I am having a lot of trouble selecting portions of the outline to move. Is there a trick? I am getting the ordinary apple cut/paste menu when I long press. Perhaps the font needs to be larger as well (or my fingers are too large :-)

cvp

@ihf Nothing has changed about that but you have a button to increase the font size...

cvp

@ihf said:

my fingers are too large

I've sometimes the same problem with my iPad. There is a mix between long press and the way to get select then copy/paste menu.

If you imagine another way, like an option move in our popup menu called by the double tap, or any other new button, I could change that, and keep also the long press.
But you have to decide.

cvp

@ihf New V00.14 available, with

Version V00.14
  - bugs
    - correction of bug "backtab on a line did not also backtab its children"
    - correction of bug "drop after last line didn't do anything"
    - full review for renumbering for 
      - "backtab" 

I've cleaned my own bugs list, but be sure there are still a long list of bugs.
But, now up to you to test and to feedback the bugs with, if possible, a short video when reproducing them. Please, if you meet one bug, don't stop your tests, script is long then you can go trough other parts of it.

Some questions: do you want some new options in the popup menu:
- move line and its children, to replace long press
- copy line and its children, like move without deleting original lines
- delete line and its children
- delete line without deleting its children, move them back one level

ihf

@cvp I will test the new version later this morning but my problem is that getting either the double tap or the drag function to work is hit or miss with it working only sporadically. I am afraid that adding to many options to the menu may make it rather confusing and awkward but let me test some more with V00.14.

cvp

@ihf ok, if you imagine another way, like a button per line like other outiner apps, tell me

cvp

@ihf when you read this, please, reload the V00.14, move process was commented, sorry

ihf

@cvp I just tried with v0.0.15 but was not able to get either double tap or long press to work at all.

cvp

@ihf wow, it works for me... No error messages?

I can't give an advice... Restart Pythonista?

ihf

@cvp got things working again. Was able to do some moves. After promoting and moving an item, I managed to get into this state:
https://imgur.com/a/NxJFpk2

I meant to mention that there is bug where if you create a file, never save and start rhe program it gives an error about the .prm file not finding the file.

cvp

@ihf said:

gives an error about the .prm file not finding the file.

Not a bug, normal warning foreseen if you manually delete a file that is indicated in the .prm for the restart.
If you press ok, you will start the script normally.

cvp

@ihf said:

managed to get into this state:

I would like how to reproduce it.
Because, you have two 4.0, and that is abnormal except if you ask it via the popup option.

And when you meet a crash, please try to get the full traceback, thanks

cvp

@ihf I hope that even if you meet one bug, you don't stop your tests.

ihf

@cvp Of course not. I wish there were an easier way to show what I've done to get the errors. I use video but that means doing a screen recording, uploading to vimeo, getting a link and copying it to the forum. I think I will try to write down what I do since I can't remember it well enough to reconstruct it once I hit a bug. Perhaps a debug log could be created so that I could send you that each time I find something?

ihf

@cvp I think that the show and hide children function would be better done as a symbol to the left of the item rather than in the double tap menu.

cvp

@ihf Perhaps I could log all what you are typing...But quid For touches? Need to think but not for today.
End of the work day for me
I hope you don't find the total delay too long.

cvp

@ihf said:

think that the show and hide children function would be better done as a symbol to the left of the item rather than in the double tap menu.

Future...

ihf

@cvp could we at some point add support for external keyboard tab and back tab?

ihf

@cvp I'm only mentioning it now because I will forget otherwise :-)

cvp

@ihf said:

could we at some point add support for external keyboard tab and back tab?

Sure, but I don't have any keyboard, thus you have to tell me which \xnn the keys generate.

ihf

@cvp OK ,need to find how to do that for tab and shift tab.

cvp

@ihf ok, I stop now

cvp

@ihf little script which should give the hexadecimal of your pressed keys

import ui

class MyTextFieldDelegate (object):
    def textfield_should_change(self, textfield, range, replacement):
        for character in replacement:
            print(character, character.encode('utf-8').hex())
        return True

tf = ui.TextField()
tf.delegate = MyTextFieldDelegate()
tf.present('sheet')
ihf

@cvp when using the external keyboard, tab (demote) shows as ā€˜09’ as does shift tab (promote).

cvp

@ihf said:

tab (demote) shows as ā€˜09’ as does shift tab (promote).

Weird but I can't help. Perhaps somebody can help?

cvp

@ihf New V00.16 available, with

Version V00.16
  - support "log" 
    - new general setting
    - log each typed key
    - play log typed keys
    - log each move
    - play log move

It supports a log of all your actions (I hope) and a way to play the log so I could reproduce a problem to (try to) correct it.
The script has a new setting " log active".

To get a log:
- set the setting log active
- create a new file
- do your actions
- terminate the program (the log file is created even if you don't save the file itself)
- rename manually outline.log in any xxx.log

To play the log
- set the setting log active
- create a new file
- select in Files, play log
- it should run automatically your commands

To send me a log
- post by pasting the log content (editable file)

cvp

@ihf New V00.17 available with

Version V00.17
  - support "hide/show children via buttons at left of outline

My 2nd gift of the day

ihf

@cvp Wow! I will test as soon as I am able (probably not before this evening).

ihf

@cvp I turned on the log and immediately got an error on line 1081 saying Outliner object has no attribute log_fil

cvp

@ihf I think you have turned it after a file has been loaded

Please try to set the flag, then new file

cvp

@ihf To avoid confusion between long press / double tap on an outline,
and standard gestures for text selection (copy, paste), a solution could be a button covering only the outline, but not the text it-self.

And a single (or double as you prefer) tap on the outline would generate the popup menu (if needed), and a longpress on the outline would start the drag and drop process.

Thus,
- own process by gesture on the outline
- standard process by gesture on text it-self

Do you want that?

cvp

@ihf New V00.18 with

Version V00.18
  - bugs
    - correction of bug "bad renumbering after drop"
    - correction of bug "crash 'tuple index out of range' if change outline type"
    - correction of bug "crash if drop after a line without outline"

I hope that you did not spend too much time in testing the drop because its (new) renumbering was very bad, sorry for that.

cvp

@ihf Shift tab on external keyboard: try Control + Shift + Tab

And did you set:
Control iPad with an external keyboard
Go to Settings > Accessibility > Keyboards, tap Full Keyboard Access, then turn on Full Keyboard Access. Control your iPad using keyboard shortcuts.

ihf

@cvp I turned on log before creating a file it. I created an outline and saved it but when I looked at the log file it was empty.

cvp

@ihf weird, I do
- log on
- new
- type outline
- end without saving

outline.log contains what I typed

Don't come back in the script before you check the .log

The log is not xxx.log but always outline.log, did you know it?

cvp

@ihf No news, no answer to my post beginning with "To avoid confusion between long press / double tap on an outline"...
Do we stop the project?

ihf

@cvp I'm sorry for the delay in responding. My problem is that I can't seem to reliably get long-press to be recognized and therefore begin the drag/drop. Is there a specific part of the line that needs to be touched to make this work? Also renumbering is failing for some moves.

Here is a log file and an image of the outline (which ought not to be a valid outline).

0,0,01
4,4,61
5,5,0a
10,10,62
11,11,0a
16,16,63
17,17,0a
22,22,64
23,23,0a
28,28,01
30,30,65
31,31,0a
38,38,66
39,39,0a
drop,12,32,40

https://imgur.com/a/lbVJEkt

cvp

@ihf said:

My problem is that I can't seem to reliably get long-press to be recognized and therefore begin the drag/drop. Is there a specific part of the line that needs to be touched to make this work?

The problem comes from the fact that the long press gesture is linked to a TextView which can also be touched by standard gestures for select/copy/paste.

That's why I propose to override the outline text by a transparent view which would be touched by a long press while the text it-self would stay touchable by standard gestures of a text.

So, popup menu and long press should only be active on the outline and standard menu should only be active on the text it-self.
But I need your ok before to develop this important modif.

cvp

@ihf said:

Here is a log file and an image of the outline (which ought not to be a valid outline).

I'll study this case tomorrow but I know there are still renumbering bugs in some moves.

ihf

@cvp Your idea sounds like it would solve the problem I am seeing.

cvp

@ihf said:

Your idea sounds like it would solve the problem I am seeing.

Ok, I'll develop that in priority...Tomorrow, except if I get a no go from you this night

cvp

@ihf your renumbering bug: you move to after 2.0
Do you want The f becomes 3.0 or 2.1?

ihf

@cvp Good question. On the Notebook app that I've mentioned earlier, if you move to under the 2.0 it becomes 3.0 but if you move to under the b (in 2.0) then it becomes 2.1. So it is sensitive to whether the location is indented or not.

cvp

@ihf said:

So it is sensitive to whether the location is indented or not.

That becomes complex, isn'it?

cvp

@ihf V00.19 will include

  1. gestures on outline <> gestures on text

  1. difference between drop under outline or under text, in function of horizontal position of finger

  1. drop under outline or under text

cvp

@ihf New V00.19 available with:

Version V00.19
  - correction of bug "log may not be activated after an 'open file'"
  - correction of bug "move last line shows a too high pink area"
  - correction of bug "bad renumbering after move"
  - support new setting "font size of hidden outlines, may be set to 0"
  - support longpress and double tap popup menu only on outline
  - support standard gesture select/copy/paste only on text it-self
  - differentiate if we would drop under the outline or under the text
    by start the red line at left of outline or left of the text
  - support drop under outline and under text
ihf

Is there a way to promote by drag/drop? For example in the outline below,: is there a way to take 4.2.1 and move it with children to 4.3?
https://i.imgur.com/XoyFoue

cvp

@ihf I don't understand the request: why a drag/drop if you can do it with a backtab on 4.2.1which will become 4.3 and its children would follow.

But, if you want it becomes 4.2, you can drag/drop,

If you drag/drop to under (see where begins the red line)
- an outline, the first moved line will have the level of the target.
- a text, the first moved line will be a child of the target

You decide where begins the red line by moving left/right your finger while dragging

cvp

@ihf there are still bugs of renumbering when dropping a group with children under outline of a line which has itself children...and I am completely drowned šŸ¤”

cvp

@ihf New V00.20 available with

Version V00.20
  - review all renumbering (one more time)

If you have met some renumbering bugs with V00.19, please retry with V00.20

ihf

@cvp yes , you can promote by moving the child above the desired point and then moving it down. The notebook app permits this in one step by moving to the left. Currently this triggers the error of moving to itself. However, you are also quite right to say that the back tab will accomplish the same in one step. I did hit one Indexerror (out of range) but I’m not sure how i got it. I think outline.py is now working rather well. I will do more testing. I am amazed at what you have been able to do and I thank you for all of your efforts.

ihf

@cvp future enhancement: add checkboxes to outline.

cvp

@ihf said:

The notebook app permits this in one step by moving to the left.

Don't forget that I have also foreseen the left or right swipe gestures to promote/demote.
Better than a long press, I think.

But ok, next version will also include left and right move during longpressing

That will say you will be able to promote/demote by 4 ways:
1. Tab and back tab keys
2. Double tap an outline and choosing tab or backtab in popup menu
3. Swiping left or right a line of text
4. Moving left or right a long pressed outline

cvp

@ihf said:

add checkboxes to outline.

Where? At left or right ?
And For what purpose?

ihf

@cvp At left of text. For task or todo lists. As an option.

ccc

Like a Markdown checklist?

[ ] Milk
[ ] Bread
[ ] Eggs
cvp

@ihf said:

At left of text

At left of text, like @ccc 's example or at left of outline?

āœ… ā–¶ļø1.1.1 text
ā–¶ļøāœ…1.1.1.text
ā–¶ļø1.1.1.āœ…text

There are a lot of possibilities,
- before/after the arrow of hide/show
- before/after the blanks of outlines (vertically aligned or not)

Is this ok? Ho yes, this image shows also a new feature of gray lines drawn to separate text lines

cvp

@ihf New V00.21 available with

Version V00.21
  - correction of BIG (sorry) bug "hide/show icons were not synchronized with lines
    when scrolling more than one screen"
  - correction of bug "tap outside search field while it was not empty" does not 
    reshow all lines""
  - support move left/right dragged box on its initial line to promote/demote
  - support "show lines separator" 
    - new general setting
    - display or not a line after each (not hidden) text line
   - support "checkboxes" 
    - new general setting
    - display or not a checkbox in front of (not hidden) line
    - store checkbox per line in the .content file

But....

I don't like my program.
Outlines are identified by their position in the text, and this is very fragile. Even the smallest bug has huge consequences.
You remember the discussion with @mikael about choosing between ui.TextView and ui.TableView. I am still (until when?) convinced that ui.TextView is better in this case but I think that I should completely revise my script to remember the identification of outlines by their line number rather than by their position in the text.
But this can be a huge job with the risk of lots of new bugs.
Anyway, the actual script could become much too slow for long texts ...

Since I play with ui.TextView (ObjectiveC) inset to solve problem of desynchronization between text lines and their checkbox and hide/show buttons, a bad scroll is done when typing in a file longer than one page. This problem is still present, sorry for that.
And I'm looking for the reason for hours... 😢 I have enough for today

Ɖdit: perhaps is this problem existing for weeks but I never did play wiTh a text bigger than one page, thus who knows? Did you?

ihf

@cvp i did not try long lines or outlines longer than a page. This weekend I would like to try using it for a ā€œrealā€ outline to see how it works in practice.

ihf

@cvp Checkboxes are being reset as soon as I type a new item

cvp

@ihf said:

Checkboxes are being reset as soon as I type a new item

I don't understand : do you want the checkboxes to be all reset as soon as you type a new line?
Don't you prefer a title bar button to reset all?

For instance. If your list is a todo list, and if you have already done some tasks, I don't understand why if you add one task in your list, you have to reset all already done task.

cvp

@ihf scrolling bug: only to be sure you know it: if you have a text longer than one page, il you set cursor in the first lines, then type something, at each TextView automatically scrolls to the end of the text... Annoying

I'je just spent more than 4 hours to try to identify why, but without success. Sorry for you

cvp

@ihf said:

Checkboxes are being reset as soon as I type a new item

Sorry, I did not understand. I thought it was a request, but it is a bug. Shame on me.

cvp

@ihf New V00.22 available with:

Version V00.22
  - correction of bug "if text bigger than one screen, any typing
    automatically scrolls until end of file".
    workaround found is to locate text row at edited line
  - correction of bug "checkbox was not saved correctly in .content"
  - correction of bug "checkboxes are being reset as soon as new item is typed"
cvp

@ihf I have some bugs for lines without outline. I did foresee that for headers.

Question : Do you use that?

cvp

@ihf New V00.23 available with

Version V00.23
  - correction of bug "paste text containing CR did lock the script"
  - correction of bug "popup menu location incorrect if long text"
  - outline showed in yellow in horizontal popup menu, to be sure
    the menu is relative to the tapped outline
  - new functionnality: undo
    - new button in main menu
    - shows name of action undoable in red on the button
    - operational for undoing move (drag/drop)
    - operational for undoing CR (linefeed)
    - operational for undoing tab (demote)
    - operational for undoing back (promote)
    - disable if typed or deleted characters 

ihf

@cvp In answer to your question, no, all lines can be part of the outline.

Unless you see a need for it, perhaps you could eliminate the error message about a .prm file being cleared when the last file worked on is not present. I think that if the last file that was used is no longer there, then the user can just create a new file.

Also would it be possible for the program to remember font prefs? I find that the 14 point default is too small for me, so I always have to change it to 18 (or greater). Unless you are doing auto-save (which would be a nice option but not absolutely essential), then why not have the user specify a name and location when they save (could be reminded at exit?). I prefer to be able to start the script and just begin writing rather than naming the file, selecting its location, changing font prefs, etc.

cvp

@ihf said:

eliminate the error message about a .prm file being cleared

Will be done

cvp

@ihf thƩ font size, The path and the file name are saved in .prm, thus when you come back, all is known.
What changement do you want?

cvp

@ihf said:

14 point default is too small

Will be 18 in next version for a new file

cvp

@ihf said:

Also would it be possible for the program to remember font prefs?

In the next version, font and font size will be stored in .content of each file, thus when you will reopen a file, the used font and font_size will be set as they were in the last use of the file.

cvp

@ihf New V00.24 available with

Version V00.24
  - default font size will be now 18
  - no more alert if last open file, stored in .prm, does no exist anymore
  - font and font_size saved in .content, so when file is open, they are known
  - backtab on an outline of first level not allowed

That's all folks, ......for today

ihf

@cvp V00.24 is sometimes crashing Pythonista. I will try to find a minimal failing case although I am not doing the same thing each time I've seen this. I also noticed that a few times it was adding letters at the end of a line that I didn't type (?). For example I typed "Create account" on a line and Outline shows Create accounttn with the cursor before the last 2 chars. I don't know if it matters but I am using the external Apple keyboard (I wasn't for my earlier testing).

Also, the default font size is still 14.

File rename feature would be useful. I can just change the name in Pythonista but I assume that will break the .content or other files you use.

Also, Drag/Drop seems to be having issues. I am trying to move the last item in the outline up. I do a long press and when it works at all (intermittent) it is selecting an item 5 places above in the outline. Unrelated, if I am able to select something to move and I decide to put it back where it was (no move), there is an error message about not being able to move something to itself.

Future enhancement: web links in outline.

cvp

@ihf wow, I'm afraid with all these weird bugs. it will ruin my sunday

cvp

@ihf said:

the default font size is still 14.

I think that when you create a file, it uses the last font_size....

Ok, I'll use default font Menlo and font size 18 when creating a new file

cvp

@ihf said:

it is selecting an item 5 places above in the outline

Was it in a long text, more than one page?

cvp

@ihf said:

I decide to put it back where it was (no move), there is an error message about not being able to move something to itself.

Normal process, actual only way to cancel the move. Until you tell me how we could be able to cancel a move.

Ok, I could see that you come back at the original line and I could cancel the move without error.

cvp

@ihf said:

V00.24 is sometimes crashing Pythonista.

See _objc_exception.txt file or faultlog folder

cvp

@ihf said:

File rename feature would be useful

Stored in my todo list

cvp

@ihf said:

web links in outline.

What do you want?
Automatic underlined and clickable? For all http://xxxx or https://xxxx in the text?

cvp

@ihf said:

For example I typed "Create account" on a line and Outline shows Create accounttn with the cursor before the last 2 chars

Never seen during my multiple tests (without external keyboard).
Try to reproduce it and get the .log

cvp

@ihf said:

typed "Create account" on a line and Outline shows Create accounttn

During my tests of web link, I got the same problem:
I type Goog
Keyboard proposes Google but Goog is selected in my TextView
I type l
And I get Googlel

Easy to reproduce,
Type accou
Keyboard proposes account
Type on proposed word
You get account nt

After 3 hours of search, I've found the reason. An important part of the process is done in the TextView_should_change delegate because I have to intercept tab, backtab and CR characters to change typed text. All works (perfectly šŸ¤”) but in the case of predictive text, if not fully typed (like accou for account), I've discovered that the delegate calls it-self when TextView.text is changed in the def. Thus parts of process are realized twice. I'll protect against that by checking if the delegate is called by it-self, and in this case, no process at all would be done. One of the most complex (to solve) bugs I met in my Pythonista's life...

From now, could we identify each question, bug, request by an identifier, like Q1, B1, R1 so we can discuss about an item without each time need to reidentify it. Thanks

cvp

@ihf said:

why not have the user specify a name and location when they save (could be reminded at exit?). I prefer to be able to start the script and just begin writing rather than naming the file, selecting its location, changing font prefs, etc.

I'll think about that, but not vital actually

But if you prefer that I program auto-save, tell me before...

cvp

@ihf New V00.25 available with

Version V00.25
  - correction of bug "predictive text may generate crash or doubled end characters"
  - no more error message when you drop a box on its original area, used to cancel
  - new file will use default font Menlo and default font size 18
  - support clickable (short press) and underlined weblink
    on all words (ending with a blank) beginning by http:// or https://
    nb: be careful, url is case sensitive
  - new option in Files popup menu: rename
    - check actual file and its .content exist (not the case if new in progress)
    - ask new name
    - check renamed file and its .content do not already exist
    - rename file and its content

cvp

@ihf New V00.26 available with

Version V00.26
  - support "auto-save"
    - new general setting no, each character typed, each line by CR, tab, back tab
      nb: time of last save (in hh:mm:ss.ssss) is shown in settings screen
    - save in function of setting and typing 
    - save will now
      - delete .old files if they exist
      - rename files into .old 
      - save files

ihf

The way save works now, I can save to a local file. Is there anyway that outline could save the file to a network location? Ideally this would be any location that the files app can access but there may be limitations in Pythonista that prevent this.

cvp

@ihf said:

any location that the files app can access

That should be possible with a modification but you have to, only once, define which external folders you want to access via open external, then folder in the Pythonista left tree

ihf

@cvp i just tried and it only showed iPad local and iCloud as available options. NextCloud and others are grayed out. iCloud should at least permit me to share the outline between ios devices.

cvp

@ihf yes, some like Dropbox, Google Drive, and maybe NextCloud (I don't know) are not real file systems but client/server needing special app to be accessed.

Thus the maximum you could access with Pythonista is:
- On my iPad, but only user data, not from other apps if you open once It external
- iCloud Drive but only user data, not from other apps if you open once It external
- Pythonista local files (like now)
- Pythonista iCloud
- USB device if you open It external, each time you insert it

cvp

@ihf ThƩ actual version has a bug that crash's the script. The .prm file contains a bad parameter.

You have to install the new V00.27 with:

Version V00.27
  - correction of bug "auto-save parameter incorrect in .prm file"
  - temporary workaround to scrolling problem: when typing in a line, automatic 
    scroll so this line is at top of screen and you don't have this annoying
    scroll at each typed character. But this does not work each time. Weird
ihf

@cvp Not sure what I might have done to trigger this but now when I start typing on a line, that line goes to top of screen hiding everything above it in the outline while I am typing and outline returns when i hide the onscreen keyboard. I don’t know if it’s related but I did try using an external keyboard to type in some lines and then stopped using it.

cvp

@ihf said:

when I start typing on a line, that line goes to top of screen hiding everything above

That's so actually, wanted, not a bug, as workaround of automatic scrollling to the end at each typing.
At least, you see what you type. With the bug, you don't see what you type.
Try to test so
Sorry for you but this bug seems very difficult to correct,

ihf

@cvp It also hides everything above the point of insertion after moving lines. I understand that this is needed due to the scrolling bug, but unfortunately it is not really intuitive.

cvp

@ihf New V00.28 available with

Version V00.28
  - support "Files"
    - new general setting local, iCloud, on my iDevice, iCloud Drive
      - if not accessible, segment will be disabled
    - file picker on selected folder

The file picker needs to know in which top folder we want to browse.
So I created a new general setting

Where you have to select on which top folder you want to pick a file.

Folder_picker for new file does not yet support this.
On my iPad has a path like /private/var/mobile/Containers/Shared/AppGroup/1B829014-77B3-4446-9B65-034BDDC46F49/File Provider Storage/ but it's device Id is not the same as this one of local files, thus I can't yet generate it, thus only local Pythonista, iCloud Pythonista and user iCloud Drive are accessible.
I provide already the feature so you can check if it is ok for you.

cvp

@ihf said:

It also hides everything above the point of insertion after moving lines. I understand that this is needed due to the scrolling bug, but unfortunately it is not really intuitive.

I understand it is annoying but, believe me, I search the bug for hours.
You will'have to live with this workaround for some days. Sorry but I think you can test anyway a lot of the new features you have requested. We are very far of the initial specs of one month ago.šŸ™„

cvp

@ihf New V00.29 available with

Version V00.29
  - support top folder also for folder_picker when creating a new file
  - bad scrolling at typing normal characters solved in some cases, 
    but not all, bug still not identified...

I
I'm my-self no more free today...
Good luck with the tests

ihf

@cvp how do you delete a line in the outline? I have a line with no text on it and if I hit the delete key it tells me I can’t go back level but how is a line deleted?

cvp

@ihf said:

how do you delete a line in the outline? I have a line with no text on it and if I hit the delete key it tells me I can’t go back level but how is a line deleted?

No yet foreseen and it is one of my future questions: how do you want to delete a line?

cvp

@ihf Hi, I already told you that I don't like my script.
I would like to rewrite it partially to replace the TextView by a TableView.
Why? Because
- the problem of bad scrolling comes from content_offset not working correctly
- I don't see how I could process long lines without LF with the same outline
- the process would be faster (I hope)
But it would take a lot of time and I am going in holidays for 3 weeks in July.
I'm not sure you could wait until mid of August before receiving a new script.
your opinion please. Thanks and sorry for the delay.
NB: @mikael was right, as usual...

Ɖdit: I want to do it. And I'll try to do it before my holidays but not promised.
Sincerely sorry for the delay. Good lesson for me, always listen to the masters, even at my age.

cvp

@ihf I have seen that you have read my last post but you did not react. Are you ok with tHat?

ihf

@cvp Regarding how to delete a line, the way the app I have been using works is that you highlight the line and hit delete butI'm not sure of the best way to do this on a touch device.

As far as waiting, please do this at your pace not mine. I am just very grateful that you have taken on this project. I will be happy to test and report back to you on what I find and how I think the program could be improved.

cvp

@ihf Ok, thus we both agree that I'll take the time to review my script so it will work with a TableView.
Could you tell me which ones of these ways you use to promote/demote

  • keys of supplementary row above the keyboard
  • left and right swipe the text part of the line
  • the options of the popup menu displayed when you double tap the outline part
  • left/right swipe while you are in a long press

I ask that because if you don't use left/ right swipe of the text part, we could use the standard way to delete a TableView row by a left swipe

Thus delete will be supported but how?
And if the line has children? Quid? Confirmation?

ihf

@cvp In order of preference (although I can and would use any or all methods to demote/promote):

  1. left and right swipe the text part of the line
  2. left/right swipe while you are in a long press
  3. keys of supplementary row above the keyboard
  4. the options of the popup menu displayed when you double tap the outline part

I practice, I suspect that 1. or 2. are equal except that sometimes I have trouble getting long press to work properly. (Perhaps that is no longer true).

3 is fine, although it would be very nice if I could also use keys (tab, and shift-tab) on an external keyboard.

The way I am accustomed to delete working in the outline is that I tap once on the line to highlight it and then hit delete. Delete takes children with it.

cvp

@ihf said:

tap once on the line to highlight it

If you tap once on the text part, you will edit it
Do you want to tap once on the outline part?

cvp

@ihf said:

I suspect that 1. or 2. are equal

Not at all.
Swiping the text part and Long pressing the outline part are different

cvp

@ihf said:

use keys (tab, and shift-tab) on an external keyboard

Only possible if script receives a different code for tab and for back tab

ihf

@cvp Sorry, I meant that #1 or#2 are probably equally acceptable to me (maybe slight preference for just swiping).
I guess we already tested the shift-tab and found it was the same as tab so that won't work.

cvp

@ihf I really don't know how I could differentiate the two keys...

cvp

@ihf

If you tap once on the text part, you will edit it
Do you want to tap once on the outline part?

Ok? And then the delete key or a red button in the line?

ihf

@cvp I think that tap once should be fine.

ihf

@cvp would it be possible to make the visibility of the children in a collapsed outline an option? The reason is that when there are many levels below a particular level and you collapse at the highest level it is hard to read the outline at the highest levels only because of all the space taken up by the miniature version of the child notes. If I am not being clear, I can send some images from an outline.

ihf

@cvp I just realized that the Notebook app uses CMD-x to delete a line (with its children). Having a special key sequence and/or putting it in the double-tap pop-up would be good.
I thought you also might find this part of the Notebook app prefs interesting: https://imgur.com/a/U9uhw5b (not meant to be a request but perhaps useful to know)

cvp

@ihf said:

would it be possible to make the visibility of the children in a collapsed outline an option?

It is already so: you have a setting named "font size of hidden lines", put there a zero

cvp

@ihf don't forget that I rewrite entirely a new script thus I don't modify the actual one anymore.
You will have to be patient for this new one. I hope for before I leave for my holidays, July the 9st.
But you can ask any modification or new request (like delete) , I stored them in a todo list, for after that I have finished the new version.

ihf

@cvp OK, I understand. So should I stop reporting bugs (renumbering, move issues, etc.) since you will be doing a rewrite?
Todo: provide a way to show all hidden (or miniaturized) outline elements with one button.

cvp

@ihf said:

provide a way to show all hidden (or miniaturized) outline elements with one button.

Now in my todo list, ok for a title bar button? Icon? Title?

cvp

@ihf said:

stop reporting bugs (renumbering, move issues, etc.) since you will be doing a rewrite?

Ok, and I hope you are not too angry about that

cvp

@ihf just to show that I'm working for you, for a distant future version

cvp

@ihf said:

CMD-x to delete a line

Do you know its hexadecimal code?

cvp

@ihf show all, proposed

cvp

@ihf dele line with its children in double tap popup menu

Of course, if you want a way more....
- key, give me the code
- single tap on the outline, + red button for instance, please confirm

cvp

@ihf Question Q1: you know that CR generates a new outline if typed at end of a line of text.
If you type CR between two words, the program generates a new line in the same outline.
The.txt file contains a \n character for real CR (\x0A). Actually it contains (temporarily) a | to differentiate a soft CR to stay in the same outline. When reading the .txt file, it replaces these | by CR in the row.
But, so, the .txt file could not be printed.
My question is: do you need to print the .txt file.

cvp

@ihf I'll upload a new version using TableView (thanks @mikael) instead of TextView tomorrow in the evening (GMT). Each row of this TableView will have (in the tableview_cell_for_row delegate):
- a button for the checkbox
- a button for the hide/show icon
- a label for the outline
- a TextView for the text it-self, which allows multi-lines text per outline

This version, as it is a full rewrite, could have new bugs and also old bugs not yet identified.
I've tried to write it quickly because I'm going in holidays from July 9 to July 25 included.
I hope that you will be able to test it during this period and that you will not meet a locking bug...
During my holiday, I'll check the forum but I'm almost sure that I won't be able to correct bugs very quickly.

New functionalities:
- delete row and its children by a new option in the popup menu
Q2: if you want a supplementary way to delete, like single tap on the outline, tell me
- as you requested, the new file does no more asks immediately the folder and file name, but only when save is asked or at end of program. Obviously, without folder/file, no auto save is available
- as each text is a TextView, you can generate multi lines by typing a CR before end of the line, for instance between two words
- .log content is more readable now, easier for reading and playing back

cvp

@ihf said:

I thought you also might find this part of the Notebook app prefs interesting: https://imgur.com/a/U9uhw5b (not meant to be a request but perhaps useful to know)

I don't understand the two last items.

ihf

@cvp Honestly, I don’t know what those last two options are either. I will do my best to test it while you are on vacation.

Being able to print the outline as well as share it in a viewable format, is essential.

cvp

@ihf said:

share it in a viewable format

I don't understand

cvp

@ihf said:

print the outline

If the text stays a kind of .txt file, it will be printable.
But, if text of outline is splitted in multiple lines, I would generate a blank of the same length as the outline. And this will have a good look if you use non-proportional font like Menlo or Courier.
But, for printing, how do you specify the font in a .txt file, except via an app like Pages or Word.

cvp

@ihf Some questions:
Q1: do you want a single tap instead of double tap on outline to get popup menu?
Or do you want this choice as a setting?
Q2: do you want the option "delete with children" with a red background?
Or do you want this choice as a setting?
Q3: do you want now that I replace the ending _ of outlines by a blank?
Or do you want this choice as a setting?

ihf

@cvp
A1. If a single tap, how would this be distinguished from merely moving the text insertion point?
A2. If you add it, having an option is always nice but A1.
A3. If undo reverses the delete then it may not be a critical but the red looks nice 😊 How about a ā€œredoā€ button?

By viewable format, I merely meant that if the outline is shared with someone (e.g., emailed) the recipient would not need any special sw to view it as an outline.

cvp

@ihf said:

How about a ā€œredoā€ button

New request, just added in my todo list

cvp

@ihf said:

A1. If a single tap, how would this be distinguished from merely moving the text insertion point?

Double tap or single tap is on the outline, not on the text.

Single tap, double tap, long press on the text are supported as standard

cvp

@ihf said:

By viewable format, I merely meant that if the outline is shared with someone (e.g., emailed) the recipient would not need any special sw to view it as an outline.

The text file will be visible, editable, shareable as a text file with outlines in front of texts lines

cvp

@cvp said:

Q3: do you want now that I replace the ending _ of outlines by a blank?

@ihf You did not answer, your answer A3 was not relative to Q3

cvp

@ihf

cvp

@ihf New V00.30 available with

Version V00.30
  - use a TableView instead of a TextView (full review)
  - support delete row and its children option in popup menu
  - support enter between words in text, stay in same outline
  - modif infos stored in .log file easier reading
  - for new file, do not ask folder and name before first save or at end 
    - without folder/file, no auto save is possible and title is ?
  - an outline with multiple lines is saved with a blnk outline from the second
    line so the text is visible and printable as is.
  - On my iPad/iPhone now accessible if, and only if, you share ONCE a file 
    from this Files app folder to this program. 
    The path will be stored in .prm file.
  - support "delete in red" 
    - new general setting
    - display or not red background for "delete with children" option in popup menu
  - support "single or double tap for popup menu"
    - new general "setting"
    - single or double tap on outline needed for popup menu
  - support of redo after undo (same button, icon changes automatically)

Some bugs are already known (and not identified) but do not lock the tests and the script has now a lot of functionalities to be tested, not only move.

- .. bug: undo of tab and backtab do not work, but CR, move, delete do work ???
- .. bug: SOMETIMES move after first line does not work
- .. bug: move before first line does not work
- .. bug: SOMETIMES move after last line does not work
- .. bug: scroll TableView while dragging does not work

You have to remove all your files .txt, .prm, .content and .log

Save now will rename .txt and .content in ....old before saving new version as .txt .content

To be able to pick a file in the "On my iDevice" folder of the Files app, you have to:
- open this folder as external in the Pythonista files browser
- share any file of this folder to the script so this one can identify the path and store it in .prm

Both actions have to be done only once on each iDevice where you use The script.

ihf

@cvp Sorry, I got distracted while answering the questions :-) As to the _ at the end, I do not have a strong feeling about that. Perhaps I am missing the significance?

cvp

@ihf said:

Perhaps I am missing the significance

At the begin of the project, the outline was part of the text, thus I replaced the ending blank by an underscore so we could see where the outline ended and where the text began.
Now, it is no more useful, thus I could reset a blank, up to you.

cvp

@ihf After some tests, I've remarked that undo of CR and delete also do not work correctly.
And I can't find why. It seems that saving a TableView.data_source.items.copy() does not work like I hoped. Thus, new bugs as I had foreseen.

Ɖdit: solved, saving TableView.data_source.items needs to save each item with .copy()

cvp

@ihf New V00.31 available with

Version V00.31
  - correction of bug "undo did not work"
  - correction of bug "move before first line did not work"
ihf

@cvp I downloaded version 0.31 and created a simple outline with three levels. I tried to move the second level with all of its children to another place in the outline and while it showed the portion that was to be moved, it did not move anything. I can send a video if that helps.

Also, my personal preference is not to auto-capitalize the first character of each line I suppose an option for this would be nice.

cvp

@ihf said:

send a video

Yes please but let me cry 😢

I tried the same kind, I think, without any problem.

cvp

@ihf New V00.32 available with

Version V00.32
  - support "autocapitalization type (see ui.TextView doc)"
    - new general setting
    - use this setting when entering text (none, words, sentence, all)

cvp

@ihf Interested by horizontal popup menu with long options in two lines?

ihf

@cvp the 2 lines look fine but the one line hides less.

https://youtu.be/GhgK4UGPhpY

cvp

@ihf said:

the 2 lines look fine but the one line hides less.

Not true, black window has same height, which is at the minimum of 40 pixels

cvp

@ihf said:

https://youtu.be/GhgK4UGPhpY

Please, when you get such an error, post also the traceback of the error

cvp

@ihf New V00.33 available with

Version V00.33
  - correction of bug "local variable 'cell' reference before assign"
  - correction of bug "move before first row does not work"
  - correction of bug "move after last row does not work"
  - correction of bug "cursor leaves search field and goes to a row at each char"
  - long options of horizontal popup menu in two lines 
    nb: popup black menu has same height as before, the minimum allowed (40 pixels)
cvp

@ihf do you want this option?

ihf

@cvp i will post traceback for any errors although v0.33 seems to have fixed the one above. The filtering option is a great idea for large outlines. It would be nice if it were possible to enable/disable the checkbox on selected portions of the outline at least at a selected level with child nodes). I am not sure of the best way to do this in the UI…maybe part of the popup?)

cvp

@ihf said:

It would be nice if it were possible to enable/disable the checkbox on selected portions of the outline at least at a selected level with child nodes

I'm not sure that I correctly understand this request.
Do you want to be able, for instance, to enable all lines of a certain level, and their children?
It is like filter but not to show but enable or disable the checkbox.

By example: "enable checkbox of all lines with level > 2"

Or I could add an option in the popup menu to do that for one line and its children..

cvp

@ihf New V00.34 available with

Version V00.34
  - new functionnality: filter
    - new button in main menu
    - allows to filter lines to show (other are hidden)
       < level
       = level
       > level

Also, I fixed a problem for long options splitted in two lines, in horizontal popup menu

cvp

@ihf Do you want options like this to enable or disable the checkboxes of one line and its children?

ihf

@cvp that looks good!

cvp

@ihf New V00.35 available with

Version V00.35
  - new options in popup menu to check or uncheck the tapped row and its children

cvp

@ihf For info, the program could easily support a first level without outline if you want kind of headers in your text. But, a disadvantage would be that you could not get the popup menu for tHese header lines, because no outline is visible.

NB: of course, we could imagine another way to get the popup menu, for instance a double tap on the checkbox.

Do you want such a format type? Or a general setting?

In a future version, we could define different font and font size per level. But, this would only be usable in the program, not for the print, except if the printing operation would be managed by
the program it-self, but that is a more complex process.

ihf

@cvp outline on iPhone (as opposed to iPad) (especially in Portrait mode) has issues as some buttons are not accessible.

cvp

@ihf Annoying. I shall not be able to fix that before I leave. Thus, please, try to test on iPad. Thanks
Perhaps, I'll need to use normal ui.Buttons instead of ui.ButtonItems because I can decide their frame...

Edit : done, hoping it is ok on your iPhone, only tested on my iPad.

Be careful, as I use now ui.Buttons, the View is presented with hide_title_bar=True, thus swiping with two fingers close the program.

cvp

@ihf New V00.36 available with

Version V00.36
  - support iPhone by using ui.Buttons instead of ui.ButtonItems for menu buttons
ihf

@cvp Quick test of version 0.36 on the iPhone. The double tap menu is truncated on the right and in landscape mode the top set of buttons only fills half the screen. I can send pictures if that will help.

cvp

@ihf said:

. I can send pictures if that will help

Yes, please

ihf

Also when i double tap in portrait mode the content of the outline becomes black and there is no way back (must restart Pythonista).
https://i.imgur.com/PK9Q0zb
https://i.imgur.com/3WRUCj0.png

cvp

@ihf said:

The double tap menu is truncated on the right

I remember that popover is not supported in iPhone.

cvp

@ihf said:

the top set of buttons only fills half the screen.

Did you turn the iPhone after having started the program?

ihf

@cvp yes.

cvp

@ihf A lot of views are presented in popover, my fault, I did forget that popover is not supported by an iPhone. So versions, files, popup, etc... would need to be modified for iPhone.
And that will not be done tomorrow, my last day, sorry for you

cvp

@ihf said:

yes

Thus, normal. I've not programmed the support of the rotation while running.

ihf

Ok. So Landscape seems to work if I start it that way. I didn’t find a way to get out of the double tap menu when in portrait mode.

cvp

@ihf did you try with vertical popup menu?

cvp

@ihf said:

I didn’t find a way to get out of the double tap menu when in portrait mode.

As the popup menu is presented in fullscreen mode on iPhone, and it is presented without title bar, perhaps to swipe down with two fingers would close it.

cvp

@ihf do you agree if, in the future, on iPhone only, all views become fullscreen:
- versions
- files options
- settings
- filter
- search
- font
- font size
- color
- format types
- popup vertical
Horizontal popup will not be allowed on iPhone

ihf

@cvp Yes, that makes sense.

Yes, I ran in portrait mode with vertical popup and 2 finger swipe down will get you back to the outline.

ihf

@cvp The filter level seems to reset itself to 0 after you set a nonzero filter level.

cvp

@ihf said:

The filter level seems to reset itself to 0 after you set a nonzero filter level.

It was foreseen so to avoid you need to reset it, but it will be changed in next version.

cvp

@ihf Last version V00.37 before my holidays, with

Version V00.37
  - correction of bug "filter was reset to zero"
  - support on iPhone kind of popover presentation via half transparent shield for:
    - files menu tableview
    - format types menu tableview
    - search textfield
    - font size textfield
    - popup menu
  - not needed for dialogs like settings and filter and for big views like versions
  - force vertical popup menu on iPhone

Please, could you test on iPad and iPhone and give some feedback, even positive šŸ˜€

ihf

@cvp I’m testing move: https://vimeo.com/573007224
Wish list multiple level undo.

cvp

@ihf said:

I’m testing move: https://vimeo.com/573007224

just arrived at my first intermediate step, move error seems to complex to be resolved during holidays

cvp

@ihf said:

Wish list multiple level undo.

written in the todo list

cvp

@ihf said:

move: https://vimeo.com/573007224

Am I wrong, I think the second move should be refused, is it true?

cvp

@ihf New V00.38 available with

Version V00.38
  - correction of bug "drop into the moving lines was allowed"

Stop for today
I hope you have also tested some features that work šŸ˜…

ihf

@cvp I think what you have created Is nothing short of amazing especially given the amount of time that you’ve been working on it. I am spending a fair amount of time testing move and drop to make sure it works the way I expect. Take a look at this outline which was originally in alphabetical order. I am trying to move 3.3.3 g. back to 3.3.1 but each time I do it I end up with it at 3.4 g. Is there a way to move g back at the same level without doing it in multiple steps?
https://m.imgur.com/X8KWz6i

ihf

@cvp I figured it out. All you have to do is move it further to the right when you do the move and it will stay at the current level. Brilliant!

ihf

@cvp it might be useful for outline to take a parameter as the name of an outline file to open. That way I think a Shortcut could open an outline directly (probably also from Stash). Also, if outline files use a suffix then perhaps the script could show available outline files to open?

cvp

@ihf said:

I figured it out

Since V00.19 šŸ˜€

cvp

@ihf said:

parameter as the name of an outline file to open

In which directory? This one of the script? 2nd parameter?

I'm not free at all today because I go on with my trip but after your answer, I' ll add this feature in my first free time.

ihf

@cvp defaulting to the same directory as the script is probably fine but personally I will probably keep the outline files in a separate folder so having the ability to specify a folder would be helpful.
I wish you a fun and restful vacation. Outline is already a very useful program and every day you are making it even better. Kudos to you!

ihf

@cvp I was trying to move outline files to a new dir but I seem to have broken the open function (even after moving files back and deleting the .prm file.) Is there another file that needs to be removed?
This is what it looks like if I try to use open:
https://i.imgur.com/pCAwGuD

ihf

@cvp dont know what changed but I am able to get past the open and select a file but if I select the .content file from before I get this:

https://i.imgur.com/DoS38RI

cvp

@ihf I just read your two posts but I've feasted too much my holidays with my sons, their wife and children, to be able to understand them ( the posts).

cvp

@ihf said:

I select the .content file

Normally, we don't select the .content but the text file. I could protect against that

cvp

@ihf said:

Is there another file that needs to be removed?

A file is a couple of two files:
1) the text file named xxx.yyy where .yyy is not mandatory but could be .txt as standard
2) the outlines file named xxx.content.

When you create a new file named xxx.yyy, the xxx.content will be created by the script

When you open, select the text file, never the .content file

ihf

@cvp Understood.
I may be mistaken but after typing 10 or so lines in landscape mode in an outline, the next line is obscured by the onscreen keyboard and there does not appear to be a way to scroll the outline to add new lines (and see what is being typed).

cvp

@ihf said:

the next line is obscured by the onscreen keyboard and there does not appear to be a way to scroll the outline to add new lines

I thought that this problem had been solved. 😢

ihf

@cvp This is not an Outline problem per se, but I would like to share my outlines between ios devices. I thought that I merely had to move the outline file and the .content to icloud but what happens is that the files show up under iCloud but only on the device that moved them. In other words, if I move the outline to iCloud on my iPad, the files do not appear in Pythonista on my iPad. Do you know where I have gone wrong? Interestingly, all files moved to iCloud from my ios devices show up on my Mac.

cvp

@ihf said:

the files do not appear in Pythonista on my iPad

Old Pythonista bug with iCloud files.

On the device where they don't appear, go first in the Files app, iCloud Drive, Pythonista and download the files. After that, you should be able to access the files in Pythonista iCloud.

cvp

@ihf said:

the next line is obscured by the onscreen keyboard and there does not appear to be a way to scroll the outline to add new lines

New V00.39 available with

Version V00.39
  - correction of bug "keyboard hides data entry of text in rows"

Hoping this could help a little bit

cvp

@ihf New V00.40 available with

Version V00.40
  - support of file passed as 1st argument 
    nb: - only file in script folder is actually supported
        - script checks file and its.content both exit
        - ex url: pythonista3://MyFolder/outline?action=run&argv=a.txt

See above which url to open via a shortcut to open a.txt and a.content at start of script.
Assumed that the script and the two files are in the same folder, here named MyFolder in Pythonista Documents.

ihf

@cvp I tried turning off checkboxes in settings and got the following error:
Traceback (most recent call last):
File "/private/var/mobile/Containers/Shared/AppGroup/10326461-C5EE-49C0-8E1C-369955119C79/Pythonista3/Documents/outline.py", line 1079, in button_settings_action
self.popup_menu_orientation = f['popup menu orientation']
KeyError: 'popup menu orientation

Wish list: a way to turn off (or on all checkboxes) and then Crete outline elements with checkboxes.In other words, provide a way that parts of the outline are tasks or todos with checkboxes but not necessarily all lines.

P.S. It turns out the error has noting to do with checkboxes. Any attempt to open settings and close them gives this error.

ihf

@cvp After downloading in files app (thanks for that suggestion) I am now able to see the files in Pythonista; however, the outline.py script does not offer iCloud as an option for Open file.

cvp

@ihf said:

Any attempt to open settings and close them gives this error.

My error due to version for iPhone which does not allow the selection of popup orientation and I forced to iPhone in my script to test, and I forgot to remove it...sorry

Tell me if it's ok for you with V00.41

cvp

@ihf said:

checkboxes but not necessarily all lines.

Did you imagine a way to tell the program " this outline has a checkbox, this one not"?

cvp

@ihf New V00.41 available with

Version V00.41
  - correction of bug "crash when closing settings option"
  - support of extension passed as 1st argument
    nb: - example: .txt will show all files grayed except .txt ones

Folder where to work not yet selectable...One of the future versions perhaps

cvp

@ihf said:

the outline.py script does not offer iCloud as an option for Open file.

You have to select iCloud in the settings, then your next open will show files and folders of Pythonista iCloud.

Tell me if it is ok for you

ihf

@cvp v0.41 worked fine for access to iCloud folder from my IPad but when I try to do an open from my iPhone, no response and the script never presents the file picker and it can’t be closed. I’ve deleted the .prm file and restarted Pythonista but it did not help.

cvp

@ihf said:

open from my iPhone, no response and the script never presents the file picker and it can’t be closed.

No way to test that immediately...

cvp

@ihf New V00.43 available with

Version V00.43
  - popup menu
    - options about checkbox only shown if checkboxes setting is yes
    - new option "no box" if checkbox has to be hidden for a specific row
      nb: checkbox can be reshown if option checked or unchecked is tapped

Tell me if the new option is a right way to provide the new feature you asked

ihf

@cvp oops v0.43 has problems. I ran it and it loaded the outline I was working on and some of the outline numbers have become part of the text.

https://i.imgur.com/piJzdyu

cvp

@ihf said:

some of the outline numbers have become part of the text.

If the problem is reproductible, could you post the text and content files. As they are both editable, you can edit, select all, copy and paste them in the forum.

Are you sure you did not edit and change, even involuntary, one of the two files?

ihf

@cvp I am having some strange problems. Right now, when I select Open I am presented with my Outlines folder on iCloud but I would like to go back to an outline that is saved locally. How do I do that? The Open menu does not give a way to change the root.

cvp

@ihf said:

The Open menu does not give a way to change the root.

Exact, no way without changing deeply the File_Picker module. You need to go first in settings and swap local <-> iCloud

I will set in my todo list for a far future to modify the File Picker to be able this root in the browser.

cvp

@ihf New V00.44 available with

Version V00.44
  - correction of bug "if outline.py on iCloud, local is not accessible"
  - correction of bug "on iPhone, no way to close Versions window"
  - correction of bug "on iPhone, portrait, filter dialog segments not full 
    visible, font size recomputed"
  - correction of bug "on iPhone, portrait, settings dialog segments not full 
    visible, font size recomputed"
ihf

@cvp The outline that I mentioned above is here:

.content file

[([0], 4, {}), ([1], 4, {'checkmark': 'yes'}), ([1, 0], 6, {'checkmark': 'yes'}), ([1, 0, 0], 10, {'checkmark': 'no'}), ([1, 0, 0, 0], 14, {'hidden': False, 'checkmark': 'no'}), ([1, 0, 0, 1], 14, {'hidden': False, 'checkmark': 'no'}), ([1, 0, 0, 2], 14, {'hidden': False, 'checkmark': 'no'}), ([1, 0, 0, 3], 14, {'hidden': False, 'checkmark': 'no'}), ([1, 0, 0, 4], 14, {'hidden': False, 'checkmark': 'no'}), ([1, 0, 0, 5], 14, {'hidden': False, 'checkmark': 'no'}), ([2], 4, {}), ([2, 0], 6, {'hidden': False}), ([2, 1], 6, {'hidden': False}), ([2, 2], 6, {'hidden': False}), ([3], 4, {'checkmark': 'yes'}), ([3, 0], 6, {'checkmark': 'yes', 'hidden': False}), ([4], 4, {}), ([5], 4, {}), ([5, 0], 6, {'checkmark': 'yes'}), ([6], 4, {})]
{'format': 'decimal', 'font': 'Menlo', 'font_size': 18}

And .txt file
1.0 abc 2.0 abc 2.1 abc 2.1.1 abc 2.1.1.1 abc 2.1.1.2 abc 2.1.1.3 abc 2.1.1.4 abc 2.1.1.5 abc 2.1.1.6 abc 2.1.1.7 3.0 Reabc 3.1 abc 3.2 abc 3.abc 4.0 Fiabc 4.abc 5.0 abc 6.0 Fiabc 6.abc

Every line of the outline should be abc.

P.S. is there a better way to post files to this forum?

cvp

@ihf said:

The outline that I mentioned above is here:

It is weird. Is it possible that you did change the format type? And that the bug comes from that?
For instance, the third line has a content saying the outline has 6 characters instead of 4, thus a part of the text is considered as outline (2.1 ab)

Edit : this diagnostic is incorrect because the .txt has been posted without the front spaces of each line

That is a very important bug but no time today to try to identify it... Now. Apero hour.

ihf

@cvp I never edited the files outside of the app. It’s conceivable that I tried to change the format of a line using whatever you make available but I don’t even recall doing that. Enjoy your Apero!

cvp

@ihf said:

And .txt file

Please re-post it using , otherwise front spaces are lost

ihf

@cvp I edited the above post to properly display the .txt file

cvp

@ihf thanks, but I don't understand how you got such a file.
.content is not correct...

ihf

@cvp I have no idea. I never edited the .content file directly . I guess if it doesn’t happen again we can call it an anomaly :-)

ihf

@cvp unfortunately I don’t know how to fix the .content so that I can use that outline (with the actual content, not abc).

cvp

@ihf try to open it, change to format alpahnumeric, then to format decimal

cvp

@ihf said:

we can call it an anomaly :-)

I don't like that but the show must go on

ihf

@cvp here is an interesting bug. I figured I would create a new outline and in order to make it easy, I opened a split screen on the iPad with the text on one side and a notepad with the text on the other. However, when I type the text on the Pythonista side, a new outline item is started whenever I get to the RHS of the screen.

cvp

@ihf said:

here is an interesting bug. I figured I would create a new outline and in order to make it easy, I opened a split screen on the iPad with the text on one side and a notepad with the text on the other. However, when I type the text on the Pythonista side, a new outline item is started whenever I get to the RHS of the screen.

Sorry, I don't understand

cvp

@ihf said:

when I try to do an open from my iPhone, no response and the script never presents the file picker and it can’t be closed

It seems that, on iPhone, the file_picker dialog is presented in fullscreen on outline window also in fullscreen and this case does not work.

But, if you run outline on iPhone with .txt as argument, the open file dialog works because it is presented before the outline screen. This can be a temporary workaround but I've stored the problem in my todo list.

Edit : solved in V00.45, see next post

cvp

@ihf New V00.45 available with

Version V00.45
  - correction of bug "on iPhone, script hangs when trying to open a file"
manupaul47

I'll decide this week-end, I hope, because enough busy with my smala visiting me.

ihf

@cvp I wanted to re-enter an outline while looking at the.txt file so I opened the.txt file in an editor (actually I copied and pasted the text into an editor). With that on half of the screen (using the iOS split screen capability) the other half of the screen had Pythonista. As I typed the outline items into the outline I found that when I got to the right hand side of the split screen, rather than continue the outline item, a new outline item would automatically be formed although no return had been pressed.

cvp

@ihf do you Know from where comes the post just before yours?

cvp

@ihf said:

new outline item would automatically be formed although no return had been pressed.

Either I don't understand (surely true), either this does not occur for me

ihf

@cvp on the theory that a picture (in this case, a video) is worth 1000 words:
https://vimeo.com/575803531
You will see that in this video the text entered before reaching the edge of the split screen is lost. However, the problem manifested itself differently when I first reported it. Instead of losing the text, the script started a new outline item with the text entered at the edge of the screen. Hopefully, these problems are somehow related.

I have no idea what the post from manupaul47 is about.

cvp

@ihf you don't loose the text and it does not generate a new item.
When you type a text larger than the available screen width (full or half), the text continues in a (soft ) second line in the same outline.
You can try to scroll the text area to see the first line back.
And the, type a real return and you will see the two soft lines in only one outline

ihf

@cvp Yes, in the example I posted, you are correct that the text is there and scrolling back will reveal it. Unfortunately, I cannot reproduce the phenomenon of it creating new outline items with new numbers. If it happens again, I will try to capture a video.

cvp

@ihf what I explained with a real enter is visible on a small screen like an iPhone but not with split screen. The script is not warned of the half screen width like for a rotation. Even right buttons are not visible.... annoying .

cvp

@ihf little bug when computing height of TableView row with a long line, will be corrected soon

cvp

@ihf said:

Unfortunately, I cannot reproduce the phenomenon of it creating new outline items with new numbers.

In reality the two lines of text belong to the first outline and the 2nd outline is empty.
Because the height of the text is bigger than the height of the TableView row height...
Weird but so, will be corrected too.

This image only to show effect

cvp

@ihf when you are in split view, you get an automatic (soft) line feed when you reach the right side of the screen. I don't get it and I don't know why...

cvp

@ihf when split view, positions of menu buttons were not recomputed as your video shows it (right buttons are missing)

That will be corrected in next version, even in portrait mode in split view

cvp

@ihf New V00.46 available with

Version V00.46
  - support device rotation while running
  - support split view even while running (buttons locations recomputed)
  - height of TableView rows recomputed in function of number of soft linefeeds
    generated by long texts 
ihf

@cvp I opened an outline with v 0.46 on the iPhone and with the keyboard on the bottom half of the screen I was not able to scroll the outline up so that I could see what I was typing in a new entry.

cvp

@ihf I have problems with the keyboard hiding rows of the TableView and no more free time actually, sorry.
Hoping you have other functionalities to test.
Have a good week-end

ccc

@cvp I read through the 3000+ lines this morning. Very impressive work! Lots of cool things that you have learned here.

There are three instances of for i in range(len(items)):that could all be made simpler with for i, item in enumerate(items):

Bon week-end.

cvp

@ccc said:

Lots of cool things that you have learned here.

Sure, marvelous forum full of smart guys

cvp

@ccc said:

There are three instances of for i in range(len(items)):that could all be made simpler with for i, item in enumerate(items):

Stored in my todo list (but sometimes, item is not needed) but I'm sure I'll forget it in a future project...

cvp

@ihf New V00.47 available with

Version V00.47
  - add a "dismiss keyboard" key to iPhone kyboard to see all rows for editing
  - follow @ccc advice about "for i, item in enumerate(items):"
  - correction of bug "info button of format types did not react"

This should allow you to dismiss the keyboard on iPhone to access any row for editing.

Tell me if that helps

ihf

@cvp I love this program! I have begun using it for ā€œrealā€ outlines and the only bug I have experienced is that (on the iPad) when I reach the RHS of the screen, a long outline item shows the last few words that belong on a new line. It is all there but shows up after I go to the next outline item. I will be using it more frequently in the next few days and I’ll let you know if anything comes up.

Old issue: when keyboard is active on iPad in landscape mode, the bottom of outline is hidden or only the bottom of the outline as shown at top of screen with no abilty to scroll the view to see items above. Please let me know If a video would make this more clear.

Add to wish list (if not already there):
Ability to have web links that open in browser view.
Ability to embed images

cvp

@ihf said:

Ability to have web links that open in browser view.

Already there but they open in Safari..

cvp

@ihf said:

Ability to embed images

Wow...To be discussed: how to identify images, at which size, where, etc..,

cvp

@ihf please download new File_Picker, it will be needed by V00.48 (coming soon)

ihf

@cvp Got it. A few problems:

  1. On the iPad when I open an existing Outline in Landscape mode that is longer than 1/2 the screen, the keyboard hides the portion of the Outline at the bottom where you would add new items.If I then hide the keyboard, the full outline appears and then if I touch the text in the last item, the display changes to show only the last 2 lines of the outline. If I hide the keyboard at that point, I get the Outline back but if I touch text again the keyboard comes back with 1/2 the outline and it cannot be scrolled at all.

  2. I save an outline to iCloud on iPad and then go to IPhone but do not see the outline I just saved. Is it now necessary for me to go back to Files to download it? That may be outside your control but it is very inconvenient to always remember to do that if you are going from one device to the other.

  3. On the iPhone in portrait mode, the keyboard hides the bottom half of an outline and the outline cannot be scrolled. Similar to iPad behavior above, if I hide keyboard, I can see the outline and then if I touch text in one of the last lines all but the last few lines are shown at top. This is usable but a bit anomalous as compared with other apps. I realize you are probably working within Pythonista (and Apple) constraints so there may not be a fix but I thought it was worth pointing out. The behavior I would intuitively expect is to be able to scroll the outline when the keyboard is visible to see any portion and to be able to set the text insertion anywhere without the outline being shifted.

Question: what are the .old files that are being created (and which I delete)?

cvp

@ihf said:

Is it now necessary for me to go back to Files to download it? That may be outside your control but it is very inconvenient to always remember to do that if you are going from one device to the other.

Yes, but I can't do anything (that I know) to solve it,

cvp

@ihf said:

3.

I have already tried a lot. I don't say it is impossible but Until now, I didn't find a better way

cvp

@ihf New V00.48 available with

Version V00.48
  - modified File_Picker to support in the browser 
      - Pythonista local
      - Pythonista iCloud
      - On my iDevice
      - iCloud Drive
    - no more setting "folder choice"
    - no more import Folder_Picker

don't be upset if you have a problem, I programmed this version having the last drink of my vacation with my tribe

ihf

@cvp related to the above...I opened an outline on the iPad (in Landscape mode). The display is approx 1/2 filled by the outline, when I touch the text in the last entry so that I can hit return to add an item, the keyboard appears and the new item (where I am typing) is mostly obscured by the keyboard display. The Outline display is not scrollable to make that line visible.

ihf

@cvp By the way, I know I keep telling you about bugs/anomalies but I should also say that I am using Outline for actual work and it is already enormously helpful. Thank you!

cvp

@ihf said:

On the iPad when I open an existing Outline in Landscape mode that is longer than 1/2 the screen, the keyboard hides the portion of the Outline at the bottom where you would add new items.If I then hide the keyboard, the full outline appears and then if I touch the text in the last item, the display changes to show only the last 2 lines of the outline. If I hide the keyboard at that point, I get the Outline back but if I touch text again the keyboard comes back with 1/2 the outline and it cannot be scrolled at all.

See you next week...

cvp

@ihf said:

  1. I keep telling you about bugs/anomalies but I should also say that I am using Outline for actual work and 2.it is already enormously helpful. 3. Thank you!

Answers
1. Normal
2. Too kind
3. You're welcome

ihf

@cvp Glad to see you are maintaining your sense of humor :-)

cvp

@ihf said:

Question: what are the .old files that are being created (and which I delete)?

Each time that the program saves a couple of files (txt and content), the program
1. deletes the old files
2. Rename actual files into .old
3. Saves files

This is a protection against a crash during saving, which could generate a loss of the files.

Thus, you don't need to delete them your-self.

If you prefer, I can comment this process (I have tested their duration: some hundredths of second).

Marketingteamc

Hello, it’s insightful
https://marketingpulp.com/

cvp

@ihf The outline file is showed in an ui.TableView which normally is used to display a set of rows without editing their content, delete excepted. No editing, thus no keyboard.
Manual scroll shows as maximum the last row at the bottom of the screen, not in the middle of the screen because no keyboard would be displayed.
In our case, in each displayed row, the script creates an ui.TextView to allow edition of texts.
Then, the keyboard appears.
I'll try to allow manual scroll so the last row would be just above the keyboard, but nothing promised.

I'll try by setting the bottom contentinset of the TableView a value equal to the height of the keyboard

cvp

@ihf New V00.49 available with

Version V00.49
  - correction of bug "scrolling not allowed when keyboard hides row to be edited"
    by setting tableview content inset bottom = keyboard height

Please try if the problem of "unallowed scroll when keyboard appears and hides outlines you want to edit" is solved
And tell me...

ihf

@cvp First test: iPhone, Portrait mode with outline that fills a little over 1/2 of the screen. If insertion point is at end of 1st item, cannot scroll outline. Hide keyboard, outline visible. Touch 2nd to last item, cannot scroll though swiping (not scrolling) works sometimes. Also, sometimes when I swipe the outline up it scrolls one of the items near the bottom of the outline rather than the outline.
I’ll try more tests with iPhone and iPad.

cvp

@ihf said:

cannot scroll though swiping (not scrolling) works sometimes.

What's the difference between scroll and swipe?
Swipe vertically a scrollview scrolls it.

Sorry, but I don't understand what you want to do and what doesn't work.

cvp

@ihf said:

it scrolls one of the items near the bottom of the outline rather than the outline.

No comprendo

cvp

@ihf When you have installed V00.49, did you restart Pythonista because, if we change keyboard_frame_did_change code (what V00.49 does), Pythonista has to be reloaded.

cvp

@ihf New V00.50 available with

Version V00.50
  - support automatic soft line-feed when typing reachs right side with recomputing
    of height of TextView in TableView row


.
.

.
.
.
it took hours of sweat

mikael

@cvp, impressive! Know how hard these seemingly simple things can be.

cvp

@mikael said:

Know how hard these seemingly simple things can be.

Don't forget that I'm not a pro, it took hours of sweat for me, perhaps done in a few minutes by an expert. The problem was this mixed of TextView in a TableView...

cvp

@ihf Please give me some (good šŸ˜€) news about your problems of scrolling with keyboard because, for me, I don't see any issue since V00.49, and also the added button for dismissing keyboard on iPhone.

cvp

@ihf said:

I save an outline to iCloud on iPad and then go to IPhone but do not see the outline I just saved. Is it now necessary for me to go back to Files to download it? That may be outside your control but it is very inconvenient to always remember to do that if you are going from one device to the other.

Perhaps you have seen this topic, written after my search and tests to solve your issue.
Will be integrated in a future version

Another problem is that if you try to select via Pythonista, you don't see the unloaded iCloud files.
You would need to select via the Files app like dialogs.pick_document does but this one does not
show The Pythonista local files...
Incoherence
If you want an unique way
- either no Pythonista local files (dialogs.pick_document)
- either no unloaded iCloud files (my files_picker)

Try this script, it downloads a selected file if not downloaded.

import dialogs
#import shutil
fil = dialogs.pick_document(types=['public.item'])
print(fil)
#shutil.copy(fil,'test')

I think personally that the best solution for you would be to use files_picker for local files and dialogs.pick_document for other Files app files, then two different ways but you would not need anymore to care about downloaded or not.

ihf

@cvp With regard to the scrolling, I just tested on the iPad and it works except that if I am looking at the outline which takes up more than 1/2 the screen and I select a line which is below the midpoint,, the keyboard will appear (as it should) and obscure the line I selected. I can then scroll the outline up to see it but it would be better, if possible, if the view scrolled in such a way that the selected line was visible when the keyboard appears.

However, when I went to the iPhone and selected open I got this error:

Traceback (most recent call last):
  File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/outline.py", line 1427, in tableview_did_select
    self.files_action(None, act) # no need to pass waited sender
  File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/outline.py", line 1552, in files_action
    f = File_Picker.file_picker_dialog('Pick a text file', root_dir=self.path_to_name)
  File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/File_Picker.py", line 378, in file_picker_dialog
    picker = TreeDialogController(root_node, allow_multi=multiple)
  File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/File_Picker.py", line 184, in __init__
    self.expand_root()
  File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/File_Picker.py", line 187, in expand_root
    self.root_node.expand_children()
  File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/File_Picker.py", line 113, in expand_children
    node = FileTreeNode(full_path, self.show_size, self.select_dirs, self.file_pattern,self.only)
  File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/File_Picker.py", line 79, in __init__
    self.subtitle = human_size((os.stat(self.path).st_size))
PermissionError: [Errno 1] Operation not permitted: '/private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs/'
cvp

@ihf said:

when I went to the iPhone and selected open I got this error:

I don't know why but, on iPhone, iCloud Drive not seen as a folder but as a file...by Pythonista file system operations os.path.isdir

Edit: see two posts below in V00.52 explanation

cvp

@ihf New V00.51 available with

Version V00.51
  - protection against crash on iPhone when open a file. 
    On iPhone, iCloud Drive folder is not seen as a folder by os.path.isdir().
    => Support only Pythonista local and iCloud files

I know that it could be annoying if you want to store files in "on my iPhone" or "iCloud Drive" and access them on your iPhone, but I can't do anything actually.

And this does not yet solve the problem of files created on iPad in Pythonista iCloud and not visible in iPhone. I shall solve that with dialogs.pick_document but later.

cvp

@ihf New V00.52 available with

Version V00.52
  - protection against crash when open a file. 
    Offer only "on my iDevice" and "iCloud Drive" if their path exists,
    that will say "open once as external folder"

When I posted V00.51, as temporary protection, I didn't remember (and neither do you šŸ™„) that to allow access to iCloud Drive you have to open it once as external folder on your iPhone.
Now, the V00.52 will not crash but first will check if the folder is accessible before trying to offer it for open.

cvp

@ihf said:

With regard to the scrolling, I just tested on the iPad and it works except that if I am looking at the outline which takes up more than 1/2 the screen and I select a line which is below the midpoint,, the keyboard will appear (as it should) and obscure the line I selected. I can then scroll the outline up to see it but it would be better, if possible, if the view scrolled in such a way that the selected line was visible when the keyboard appears.

New V00.53 available with

Version V00.53
  - when editing a row that would be hidden by the appearing keyboard, 
    automatically scrolls so the row is above the keyboard

Please tell me if you're happy with this update, it is important for me ā—ļø

Also, tell me if you are happy with the modification of V00.50 relative to reaching the right side of your window, it is also important for me ā—ļø

cvp

@ihf said:

I save an outline to iCloud on iPad and then go to IPhone but do not see the outline I just saved. Is it now necessary for me to go back to Files to download it? That may be outside your control but it is very inconvenient to always remember to do that if you are going from one device to the other.

I'll solve it, promised, in one future version. You would no more need to go through the Files app first,
but not so urgent, isn'it?

There are several ways to pick a file or select a folder.
File_Picker module is ok for local Pythonista files but, for external folders like iCloud Drive or 'on my iDevice', needs these folders to be open as external folders.
Also, for Pythonista iCloud, only downloaded files are shown (your problem).
The dialogs.pick_document is ok for Files app folders but does not allow to select a folder (needed by 'new file' option).
This function is based on ObjectiveC UIDocumentPickerViewController.
I'll use my own UIDocumentPickerViewController for Files app files but also to select a folder. Unfortunately, it does not allow access to Pythonista files, thus I'll need to first ask the user (you) if he wants to access Pythonista local files or all other ones. Sorry to be so long in my explanation, but this was needed, I think, for a better understanding.

ihf

@cvp with respect to the change in version 53 to make the edited row visible above the keyboard, I just started testing and it works except if I go to the last line of the outline, the keyboard moves as it should, but if I hit return a new Outline item is created that is hidden by the keyboard. Ideally the editing point would always be visible. I will do some more testing of this and the other changes.

cvp

@ihf said:

except if I go to the last line of the outline, the keyboard moves as it should, but if I hit return a new Outline item is created that is hidden by the keyboard

Not true for me, new line is just above the keyboard

ihf

@cvp I will go back and test that again more thoroughly. I just saved the outline on the iPad then went to the iPhone, to the Files app, download it the newly saved outline. When I went to open it, I got the following:

Traceback (most recent call last):
  File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/outline.py", line 2077, in tableview_cell_for_row
    if row == self.cursor[0]:
AttributeError: 'Outliner' object has no attribute 'cursor'
Traceback (most recent call last):
  File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/outline.py", line 2077, in tableview_cell_for_row
    if row == self.cursor[0]:
AttributeError: 'Outliner' object has no attribute 'cursor'
Traceback (most recent call last):
  File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/outline.py", line 2077, in tableview_cell_for_row
    if row == self.cursor[0]:
AttributeError: 'Outliner' object has no attribute 'cursor'
Traceback (most recent call last):
  File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/outline.py", line 2077, in tableview_cell_for_row
    if row == self.cursor[0]:
AttributeError: 'Outliner' object has no attribute 'cursor'
cvp

@ihf said:

When I went to open it, I got the following:

Sorry for that, never meT this problem.
Did you
- open the file by files/open
- open automatically as last open
- open by shortcut argument?

ihf

@cvp I went back to the iPad and confirmed that if I select the last line for text insertion, hit return to add an item, that new item is hidden by the keyboard. If you then scroll up to see that line and bring up the floating menu, the keyboard is hidden and the floating menu appears but points to the middle of the outline.

cvp

@ihf sorry, what is the floating menu? The popup menu?

cvp

@ihf said:

floating menu appears but points to the middle of the outline.

I'll become crazy šŸ˜‚, or perhaps is it already so.

ihf

@cvp Sorry, yes, the popup menu. Answer to previous question, open via files/open.

cvp

@ihf said:

the keyboard is hidden and the floating menu appears but points to the middle of the outline.

Very new bug due to automatic scroll back during the displaying of the popup menu.
I hope I could find a solution, not yet sure, but what is sure is that I cry.

ihf

@cvp I just need to tell you again that what you have built is amazing and, notwithstanding any bugs, I am using it for real outlines every day. I very much appreciate that you have continued to try to fix everything that comes up as well as continue to enhance it.

cvp

@ihf said:

AttributeError: 'Outliner' object has no attribute 'cursor'

Will be solved in next version

cvp

@ihf said:

I just need to tell you again that what you have built is amazing and, notwithstanding any bugs, I am using it for real outlines every day. I very much appreciate that you have continued to try to fix everything that comes up as well as continue to enhance it.

Too kind.

cvp

@ihf said:

the keyboard is hidden and the floating menu appears but points to the middle of the outline.

I think that the problem comes if you ask the popup menu while the keyboard is there on an automatically scrolled up row. The program displays the popup menu above the keyboard, then the keyboard disappears and the pop menu stays at the same position while the automatic scrolls down the row at its original place....

Not easy to solve.

But, even if the popup is not at its right location, it refers to the right row as shows it it's title

ihf

@cvp Yes, I should have said that. The line number in the popup is correct and this is not a big problem.

cvp

@ihf could you wait that the keyboard disappears and the line scrolls back to the bottom before asking popup menu, just to try

ihf

@cvp Just to be clear ...If i open outline now and do text insertion on last item, hit return, a new item is created that is hidden by the keyboard. If I scroll the outline I can see it and if I then bring up the pop-up menu, it comes up but in the middle of the outline (i.e., not at the item that is being edited). If instead, I hide the keyboard and then select the popup menu, it points to the correct item.

cvp

@ihf said:

If i open outline now and do text insertion on last item, hit return, a new item is created that is hidden by the keyboard. If I scroll the outline I can see it and if I then bring up the pop-up menu, it comes up but in the middle of the outline (i.e., not at the item that is being edited). If instead, I hide the keyboard and then select the popup menu, it points to the correct item.

Understood, thanks for the clarification, don't know yet how to solve it.

cvp

@ihf said:

If i open outline now and do text insertion on last item, hit return, a new item is created that is hidden by the keyboard

I can't reproduce this problem, could you post a print screen specifying where you tap enter

ihf

@cvp does this help: https://vimeo.com/580319736

cvp

@ihf could you also post the print screen after you have pressed enter because, for me, pressing enter shows the next line

ihf

@cvp https://i.imgur.com/fCiAkSI

cvp

@ihf thanks but weird because for me the entire new line is visible.
One bug more not easy to solve because not reproductible on my iPad. 😢

cvp

@ihf New V00.54 available with only

Version V00.54
  - correction of bug "crash at start with error
    AttributeError: 'Outliner' object has no attribute 'cursor'"

So I hope you can go on with your tests on iPhone

cvp

@ihf State of the art

I'm a little tired to debug some annoying bugs, then, here a quick summary of where I am in this program.

  1. bugs

    1.1 your description
    "If I scroll the outline I can see it and if I then bring up the pop-up menu,
    it comes up but in the middle of the outline (i.e., not at the item that is being edited).
    If instead, I hide the keyboard and then select the popup menu, it points to the correct item."

        not vital, workaround: do not ask popup while keyboard is active
    

    1.2 your description
    "If i open outline now and do text insertion on last item, hit return,
    a new item is created that is hidden by the keyboard."

        not vital, workaround: manual scroll
    
        nb: on my device, I only get it for landscape on small lines number
    
  2. new functionalities

    2.1 2nd argument of program = directory of 1st argument file to open

        thinking in progress
    

    2.2 multiple undo

        thinking in progress
    
        **question** : average size of your files?
    

    2.3 open iCloud file even if not yet downloaded

        thinking in progress
    
        workaround: use Files app for first downloading file
    

    2.4 support images

        **questions** : This program could support images, that's sure,
    

    but images could not be integrated in the text file, so you would not be able to print the text
    with images by normal printing tools.
    So, I would need to store them in the .content file, and the printing of text with its integrated images could only be done by this program...
    And that's a big modification.
    Assume we support images, we could start the process by an additional option in the popup menu. This option could allow to pick an image file. But do you want images as separate outline row
    or do you want an image integrated in the text of a row?
    How do you want to specifiy the size of the image in the text?

    2.5 extension in 1st argument

        already supported
    
        **question** : when the program shows all the files, other extensions are grayed,
                            do you want to hide them?
    
ihf

@cvp Something has happened on my iPhone that I have never seen before. If I start Pythonista, I cannot even see the outline.py script. That is if I manage to get to the list of scripts (don't even get that far most of the time), it looks like it is loading the script and never finishes. I have force restarted, Pythonista, the iPhone many times and I cannot get it to work. I'm afraid my testing (and for that matter any use of Pythonista) will be on hold until I can figure this out. I could delete the app altogether but then I will lose all data. I am at a loss as to what to do.

P.S. While writing this the following appeared on my phone: https://i.imgur.com/zFD9Y79 What the heck?

ccc

Open the url pythonista3:// which will open the app in "safeā€ mode.

ihf

@ccc Thanks!! I think something happened when I downloaded the latest version of outline.py. The link is incorrect and when I did the wget to download it, I must have messed up pythonista. I am back to where I was but with the latest version. I should just have a script that downloads the latest version since, AFAIK, the link does not change.

cvp

@ihf said:

The link is incorrect

You're right, the link pointed to the list of all my Pythonista scripts on GitHub. Sorry for that.
Small error, big effects. I didn't know that you didn't first visually follow the link before downloading.

I can't promise that this error will never occur anymore , thus tap on it first to check you arrive on one source code.

The link is V00.54

cvp

@ihf said:

AFAIK, the link does not change.

True

cvp

@ihf I don't know if you have read my "state of the art". I don't forget the two bugs (I have still spent some time today but without success). But I want to have some fun during some days, then I agree to think about the images in the text. Could you answer to my questions, please.

ihf

@cvp on further reflection, I think the Inclusion of images should be a low priority as I only occasionally have a need for it. I may have mentioned this before but having a way to fully collapse or expand the entire outline with one button would be helpful.

cvp

@ihf said:

I may have mentioned this before but having a way to fully collapse or expand the entire outline with one button would be helpful.

I don't think that I have already seen this request, but anyway, could you explain.
Collapse all lines in one? Or collapse all children?

Ɖdit: on iPhone, no more room for an additional button.
Could we use the eye button with a submenu
- show hidden
- collapse all
- expand all

cvp

@ihf You never told me if you are happy with the modification of V00.50 relative to reaching the right side of your window, it is also important for me ā—ļø

ihf

@cvp I just tested on the iPad in Landscape mode and when I reach the end of the line it continues onto the next line as it should. The new line is (not surprisingly) hidden by the keyboard so I need to scroll the outline up at that point but you know all about that.

However, I went into portrait mode and I got a TypeError 'builtin_function_or_method' object is not iterable. I'm not exactly sure what I did when I got it but I believe I was trying to paste a new line and then delete it. It also seems to occur when I hit return to create a new item.

ihf

@cvp I exited the program and now when I start it and try to select an outline I am getting the same error. Here is a traceback:

Traceback (most recent call last):
  File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 728, in tableView_heightForRowAtIndexPath_
    row=indexPath.row()
  File "/var/containers/Bundle/Application/8778D1CF-1C08-48BA-9714-9D2CFE524EA1/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 801, in __call__
    ordered_args = list(args) + [kwargs[key] for key in kwarg_order]
TypeError: 'builtin_function_or_method' object is not iterable
Traceback (most recent call last):
  File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 728, in tableView_heightForRowAtIndexPath_
    row=indexPath.row()
  File "/var/containers/Bundle/Application/8778D1CF-1C08-48BA-9714-9D2CFE524EA1/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 801, in __call__
    ordered_args = list(args) + [kwargs[key] for key in kwarg_order]
TypeError: 'builtin_function_or_method' object is not iterable
Traceback (most recent call last):
  File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 728, in tableView_heightForRowAtIndexPath_
    row=indexPath.row()
  File "/var/containers/Bundle/Application/8778D1CF-1C08-48BA-9714-9D2CFE524EA1/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 801, in __call__
    ordered_args = list(args) + [kwargs[key] for key in kwarg_order]
TypeError: 'builtin_function_or_method' object is not iterable
Traceback (most recent call last):
  File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 728, in tableView_heightForRowAtIndexPath_
    row=indexPath.row()
  File "/var/containers/Bundle/Application/8778D1CF-1C08-48BA-9714-9D2CFE524EA1/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 801, in __call__
    ordered_args = list(args) + [kwargs[key] for key in kwarg_order]
TypeError: 'builtin_function_or_method' object is not iterable
cvp

@ihf said:

However, I went into portrait mode

Did you restart the program when you turned your device?

ihf

@cvp Totally minor matter but I'll mention it while I remember....I think the "triangle" symbol to the left of the outline item should point down when the children are visible and and to the right when they are hidden. Moreover, it would be even nicer if that symbol was different (perhaps a solid circle?) when there are no children.

ihf

@cvp No I did not restart the program...I guess that was the problem since it now works again.

cvp

@ihf said:

when I start it and try to select an outline I am getting the same error.

Is it with all files or only one? If one, post it please

Never seen this error

ihf

@cvp If I can reproduce that error, I will let you know.

cvp

@ihf said:

Totally minor matter but I'll mention it while I remember....I think the "triangle" symbol to the left of the outline item should point down when the children are visible and and to the right when they are hidden. Moreover, it would be even nicer if that symbol was different (perhaps a solid circle?) when there are no children.

So?

ihf

@cvp Perfecto!

cvp

@ihf New V00.55 available with

Version V00.55
  - the "triangle" symbol to the left of the outline item should
    - point down when the children are visible 
    - point to the right when they are hidden
    - be a filled circle if no children
cvp

@ihf please tell me about collapse/expand all option, see some posts above

ihf
Collapse all lines in one? Or collapse all children?

Ɖdit: on iPhone, no more room for an additional button.
Could we use the eye button with a submenu

show hidden
collapse all
expand all 

Yes, collapse/expand all was what I had in mind and the eye button submenu would be fine. Collapse all children would probably be used much less often. 

ihf

@cvp I don’t know what changed but after saving an outline closing program, and then restarting it, I got the following error:

Traceback (most recent call last): File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 3205, in <module> main() File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 3201, in main mv = Outliner() File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 1104, in __init__ self.button_files_action('Open') File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 1530, in button_files_action self.files_action(sender, act) File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 1641, in files_action t = lines[i] IndexError: list index out of range

cvp

@ihf it seems that one of the two files, text or .content, is corrupted.
Could you post both files, please.

Is it reproductible? If you restart again, same problem?

If yes, you can edit the .prm file and remove carefully the key

,'file':'xxxxx.yyy'
cvp

@ihf New V00.56 with

Version V00.56
  - eye button now shows a submenu with
    - show all to unhide all rows
    - collapse all to hide all rows with level > 1 (children)
    - expand all to unhide all rows with level > 1 (children)
    nb: expand all and show all do exactly the same process
  - to be tested modification for the problem of enter on row just above keyboard, 
    which implies a new row but hidden by keyboard

The last correction (see above) is not really stable (so much different cases: iPad, iPhone, portrait, landscape, normal, split view, auto-line feed if right side reached, etc....)
I got several crashes of Pythonista (bus error, segmentation fault) not reproductible.

Restart Pythonista before using.

Nb: expand all and show all do exactly the same process, or I didn't understand the request.

Wait some seconds between two runs, it seems (not sure at all) that some Pythonista process is still active.

ihf

@cvp yes the index error problem is reproducible. I removed the file parameter from the .prm file and was able to start outline but if I then tried to open that file from iCloud I got the same error. Unfortunately the file contains some information that I would rather not post. Is there any other way I can help find the problem?

cvp

@ihf said:

Unfortunately the file contains some information that I would rather not post. Is there any other way I can help find the problem?

We shall try.
Two questions:
1. Does the program work for other files?
2. Does the file contain special characters or emoji?

Perhaps could you replace all confidential characters by an x

ihf

@cvp It does work with other files. Also, I just renamed an earlier version and it works also. Question: the script seems to produce files with a .old suffix as well as numbers. What is the reason for these other files?

cvp

@ihf said:

files with a .old suffix as well as numbers. What is the reason for these other files

That is not the script it-self but the file system which creates a _2.ext if the file already exists.
Very, annoying, I know, but not in my hands.

If you want, I can remove the code of saving as .old but it is a security against a crash during save.

cvp

@ihf said:

, I just renamed an earlier version and it works also.

Did you rename the script or the text file?

Anyway, I hope you kept the bad file and could post it with replaced confidential characters

ihf

@cvp Not necessary, I just wanted to understand why I am seeing multiple copies.

ihf

@cvp The text file.

cvp

@ihf said:

The text file

Ok, thus we are almost sure there is something in this bad file that the script does not like.

And I need it for understanding

ihf

@cvp when I tried to use the new collapse all feature in the eye menu, I got the following error:

Traceback (most recent call last):
  File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/outline.py", line 1553, in tableview_did_select
    loc_format = tableview.data_source.items[self.selected_row[1]]['title']
TypeError: string indices must be integers
cvp

@ihf try witH V00.57 with

Version V00.57
  - correction of bug "selecting option in eye submenu gives error
    'TypeError: string indices must be integers'"
ihf

@cvp that works! What exactly is the difference between show all and expand all?

cvp

@ihf said:

What exactly is the difference between show all and expand all?

No difference thus I advice to remove one of both options. If you agree, tell me which one

ihf

@cvp I would keep collapse and expand as I think they are more descriptive than show and hide.

cvp

@ihf I forgot to warn you: I' m busy to program multiple undo/redo but it is not yet finished.
Thus, actually the old button undo is splitted in two buttons but no one does work correctly.

cvp

@ihf said:

I would keep collapse and expand as I think they are more descriptive than show and hide

Ok, but I don't generate a new version for that.
Enough for today.
Bye, have a good evening.

ihf

@cvp same to you and a great weekend.

ihf

@cvp I’m not sure if I had just selected an insertion point or if I was typing when this error popped up:
Traceback (most recent call last): File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 2475, in textview_should_change self.undo_save("'" + replacement[0] + "'") IndexError: string index out of range

cvp

@ihf said:

IndexError: string index out of range

New V00.58 with

Version V00.58
  - correction of bug "some typing, like left delete, give error 'IndexError: string
    index out of range' when saving for undo"
  - remove option 'show all' of eye button, same process as 'expand all'
cvp

@ihf I'm still busy to program the multiple undo's and redo's, not yet ended.
But having multiple undo's implies that undo and redo actions could exist at the same moment,
thus, I've been obliged to show two buttons.
Do you agree with this, and visually like that?

Ɖdit: code is not ready but you can already use it as is, with bug's (as usual šŸ˜‚) but don't report them yet...

manupaul47

I'je just spent more than 4 hours to try to identify why, but without success. Sorry for you
e sadhana
teatv

cvp

@ihf Just for the fun and to show you what it could be (not operational at all)

ihf

@cvp I downloaded the v0.58 and opened my Outline and got this error:

Traceback (most recent call last):
  File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 2284, in tableview_cell_for_row
    v = MyInputAccessoryView(row)
  File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 726, in __init__
    self.width = mv.get_screen_size()[0]            # width of keyboard = screen
  File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 1194, in get_screen_size
    app = UIApplication.sharedApplication().keyWindow()
  File "/var/containers/Bundle/Application/8778D1CF-1C08-48BA-9714-9D2CFE524EA1/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 804, in __call__
    return method(*ordered_args, **kw)
  File "/var/containers/Bundle/Application/8778D1CF-1C08-48BA-9714-9D2CFE524EA1/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 898, in __call__
    res = objc_msgSend(obj.ptr, sel(self.sel_name), *args)
ctypes.ArgumentError: argument 1: <class 'TypeError'>: expected 0 arguments, got 1
cvp

@ihf said:

I downloaded the v0.58 and opened my Outline and got this error:

Seeing the error code, I can only advice you to restart Pythonista and tell me if it is ok

ihf

@cvp Yes, that got it working again. Thank you.

cvp

@ihf said:

Yes, that got it working again

That happens a lot with long programs using ObjectiveC and I don't think that somebody could say why.

cvp

@ihf Still for the fun. tell me if you want a version where this is active, but far from bug free.

And you would also see the future way to pick a file, even if not yet downloaded on your device (as you hope for your outline files).

I have a lot of partially developed features:
- pick unloaded iCloud file (without passing first via the Files app)
- multiple undo's
- 2nd argument of program
- images

Normally, I'm busy with the multiple undo's but I meet annoying bugs and I'm fed up and I want to do something else (week end is time for fun)
.
.

.
.
Edit : I do bugs even in my texts... I made a mistake with image at left of image 😢

ihf

@cvp That looks cool!

For a (very future) wish list:

Keep a creation date/time and change date/time,and due date/time for each outline item and the ability to sort Alphabetically, on change , creation , or due date.

ihf

@cvp also for wish list:

Ability to show/hide items with a checked check box. Not sure about sorting on checked items.

cvp

@ihf said:

Keep

And show? If yes, where?

cvp

@ihf said:

Unfortunately the file contains some information that I would rather not post. Is there any other way I can help find the problem?

I always think about this bug and I don't have any info helping me to debug.

ihf

@cvp the app I have stores four dates: creation, change, due, completion. Only one date can be selected at a time for viewing and it is shown to the left of the items ((i.e., the outline is moved to the right to make room for the date when it is viewed.)

ihf

@cvp obviously due date (if it exists) is set by the user. The others are determined by the system.

cvp

@ihf If you want to try, allowing some imperfections (bugs), the new V00.59 with

Version V00.59
  - support images in rows
    - use new files picker allowing to pick even not yet downloaded iCloud files

In the popup menu, try option šŸ–¼ to pick an iCloud image file, even if not locally downloaded.
Then, you can tap the image to change its size and position vs text in the outline.

I remember you that the txt file does not contain the images, thus not printable.

cvp

@ihf said:

obviously due date (if it exists) is set by the user.

I had understood, but do these dates need to be visible for all lines, in columns...not easy

cvp

@ihf said:

Ability to show/hide items with a checked check box. Not sure about sorting on checked items

Assume that only checked lines are shown. Quid if I uncheck a Line?

cvp

@ihf said:

the outline is moved to the right to make room for the date when it is viewed

Print screen please

ihf

@cvp Here it is showing creation date. Obviously if it hadn't been today, it would show a date.
The screenshot also shows (tab on upper right) how the outline can have multiple pages. Actually the app is modelling a notebook which may or may not contain an outline.

https://imgur.com/a/Gb7mdu9

cvp

@ihf said:

The screenshot also shows (tab on upper right) how the outline can have multiple pages. Actually the app is modelling a notebook which may or may not contain an outline.

Please, don't tell me that you want that also šŸ˜‚

cvp

@ihf Is that ok ?

But, quid, after having asked, for example, "hide checked", we check a new one. Does it need to be immediately hidden?

Quid if a child is checked but its parent not?

cvp

@ihf said:

following error:

Traceback (most recent call last):
File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 3205, in
main()
File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 3201, in main
mv = Outliner()
File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 1104, in init
self.button_files_action('Open')
File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 1530, in button_files_action
self.files_action(sender, act)
File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 1641, in files_action
t = lines[i]
IndexError: list index out of range

Perhaps you remember you got this error on a confidential file.

I just got the same error and I have identified the reason.
I had a file a and its a.content, but I also had a file a.txt which is paired with the same a.content
THus one of a. or a.txt is not coherent with the .content and gives this error.
I don't try to protect against that actually but you have to be careful with The files names.

For instance, you deleted a file and not it's content and reuse the name, I don't know.

cvp

@ihf very important question for me

Do you agree if I add a setting "current folder" that you will set 
via a folder picker on local Pythonista or Files app.
It will be used for saving new files and as initial folder
when browsing for file opening?
ihf

@cvp In answer to your questions:
The tab in the picture from the desktop app was not a request for a new feature...just an explanation of its meaning and the fact that the desktop app is a full notebook app, not just an outliner. Each item in a notebook page can point to another page, etc. At least for my use, having multiple outlines is fine.
The Creation, and last changed dates would exist for all items but (one or the other) would be made visible (or hidden) in the eye menu. The set and completion date would be settable for individual items and visibility similarly controlled.
If only checked items are shown (equals completed), and an item is unchecked then it should not be shown.
The example eye menu looks fine.
A current folder is a very good idea.

Unrelated question. Is it possible for the Outline script to (one day) be an app on Testflight or the App store? I know people have talked in this forum about app store games and such that they created in Pythonista, but it was never clear to me whether that meant they they were somehow standalone or if they required the user to have Pythonista installed. Just wondering.

cvp

@ihf said:

Is it possible for the Outline script to (one day) be an app on Testflight or the App store? I know people have talked in this forum about app store games and such that they created in Pythonista, but it was never clear to me whether that meant they they were somehow standalone or if they required the user to have Pythonista installed. Just wondering

No idea. I don't know Xcode neither theTemplate to convert a Pythonista script into a real app.
Hoping somebody like @JonB or @ccc or others could answer.

cvp

@ihf You have also to know that all these requests(and pending bugs) will need some time...

ihf

@cvp Be assured that 1. I am in no hurry and 2. I am already getting productive use from the script!

cvp

@ihf If this script would become a real app, who could maintain it?

ihf

@cvp Good question. I'd say let's cross that bridge when we come to it. For now, as long as you still find this a worthwhile challenge, I am happy to use it and provide feedback and suggestions with no expectations whatever.

cvp

@ihf Did you try to pick an image with the new picker? *What do you think about it?*

Actually, I'm busy with the folder picker using the same ObjectiveC module, for the save operation.
And I meet problems due to coexistence of PickerViewController and ui.

ihf

@cvp I just tried the image picker and got:
File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/outline.py", line 1301, in tableview_height_for_section_row image = ui.Image.named(opts['image'][0]).with_rendering_mode(ui.RENDERING_MODE_ORIGINAL) AttributeError: 'NoneType' object has no attribute 'with_rendering_mode'

cvp

@ihf said:

AttributeError: 'NoneType' object has no attribute 'with_rendering_mode

Weird. I don't have any problem. Which kind/extension of file did you pick?

ihf

@cvp I used the Files app and selected a.jpg file. (Small thing...when I select the image option in the popup menu it shows the 2 options (lcoal and Files app), blinks and shows them again.

cvp

@ihf are you on iPhone? And, most important, do you have access to this folder if external?

Bye, see you tomorrow

ihf

@cvp I guess the problem is that the file was accessible to the Files app but not to Pythonista. Is there a way that the script could access photos in the photo library? If not, and without an easy way to get to files that the files app can see, I’m not sure how useful this feature will be in practice.

cvp

@ihf said:

I’m not sure how useful this feature will be in practice

For a Good reason: this ObjectiveC pick shows you all files, even not yet downloaded while the File_Picker doesn't do it. When I'll also use this picker for opening a file, you will be able to see them and download them, what you didn't and report even as a bug about that (create a file on iPad in Pythonista Icloud, go to your iPhone and not see the file).
But of course, you have to, once per device, open folders you want to access as external folders in the Pythonista left files browser. You can do that for iCloud Drive and "on my iPad" folders,

cvp

@ihf said:

Is there a way that the script could access photos in the photo library?

The script could pick the photos in the photo library but you should copy the used ones as files.
The script stores the path and file name of used images in the .content file, so when you open a such outline, it will be able to display the images. If the photo is stored as a file, that would be the same.

cvp

@ihf New V00.60 with

Version V00.60
  - correction of bug "hidden child shows its image"
  - correction of bug "in popup menu, actions in two lines wre not executed"
  - correction of bug "tap šŸ–¼ in horizontal popup menu gives error 'view in use'"
  - correction of bug "intercept error of image from unaccessible file" and draw an 'open error' image
  - support UIDocumentPickerViewController for set current path
  - support UIDocumentPickerViewController for log file to play
  - support UIDocumentPickerViewController for open
  - support UIDocumentPickerViewController for image
  - new parameter "current path" used for accessing files
  - in settings dialog, display current path as header of settings
  - new "set current path" option in files menu
    - not used for images, so you can pick an image anywhere
    - used for play log, on local or Files app folder
    - used for open file, on local or Files app folder
  - new options in eye menu
    - hide checked
    - show checked only
    nb: if one of these modes is active and we change the status checked/unchecked
        of one displayed line, this line will be automatically hidden

I have to warn you that the save action does not work actually... sorry for that

And no time this evening to solve it, sorry

once again, I'm a little fed up with an annoying bug šŸ™„

cvp

@ihf New V00.61 with

Version V00.61
  - correction of bug "save did not work"

And that's all folks

ihf

@cvp Wow! You have been busy. I'll begin testing.

cvp

@ihf said:

I'll begin testing

Don't give me feedback before I'm going to bed šŸ˜‚

Bigger is the script, more you will get bugs

ihf

@cvp When I open my outline, sometimes the keyboard appears before I touch the outline. if I then scroll up to find the text where I wish to do an insert, Pythonista will crash immediately.

cvp

@ihf Is it possible that this only appears when you start the script without restarting Pythonista it-self?

I've even remarked that, sometimes, I have to wait some seconds before restarting Pythonista if I want no crash at script starting. I think this problem isn't in my hands, but stored in my todo list
Error is Segmentation error.

cvp

@ihf thinking about that

I agree that it is not very fair to postpone annoying parts, like:
- bugs
- multiple undo's not yet ended
- picker via ObjectiveC for saving, not yet done

cvp

@ihf with variable format (if you know Python date format strings)

cvp

@ihf and new option in popup menu for setting due date of each row

cvp

@ihf and an ui.DatePicker to select due date (-time)

cvp

@ihf New V00.62 with

Version V00.62
  - store for each created, updated, checked/unchecked row the relative date-time
    in its .content
    nb: create and update dates automatically set
        complete date set when outline is checked
        due date would be introduced by user via popup menu new option
        nb: then an ui.DatePicker allows to pick a date-time
  - new eye menu option: ask view of selected date
  - new setting: dates format
ccc

Starting at line 568...

    urls = ObjCInstance(_urls)
    if len(urls) == 1:
        url = urllib.parse.unquote(str(urls[0]))
    else:
        url = []
        for i in range(0,len(urls)):
            url.append(urllib.parse.unquote(str(urls[i])))
    if UIDocumentPickerViewController.callback:
        UIDocumentPickerViewController.callback(url)
    UIDocumentPickerViewController.picked = url

# --->

    urls = [urllib.parse.unquote(str(url)) for url in ObjCInstance(_urls)]
    if UIDocumentPickerViewController.callback:
        UIDocumentPickerViewController.callback(urls)
    UIDocumentPickerViewController.picked = urls
cvp

@ccc my callback does not wait for an array of only one element, thus it could be wrong with your modif.

cvp

@ihf New V00.63 with

Version V00.63
  - a lot of crashes "Segmentation fault" occur after scroll which set the cursor,
    thus showed the keyboard
    Try to protect against these crashes by no more showing cursor/keyboard 
    except when a new row is added.
    waiting for feedback šŸ¤ž

Obviously, I have removed now too cases much where the keyboard should appear automatically because I still only do it when CR. Thus, I wait for your feedback to reset back the cursor in some cases...

ccc

my callback does not wait for an array of only one element

Yes. That is what was confusing me in the current code. The url variable could hold a str or a list of str which I could not figure out.

cvp

@ccc said:

That is what was confusing me in the current code

It happens that I do that for readability of def names, foreseen for several cases and if needed I check of which instance is the arg. Far past of assembler language where we get the address of the param...from any other languages. Sorry for that but Python allows that so easily

Other examples where I call a button action from other ways and I pass a string as sender, ipo a ui.Button. So easy and clear for me when reading. 40 years of a lot of different programming languages, that helps.

ihf

@cvp The change to only show the keyboard when adding or editing a line is a very good improvement. Indeed I was going to write to you right before you made the change that it was getting very difficult to just read the outline due to the keyboard always hiding part of it.

Question: How do you hide the date field after showing it? (also, small thing, the label at top left showing which date field is shown is partially cutoff on iPhone in portrait mode.

With regard to images, did you decide anything about simplifying selecting from the photo library (and presumably copying them to the outline)?

Wish list: sort outline on selected date field.

cvp

@ihf said:

How do you hide the date field after showing it?

Tap outside...

cvp

@ihf said:

small thing, the label at top left showing which date field is shown is partially cutoff on iPhone in portrait mode.

I did not test at all on iPhone, shall do it, sorry

cvp

@ihf said:

Wish list: sort outline on selected date field.

Only the view list, not the real outlines for update? Always? On demand? Ascending /descending

cvp

@ihf said:

simplifying selecting from the photo library

No way. I could ask you to pick a photo from the camera roll but you (or the program) would need to copy them as a local file where the image could be read each time you display the outline
Please think about that.
Do you have any photo in your files? If yes, did you try to insert them in the outline?

ihf

@cvp on iPhone I haven't been able to hide date field once it is displayed regardless of where I touch the outline. Also the outline text (other than a few words) is not viewable when the date is showing. I will test on iPad.

Sort would be the real outline with Auto-sort as option.

I tested image insertion by copying a file from photo lib to Pythonista but it would be nice if I could just select from photo library (because it is the easiest place to save photos from other apps) and then have the script do the right thing (copy it locally) to use it in the outline.

ihf

@cvp I just tried v0.63 on iPad (in Landscape mode). I had the same problems...can't hide dates (also can't edit or do anything when date is shown) and the column label is cutoff.

cvp

@ihf said:

it would be nice if I could just select from photo library (because it is the easiest place to save photos from other apps) and then have the script do the right thing (copy it locally) to use it in the outline.

Wish list šŸ˜‚

cvp

@ihf said:

Sort would be the real outline with Auto-sort as option.

Not sure I understand

cvp

@ihf said:

on iPhone I haven't been able to hide date field once it is displayed regardless of where I touch the outline.

Normal, it is only a list and nothing is tappable not editable
You have to read the eye/expand all before.

Did I understand erroneously?

ihf

@cvp Sorry. I thought you had asked if this was a view-only sort or an actual sort of the outline. Also thought you asked about auto sort (On demand vs. automatically). Order probably an option.

cvp

@ihf said:

Also the outline text (other than a few words) is not viewable when the date is showing

What did you hope if you want a date at front?

cvp

@ihf said:

the column label is cutoff.

Seems to be a bug, I'll Check

ihf

@cvp My thought was that you could choose to show the date for each item and continue to edit the text. As it is now, I can show the date but not hide it and when it shows, the text is not editable.

cvp

@ihf said:

My thought was that you could choose to show the date for each item and continue to edit the text. As it is now, I can show the date but not hide it and when it shows, the text is not editable.

Sorry, I didn't understand so. I thought you wanted a list, thus not editable.
That changes all, you will have to wait some time. But data are still stored, one step at once

cvp

@ihf said:

Sorry. I thought you had asked if this was a view-only sort or an actual sort of the outline. Also thought you asked about auto sort (On demand vs. automatically). Order probably an option.

Sorry, my English is still so poor.
I don't understand yet.

If I sort the outlines on a date field, could you still do an enter or change an outline level?

cvp

@ihf New V00.64 with

Version V00.64
  - correction of bug "error on self.show_mode if new before an open"
  - correction of bug "title of date column can be cut by first row"
  - now, even if date field at front, outline stays editable

Not tested at all...cross your fingers and telle me....

Nb: For info, due date can also be updated by the same way (next version will also redisplay it immediately if list of due dates is in progress)

cvp

@ihf said:

have the script do the right thing (copy it locally) to use it in the outline.

One wish more, sometimes I think you can call me Santa Claus šŸ˜‚

Without joke, where could I import automatically these photos? Folder of script?

And which file name can I give to these photos, their image name? Not afraid to have too much files?

ihf

@cvp yes,but if auto-sort is on then the outline would be re-sorted after entering or changing an item.
I started testing v0.63 on iPad and when tried to open a file, I got the error "NotADirectoryError". I then selected "Set Current Path" and got the choice of Local Pythonista or Files App. I selected Files App, and my Outlines folder. The app is now frozen and restarting Pythonista and repeating steps doesn't help. Basically, I can't do anything (both on iPhone and iPad). Something bad seems to have broken when the Set working Directory was added. Not sure what to do now.

cvp

@ihf please post your outline.prm

If your current path is on iCloud, sure the .prm is downloaded

Or edit it as text in Pythonista. The file is a dictionary, remove key 'current path' and its value.

ihf

@cvp Just to be clear, this is the current situation on multiple devices. I am running v0.63. I start the script and get a blank outline. I select Open and I get NotADirectoryError. I then select Set Current Path and select Files App, and then I select the Outlines folder I have on iCloud in Pythonista 3 Directory. I select Done. Then I select Open and I am presented with my outlines (BTW, would be better if it only showed outlines and not all the other files). I then select an outline and I am back to a blank outline and a frozen app.

ihf

@cvp removing the key in .prm did not help. I still cannot open any of the outlines in the Outline folder on iCloud after selecting them.

cvp

@ihf could you try with new ipo open

ihf

@cvp ipo?

cvp

@ihf said:

. I still cannot open any of the outlines in the Outline folder on iCloud after selecting them.

Could you with Files app check if they are downloaded (ex: internet error could lock)

cvp

@ihf said:

ipo

In place of (sorry, I thought it was an English used abbreviation)

ihf

@cvp Files app shows all filesa re downloaded. I started a New outline, typed 2 items and then the app (Pythonista crashed). Tried a second time and got same result after restarting Pythonista

cvp

@ihf annoying, not easy to debug and help so distantly
And almost time to go for me...

cvp

@ihf said:

same result after restarting Pythonista

Could you remove Pythonista from memory, wait some seconds, and restart

Or try in safari pythonista3://

ihf

@cvp Same result.

ihf

@cvp I tried on iPad running ios14 and one with ios15 beta. Same result on both.

cvp

@ihf said:

NotADirectoryError

Could you print the traceback?

ihf

@cvp I just went back to v0.61 and I get the same result.

cvp

@ihf said:

I tried on iPad running ios14

I run on iPad iOS 14,without problem but I don't use iCloud, my current_path is local
Could you try to copy your .py and .prm locally and set your current_path locally

I try to find a way so your are not locked

ihf

@cvp

Traceback (most recent call last):
  File "/private/var/mobile/Containers/Shared/AppGroup/10326461-C5EE-49C0-8E1C-369955119C79/Pythonista3/Documents/outline.py", line 1795, in button_files_action
    self.files_action(sender, act)
  File "/private/var/mobile/Containers/Shared/AppGroup/10326461-C5EE-49C0-8E1C-369955119C79/Pythonista3/Documents/outline.py", line 1842, in files_action
    f = self.pick_file('from where to open the file', uti=['public.item'], callback=self.pick_open_callback, ask=False, init=self.current_path)
  File "/private/var/mobile/Containers/Shared/AppGroup/10326461-C5EE-49C0-8E1C-369955119C79/Pythonista3/Documents/outline.py", line 2101, in pick_file
    fil = File_Picker.file_picker_dialog(title, root_dir=path)
  File "/private/var/mobile/Containers/Shared/AppGroup/10326461-C5EE-49C0-8E1C-369955119C79/Pythonista3/Documents/File_Picker.py", line 335, in file_picker_dialog
    picker = TreeDialogController(root_node, allow_multi=multiple)
  File "/private/var/mobile/Containers/Shared/AppGroup/10326461-C5EE-49C0-8E1C-369955119C79/Pythonista3/Documents/File_Picker.py", line 168, in __init__
    self.expand_root()
  File "/private/var/mobile/Containers/Shared/AppGroup/10326461-C5EE-49C0-8E1C-369955119C79/Pythonista3/Documents/File_Picker.py", line 171, in expand_root
    self.root_node.expand_children()
  File "/private/var/mobile/Containers/Shared/AppGroup/10326461-C5EE-49C0-8E1C-369955119C79/Pythonista3/Documents/File_Picker.py", line 91, in expand_children
    files = os.listdir(self.path)
NotADirectoryError: [Errno 20] Not a directory: '/private/var/mobile/Containers/Shared/AppGroup/10326461-C5EE-49C0-8E1C-369955119C79/Pythonista3/Documents/outline.py'
ihf

@cvp Hmm. I select the files in Files app on iCloud and select Copy but there is no Pythonista folder to copy them to.

cvp

@ihf I think your .py and .prm are already local, are they? You don't,work with the script in iCloud?

cvp

@ihf said:

there is no Pythonista folder to copy them to

Normal, Files app does not show local Pythonista

cvp

@ihf Did you install the last File_Picker? It was requested in a post some days ago

ihf

@cvp Going crazy...don't know what I changed but I am able to open my real outline now.. To be clear, my outlines and .content files are in iCloud folder. The .py and .prm are local. If I have selected iCloud as location for files and then want to go back to Local. how to do that? If I select On My iPad there is (as you said) no Pythonista folder to select. Also beginning to see all these nnumbered and .old versions of things. Is it possible to do away with all of these extra files?

ihf

@cvp also there is another .prm file on iCloud (in Outlines folder)

cvp

@ihf said:

Going crazy...don't know what I changed but I am able to open my real outline now.. To be clear, my outlines and .content files are in iCloud folder. The .py and .prm are local. If I have selected iCloud as location for files and then want to go back to Local. how to do that? If I select On My iPad there is (as you said) no Pythonista folder to select. Also beginning to see all these nnumbered and .old versions of things. Is it possible to do away with all of these extra files?

Sorry, no time more today, sincerely sorry.
I ask me if theFile Picker on GitHub is ok but'you have worked with it.
Let me some time tomorrow
Bye

cvp

@cvp said:

back to Local.

No direct way, you have to cancel and retry

cvp

@cvp said:

Is it possible to do away with all of these extra files?

No automatic way I know. It is so that iCloud save works, same annoying problem for all my backups on iCloud

ihf

@cvp Ok, I understand. I deleted everything other than my primary outline and .content file and .prm (both local and iCloud..not sure why there are 2). I can now open the outline and continue testing.

ihf

@cvp Don't know if it is related to any problem but when I create a new outline and touch the 1.0 to begin entering text, the line disappears for a moment and then comes back. I hadn't noticed this on earlier releases but perhaps it was there all along.
https://vimeo.com/582634999

ihf

@cvp I just noticed something else. I created an Outline on my iPhone (on iCloud). I then went to the iPad, started outline, went to open and my ICloud files were shown, except the one I created (along with its .content file) were shown as not downloaded. So , I donloaded them in that interface and when it completed I was back to a blank outline in Outline.py and a Frozen app/Pythonista.. I then force quit Pythonista, restarted it and was able to open my iPhone outline.

cvp

@ihf said:

I just noticed something else. I created an Outline on my iPhone (on iCloud). I then went to the iPad, started outline, went to open and my ICloud files were shown, except the one I created (along with its .content file) were shown as not downloaded. So , I donloaded them in that interface and when it completed I was back to a blank outline in Outline.py and a Frozen app/Pythonista.. I then force quit Pythonista, restarted it and was able to open my iPhone outline.

It looks like all your problems today could be relative to problems of access to iCloud files.
But, problems have disappeared suddenly, yes?
Weird problem, how do you want I debug this kind of things

cvp

@ihf Do you use the program with an extension as argument ?

And you didn't answer:
Did you install the last File_Picker? It was requested in a post 10 days ago, here
Because the line 91 is no more this one and is the line of previous version.

File "/private/var/mobile/Containers/Shared/AppGroup/10326461-C5EE-49C0-8E1C-369955119C79/Pythonista3/Documents/File_Picker.py", line 91, in expand_children
    files = os.listdir(self.path)
NotADirectoryError: [Errno 20] Not a directory: '/private/var/mobile/Containers/Shared/AppGroup/10326461-C5EE-49C0-8E1C-369955119C79/Pythonista3/Documents/outline.py'
cvp

@ihf said:

Don't know if it is related to any problem but when I create a new outline and touch the 1.0 to begin entering text, the line disappears for a moment and then comes back. I hadn't noticed this on earlier releases but perhaps it was there all along.

I think relative to the version without keyboard which appears at each scroll.
Now in my bugs list but no idea why this occurs.

ihf

@cvp Yes, I have the latest File_Picker (or I believe I do).(Line 91 is global folders, common
I am testing on 2 different iPads and it is possible I forgot to update one but it looks correct now.

ihf

@cvp In so far as iCloud issues. I believe that there is still a bug which hangs the script when you select a file which has not been downloaded yet. I addition, it may be the case that if you inadvertently select the .content file, it also kills the script. I suppose it would be nice if the script only showed you outline files.

cvp

@ihf said:

would be nice if the script only showed you outline files

Which files type or extension?
For File_Picker, I can do what I ant as update but not for UIDocumentPickerViewController which is the only one that shows you not yet downloaded files.

cvp

@ihf said:

bug which hangs the script when you select a file which has not been downloaded yet.

Added in my bugs list, will search but temporarily, download them first in Files app, as you are used to.

cvp

@ihf said:

if you inadvertently select the .content file, it also kills the script

Normally, not possible, already checked by script for days.

cvp

@ihf For you info, nothing relative to this project: my NAS is configured in the Files app, when I copy a file from "on my iPad" to my NAS, if big file like a movie of 2gb, it can take up to 15 minutes.
During this time, I can't use Pythonista, it hangs, even if I restart it.
Exactly like if files app locked some pending queues. My Pythonista has "on my iPad" and "ICloud Drive" configured as external folders. Maybe are both facts linked.

cvp

@ihf said:

Yes, I have the latest File_Picker (or I believe I do).(Line 91 is global folders, common
I am testing on 2 different iPads and it is possible I forgot to update one but it looks correct now.

It is weird because the error message printed in its traceback that line 91 was exactly the line of the previous version.
Don't forget that if you change a module of site_packges, where File_Picker has to be, you need to restart Pythonista to replace it also in memory.

cvp

@ihf Two other questions, relative to these posts
- did you already test V00.64?
- where do you want I copy a picked photo, on current path?

cvp

@ihf Concerning hang of Pythonista/script if picking a not yet downloaded file, if you want such a file, could you, please, have a long press on the file, select download in the popup menu which appears, and only when download is finished, tap on the file to select it. And tell me...

Actually, without this way, I can't see a solution to this bug.

ihf

@cvp yes, I am testing v0.64.
I think that moving the phot to the current dir would be fine.
I have an outline that looks like:
1. Abc
2. DEF
2.1 ghi
2.2 jkl
3. Mno
If I position the cursor at the end of 2.and hit return, I get a new item at 3.0. However 2.1 and 2.2 have moved to be 3.1 and 3.2 which is not what should happen.

cvp

@ihf said:

If I position the cursor at the end of 2.and hit return, I get a new item at 3.0. However 2.1 and 2.2 have moved to be 3.1 and 3.2 which is not what should happen.

New or old bug, anyway, added to bugs list, but what should happen?

Do you agree if I spend less time on bugs that I would, because I only have fun with new features.

cvp

@ihf New V00.65 with

Version V00.65
  - correction of bug "for picking in FileApp, script hangs" 
    replace console.alert by console.hud_alert"
  - correction of bug "creating a new outline and touch the 1.0 to begin entering
    text, the line disappears for a moment and then comes back when we put cursor"
  - support photos from camera roll when pick an image
    - added "photos" option with "local Pythonsista" and "Files app"
    - display standard photos picker
    - copy the photo as a file (on current path, name=photo name)
    - uses the copied photo into the outline
  - support sort of view dates
    - button at right of dates column title
    - support ascending, descending, no sort
        nb: no date known, supported as "now" when sorting
    - actions on row would need to be tested:
        - edit text
        - CR
        - tab
        - backtab
        - delete with children
        - move would be avoided (hazardeous )
  - if due date set while due dates view is shown, update view immediately
  - if update  while update dates view is shown, update view immediately

Attention, sorting of rows on a selected date is a proposal..., not tested.
Try photos like you asked.

ihf

@cvp Lots to test!
As far as what should happen when you position at 2.0 and hit enter. A new item at 3. should be created (as it is) but 2.0 children (2.1, 2.2) should stay with 2.

cvp

@ihf said:

Lots to test!

Too much? not happy?

ihf

@cvp no, I remain impressed with how fast you can add new features :-)

cvp

@ihf said:

new features

And new bugs...

ihf

@cvp I just tried adding a photo from my photo library and after giving it permission, it worked. I have a couple of questions. Is there a way to view the full photo? It appears that when I touch the thumbnail, I get a dialog asking for height in number of lines for left, right, top, bottom. Although its nice to have the precision, it might be better to have an option for small, medium, large? Also, a default would be good as I wouldn't want to have to resize every image I add. If you use the popup menu and select picture insert icon, there does not appear to be a way to cancel. Also, what is the easiest way to delete an image you have added (other than setting line height to 0?

cvp

@ihf said:

Is there a way to view the full photo? It appears that when I touch the thumbnail, I get a dialog asking for height in number of lines for left, right, top, bottom. Although its nice to have the precision, it might be better to have an option for small, medium, large? Also, a default would be good as I wouldn't want to have to resize every image I add. If you use the popup menu and select picture insert icon, there does not appear to be a way to cancel. Also, what is the easiest way to delete an image you have added (other than setting line height to 0?

My questions:
Full photo? When and where?
Ok for small, medium, large but to which number of rows they do correspond?
Ok for default: small, medium or large?
Cancel possible via cancel the pick window (top left button ) but I could add a 4th button cancel below local/files app/photos
Delete an image, ok but I have to think about it, or do you have an idea how you want to tell it

ihf

@cvp I was thinking that when clicked the full photo would come up as an overlay window. I need to think about this a bit more. I would put images on hold for the moment.

cvp

@ihf said:

would put images on hold for the moment.

Ok boss

ihf

@cvp I don't think I have ever worked with anyone who could implement my ideas faster than I can manufacture them :-)

cvp

@ihf and last for today V00.66 with one correction

Version V00.66
  - correction of bug "insert new row after all children of row where CR is typed"
cvp

@ihf said:

I don't think I have ever worked with anyone who could implement my ideas faster than I can manufacture them :-)

And surely never with a guy who generates bugs at such speed šŸ˜‚

cvp

@ihf Please read carefully.

Actually, text files xxx and xxx.txt have the same .content file, named xxx.content.
It will be source of problems.
Do you agree if I change that so:
xxx will get xxx.content as content file
xxx.txt will get xxx.txt.content as content file
So it would be impossible to have incoherences
I regret that I don't have done so from the beginning.

Result: you would have to manually rename old .content files (once) (or delete if test files)

With this solution, a .content file is univocally linked to a text file.
So, it could be better to open a file by picking the .content file...(excepted if all your text files have the same extension)

So, the File_Picker could only show the .content files (or gray the others)
But, that is not possible for the UIDocumentPickerViewController without changing info.plist
of Pythonista (to set our own UTI) and that is not possible.

Obviously, we could come back to the File_Picker for all files, even on iCloud, but so, we also come back to the situation where you don't see the not yet downloaded files.

Please, think about that, and tell me.

cvp

@ihf Addendum: the solution that I advice, and to read carefully:

we go back to normal File_Picker where first screen is the choice between all available origins.
If we go to iCloud and don't see our file, as not yet downloaded, we tap the new button and we get a dialogs.pick_document tool where we will see our file (like in Files app) and we will be able to force its download.
Then, we go back to where we really select the file as usual in File_Picker.
As we use File_Picker, we will be able to configure it so we would only see one kind of files among
- the outline files (or .content if you follow my advice of previous posts)
- the files with extension passed as 1st argument to script
- the images files

Of course, once you ask dialogs.pick_document (which uses UIDocumentPickerViewController), there is no way to filter shown files.

But so, the script should never hang because either the file is downloaded, either not but we only open a downloaded file, not a file that we hope it will download (obvious but so with UIDocumentPickerViewController)

ihf

@cvp I guess there is no perfect solution to this file picking. My thoughts: 1. It is important that all outline files, downloaded or not, be shown. 2. It should be as easy as possible to download and open a file, whether it has to be downloaded first or not. (i.e., fewest steps required). 3. Only outline files should appear as options (desirable but may not be feasible). It goes without saying that if a non outline file is selected inadvertently the script should not crash.

cvp

@ihf first, do you agree that .content is added to entire name of text file?
Ex: text a.txt => content a.txt.content
Even if that implies that you have to rename or delete some test files

cvp

@ihf said:

My thoughts: 1. It is important that all outline files, downloaded or not, be shown. 2. It should be as easy as possible to download and open a file, whether it has to be downloaded first or not. (i.e., fewest steps required). 3. Only outline files should appear as options

Your 3 thoughts are not able to be satisfied together...

I'll try to give you a better explanations of the possibilities:

1) to see all your files, even not yet downloaded, you need UIDocumentPickerViewController
=> no way to only see outline files (except if they are alone in a directory)
2) to show only outLine files in the browser, you need the imported File_Picker
=> if you don't see the wanted outline file, you would have to tap a button which will display all files and you would need to tap a file to download it and come back to the File_Picker viewer where you now will see your file and can select it

You have to decide before I go on

cvp

@ihf Actually the script is in case 1, and it is perhaps the best for you

When the script eventually downloads and then opens a file, iT checks if There is a .content

If no, that could say that the .content is not yet downloaded and ask you to retry.
If you made an error and you selected a non outline file, the script does not crash, because it requests both files to continue

ihf

@cvp I think that’s right. Case number one is probably the best given what is possible. I just tried opening a file which I believe has been downloaded (no download symbol next to it) and I’m getting a message I have not seen before.
https://i.imgur.com/ZY3k1yo

cvp

@ihf it is exactly the message that I explained in the previous post.
After having downloaded the text file, the script tries to download the .content of the text file.
If it gives problem,
either it does not exist and you try to open a not outline file
either it exists but the download did not yet terminate, thus retry
Up to you to check which case is yours

Nb I did not know that you have long file names and that the message was not readable...
It is a limitation of hud_alert, I'll review all my messages in future version

ihf

@cvp selecting and opening a file is getting a bit confusing but I suppose we have to live with iOS and Pythonista’s limitations

https://i.imgur.com/1WZFLtb

cvp

@ihf said:

selecting and opening a file is getting a bit confusing but I suppose we have to live with iOS and Pythonista’s limitations

It is due to iCloud...when saving
I add in my todo to check if I can do something to that, but be patient
But why exactly 2 times tHe same file name?
gƩnƩral ToDo, present 2 times, I suppose one without extension, the 2nd with not showed extension

Normally you should not have xxx.content.content file, excepted if you have open a content file as Text file... normally it is no more allowed

Actually, be careful when opening a file or creating a new one, in you choice of names.

cvp

@ihf I'll try to reduce the number of files to decrease confusion

Please, answer to the 3 questions

1) do you agree that, from now, I add ".content" to text file name, even if this text file has an extension.
To avoid to have todo and todo.txt linking to the same todo.content and thus risks of errors

2) do you agree I remove the .old when my save has worked?

3) I'll try to understand how the numbered names are generated and try to delete them automatically (nothing promised actually) , ok with that?

Nb: some tests show that name 2 is the newest version of name, weird
See also here

The wanted result would be to have only name and name.content

ihf

@cvp In answer to your questions:
1. Agreed
2. Yes, please
3. Yes! I would expect to see the outline file(s) and nothing else but I understand that the .content is needed to define the outline. Of course the outline could be a formatted file (html, xml ,or similar) but then that file might be harder to deal with outside of Pythonista.

cvp

@ihf said:

the outline could be a formatted file (html, xml ,or similar) but then that file might be harder to deal with outside of Pythonista.

You asked to be able to print the text file without any app, thus it is a flat text file...

cvp

@ihf After a lot of tests, I did not succeed to generate files with numbers in the name...
So, actually, no way to understand, thus to avoid that.
If during you tests, you could check if such file is generated, try to understand why.
If you get one, check which is the newest one, the normal one or the numbered one.

It seems, following tests of other people on the web, that problem comes from use of the same file on several devices, without waiting until it is fully downloaded. Read this, post of Ken Spreitzer. Far above my head, sorry.
As you can see, same annoying problem in 2016, still existing now...

cvp

@ihf New V00.67 with

Version V00.67
  - support UIDocumentPickerViewController for 1st argument as extension
  - if open file with extension given by 1st argument on local Pythonista,
    only files with asked extension will be shown
  - replace console.alert by hud_alert (3 seconds) where no question is asked
  - review each hud_alert message which has to be short, doc dixit
  - content file name set as text file name followed by ".content"
    (no more replace eventual extension of text file by content)
  - during save operation, previous text and content files are saved as .old
    but these .old are removed as soon as save is done
cvp

@ihf New V00.68 with

Version V00.68
  - add Cancel button when asking to choose between "local Pythonista", "Files app"
    and eventually "Photos"
  - add "delete" option in tapped image window

cvp

@ihf proposal for image (I'd develop that tomorrow)

When you tap an image, you would get a big view with
- the image/photo
- segments small/medium/large which sets a value (2/4/6) in the next TextField
- TextField to eventually enter number of rows (if none of small/medium/large is ok)
- segments left/right/top/bottom
- an ok button which closes the view
- a delete button which closes the view

When you tap on šŸ–¼ in the popup menu, you create an image mĆ©dium/left

Your opinion please

ihf

@cvp what you propose for images looks good to me.
I seem to have forgotten how to remove the date column
Also, I don’t know if there is room, but a label above the dates showing which type of date is displayed would be helpful (perhaps if the close X were a bit smaller?)
I don’t know how this happened but part of my outline text has become part of the outline numbering https://i.imgur.com/2XohBym

cvp

@ihf said:

I don’t know how this happened but part of my outline text has become part of the outline numbering

You had already got this problem, never explained thus never corrected.

The only way I saw, some weeks ago, was the use of the same.content for two files....like a.txt and a., protected from V00.67

It is sure that the text file is not coherent with the .content file. Weird and annoying if it is a bug.
No idea from where that comes.

cvp

@ihf said:

I seem to have forgotten how to remove the date column

Eye button, expand all

cvp

@ihf said:

Also, I don’t know if there is room, but a label above the dates showing which type of date is displayed would be helpful

I don't understand your request, there is the column label

ihf

@cvp on the column header, ignore my commemt.
In so far as the messed up outline goes, I try very hard to just open the most recent version of each outline yet somehow they get corrupted as you see. Here is a list of some of my files, only 2 outlines at work here: https://i.imgur.com/ePRjcQs

cvp

@ihf New V00.69 with

Version V00.69
  - new "Recover if incoherent text and content" option on Files submenu
    - if begin of text taken as outline or end of outline taken as text,
      generate new content
      nb: user needs still to save
  - new window for image sizing and positionning
    - displayed immediately at new image
      - with default medium left
    - displayed when selecting popup menu option šŸ–¼
    - window contains 
      - the image as a big view
      - segments small/medium/large for size, setting height = 2, 4, 6
      - textfield for entering eventually another height in number of rows
        - if typed value is one of standard sizes, its segment is selected
        - selecting a standard size sets the textfield value
      - segments left/right/top/bottom for positions
      - ok button to store settings
      - delete button to delete the image

Problem of incohƩrence text/content not identified but tool added to recover if occurs

cvp

@ihf said:

Here is a list of some of my files, only 2 outlines at work here: https://i.imgur.com/ePRjcQs

Just to restart clean, remove files xxx.content.content, they are from 3rd of august and the latest versions (should) protect against this problem.

cvp

@ihf said:

In so far as the messed up outline goes, I try very hard to just open the most recent version of each outline yet somehow they get corrupted as you see.

Perhaps, would it better that you test first only on one device if problems of multiple copies really comes from opening the same file on multiple devices.
First, script errors, then iCloud synchronization errors.

cvp

@ihf Small corrections in V00.70 with

Version V00.70
  - change layout of window for image sizing and positionning to support
    small iPhone width
  - correction of bug "error if image size segment selected"
cvp

@ihf Which is the value of the auto-save setting?

cvp

@ihf Interested by a format where 1st level does not have an outline?

If yes, we would need a way to get the popup menu as there is no outline to tap. For instance, we could use double tap on checkbox.

cvp

@ihf said:

In so far as the messed up outline goes

I'm not sure I understand this sentence correctly but it makes me sad

ihf

@cvp i’m not sure if I am using it incorrectly, but the recover option does not seem to be doing anything for me. I have the outline where some of the text has become part of the outline item (as in the screenshot I included above). I am running the recover option and I don’t see any change.I tried doing a save and then open after the recover and also that did not help.

cvp

@ihf Sure thƩ recover does not work for any case... If it works, you would immediately see the difference without needing to save. If you could post both files...

Recovers give

ihf

@cvp The file has some info I would prefer not to post but after using that menu item it still looks like this: https://i.imgur.com/00l43Zj

cvp

@ihf could you post the .content file, no text in it, and I could check the coherence for the 4 lines of your image

ihf

@cvp the .content file looks like this:
[([0], 4, {'hidden': False}), ([1], 4, {'hidden': False}), ([1, 0], 6, {'hidden': False}), ([1, 1], 6, {'hidden': False}), ([2], 4, {'hidden': False}), ([3], 4, {'hidden': False}), ([4], 4, {'hidden': False}), ([4, 0], 6, {'hidden': False}), ([4, 0, 0], 10, {'hidden': False}), ([4, 1], 6, {'hidden': False}), ([5], 4, {'hidden': False}), ([5, 0], 6, {'hidden': False}), ([6], 4, {'hidden': False}), ([7], 4, {'hidden': False}), ([8], 4, {'hidden': False}), ([9], 5, {'hidden': False}), ([10], 5, {'hidden': False}), ([11], 5, {'hidden': False}), ([12], 5, {'checkmark': 'yes', 'hidden': False}), ([13], 5, {'checkmark': 'yes', 'hidden': False}), ([14], 5, {'checkmark': 'yes', 'hidden': False}), ([15], 5, {'checkmark': 'yes', 'hidden': False})] {'format': 'decimal', 'font': 'Menlo', 'font_size': 18}

P.S. What is the best way to post a file to this forum?

cvp

@ihf said:

What is the best way to post a file to this forum?

For small text file, in the post it is ok.
Else, I personally use GitHub

cvp

@ihf .content seems ok, weird, sure the two files are linked. What was the name of the text file?

cvp

@ihf said:

The file has some info I would prefer not to post

I understand but could you copy the file, edit the copy, change the text without changing the number of lines and post it. As .content shows, the text file is not so big

ihf

@cvp How's this: https://gist.github.com/ifuchs/112654b1c8dbbbeb132712a2116fee63

cvp

@ihf said:

How's this:

It's ok. Files received. Visually corrupted, thus, if there is a bug, I'll be able to identify it, tomorrow.

cvp

Thus, Tomorrow, I'll try to debug this problem of visually corrupted file.
But I already have the idea that text and .content are not coherent, not from the same run
Don't forget that numbered copies of files are generated by iCloud synchronization problem and a
home assistant 3 could be generated at one run and home assistant 3.content at another run because, even if text and content are written successively, you can never foresee when this numbered copy will be written.

Finish for today

But, please
1. Tell me what you think about my proposal for images
2. Are you interested by a format where 1st level does not have an outline?
3. What is your setting for auto-save?

cvp

@ihf About your corrupted files, text and content file do not represent the same outline:

Text file contains
4.0
__4.1
5.0
6.0

Content contains
4.0
5.0
__5.1
6.0

That explains the visual corruption

Please, read carefully

At some run, the text file has been saved as (for instance) todo_3 and the content file as todo_4.content...Don't forget they are saved at different moments, even less than 1 second later.
Thus, when you open a file, the program should have to know to which content the text file is linked, and that is actually impossible.

After having had a bad night spent in searching a solution, the only way I see to solve this problem of multiple copies (named 2, 3, 4...) of the same file name would be to give a different name at each save of the same outline.

Thus, I'll save files as (for instance) todo_yyyymmdd_hhmmss and todo_yyyymmdd_hhmmss.content. Of course, previous save will be deleted after the new save.
Where yyyymmdd_hhmmss is the date/time of the save.

So, even if we would have multiple copies of todo, it would be obvious to find the newest.
I'll program that if you open an old-style file, the next save will be in the new-style.

Do you agree with this solution? I only start after your acknowledgment

JonB

I'm not really following all of this, but it seems one solution to your versioning system would be to version using a datetime suffix

E.g
mydoc_20210809_135012

Your program would control the suffix, based on the date the file is saved, so iCloud won't corrupt it -- there will always be exactly one file of each type with the appropriate name.

As an alternative, you could first save the text file, then note the date/time of the saved file,
then write that time into the .content file, so at least you could detect mis-synched files. Though I'm not sure whether iCloud preserve modification dates?

As a third alternative, consider a file format which contains ALL of the info needed to reconstruct the outline in one file. The text file would be a sort of shadow copy, but in case of mis-synched files, the .outline is the master, and can regenerate the text file.

ihf

@cvp I am in favor of any viable way to prevent the mismatch of the.content and the text file. I like the fact that the text file is now printable and usable without any other file. On the other hand when it gets out of sync with the .content, file it’s a real problem. My instinct, which is quite probably not a feasible path, is that it should be one file in XML format but I suppose that would not be usable standalone.

ccc

.json files would be more human readable and editable than .xml files.

cvp

@JonB said:

I'm not really following all of this, but it seems one solution to your versioning system would be to version using a datetime suffix

E.g

Thanks for your advices, and your first proposal is exactly what I described in the post just above yours.

cvp

@ccc said:

json files would be more human readable and editable than .xml files.

My content file is a dictionary thus a kind of json file

cvp

@ihf said:

text file is now printable and usable without any other file

I think that It is the only way to prinT a file without any app

cvp

@ihf I'll program it as described,

But, please
1. Tell me what you think about my proposal for images
2. Are you interested by a format where 1st level does not have an outline?
3. What is your setting for auto-save?

cvp

@ihf

@JonB said:

The text file would be a sort of shadow copy, but in case of mis-synched files, the .outline is the master, and can regenerate the text file.

I had also thought about this solution... As security, I shall do it also.
Thus, your content file will have a name containing the creation date/time and will contain the actual commands and the text it-self.
And a text file will also be generated as today, with an identical name, but so you can send it to another app or to the printer.

I hope I will have finished today.

cvp

@ihf As soon this future version works, what do you think about this proposal:
- no more text file generated (usually not needed because text is in .content)
- new option in files menu: "send text to app" which will do
- generate a temporary text file
- console.open_in this file
- remove this file
- change .content into .outline
- open file should select .outline files

cvp

@ihf For me, it should be easier to directly do like my last proposal: no more permanent text file but option to generate it on request to send to another app, like mail or printing
Agree with that?

Thus, it should remain only one file per outline:
todo_yyyymmdd_hhmmss.outline

And 2nd question to make my life easier: no need to support/convert old files? Start from scratch ?

ihf

@cvp Yes, some sort of Export (or Share with conversion?) would be good. As far as converting old files, absolutely no need. I can retype them.

cvp

@ihf said:

As far as converting old files, absolutely no need. I can retype them.

Thanks for that

cvp

@ihf New V00.71 with

Version V00.71
  - new files naming
    - files names will be xxxxx_yyyymmdd_hhmmss.outline (save time)
    - keep only one version
    - file will also contain text it-self
    - no more use text file as input, avoid incoherence between text and content
    - new option in Files menu to send text to other app
  - correction of bug "checking if text reaches right side did not take in account
    the eventual image at left or right"
  - remove recover option from files menu
  - correction of some english errors (@ccc GitHub issue)

Be indulgent , please. Critic modifications about files names... and content of old .content file, now .outline

And please, answer to

  1. Tell me what you think about my proposal for images
  2. Are you interested by a format where 1st level does not have an outline?
  3. What is your setting for auto-save?
ihf

@cvp I am testing v.71 and I started retyping an outline and for some reason Pythonista crashed after about 9 lines. I redid it and had no problem (this time I turned on autosave-line so that I would get something). If it happens again, I'll let you know. One small thing I noticed which has probably been there before but I never paid attention to is that when you use the promote and demote buttons the keyboard hides which if you are entering text means that you have to tap again to continue entering text. It might be better if it stayed in text entry mode.

To your questions:

1.Image proposal looks good.
2. Yes, on my Mac outline app, I typically use the 1st level as a Title.
3. It is now set to Autosave after each line (P.S. I just had another crash so glad that autosave was on :-)

I tested the new "Send text to app" feature. It worked fine but I wondered why Apple's Mail app and Messages app were not offered as apps to share with. Is that an Apple thing having to do with the file type?

cvp

@ihf said:

I turned on autosave-line so that I would get something

Not sure it works, sorry if not

cvp

@ihf said:

I wondered why Apple's Mail app and Messages app were not offered as apps to shre with. Is that an Apple thing having to do with the file type?

I don't know (no option/parameter available), I've tried .txt, .text no change
I can send to my printer app, to Files app etc....

cvp

@ihf said:

so glad that autosave was on

Thus it worked? I tHink that code is not foreseen I've forgotten

cvp

@ihf said:

Pythonista crashed after about 9 lines

I get sometimes a crash if I don't remove Pythonista from memory, wait some seconds and restart it..

cvp

@ihf said:

promote and demote buttons the keboard hides which if you ar eentering text means that you have to tap again to continue entering text. It might be better if it stayed in text entry mode.

Added in todo

ihf

@cvp yes, I can even send it to the Gmail app but not to apple’s mail app. Strange but not a big problem

cvp

@ihf next version will, for the option "send to other app", use ObjectiveC UIActivityViewController instead of console.open_in to support more apps like mail, messages etc..

See on my iPhone

cvp

@ihf New V00.72 with

Version V00.72
  - for promote/demote keys above keyboard, cursor will be set at end of text
    instead at start
  - for the option "send to other app", use now ObjectiveC UIActivityViewController
    instead of console.open_in to support more apps like mail, messages etc..
  - support formats with 1st level without outline (title)
    - switch at bottom of available outline formats
    nb: no actual way to get popup menu
        workaround: 1st level has outline ON/popup action/1st level has outline OFF

cvp

@ihf Perhaps did you see my PKCanvasView topic. If you think about a way to integrate this functionality in our script, tell me.

ihf

@cvp I had not seen that post. Is the idea that that would give us away to draw images that would be added to the outline? Or is it for modifying existing images that have been added?

cvp

@ihf said:

I had not seen that post

It is to manually draw or write in a blank view or on an image but perhaps could you imagine a way to use it, like, for instance, draw a sketch in an ouTline

cvp

@ihf As I don't have any news from you, I write down my todo:
1. Bug: auto save does not work (Edit: development in progress)
2. Bug: multi undo's does not work always
3. Bug: no way to get popup menu for a line without outline (Edit: development in progress)
4. New: use 2nd argument as directory where to find the script given as 1st argument

Please, don't hesitate to describe any bug or request

cvp

@ihf If you select the option "send to other app", the program generates an outline.txt file and opens the share sheet with it.
We could also generate a .rtf file to send to your printer app, like I did on my HP printer

Of course, actually, fonts are hard coded in the script, only to show what could be possible.

cvp

@ihf new V00.73 with

Version V00.73
  - auto-save is now operational
    nb: see in settings, just after title 'auto-save', the duration of last save
  - row without ouline does not allow to tap on outline to get popup menu,
    in this case, tap on checkbox of the row will ask you if you want to 
    - tap the checkbox
    - open the popup menu
    nb: this choice only exists for row of 1st level without outline

If you don't like the way to get popup menu for a line without outline, tell me

.rtf not supported, I wait for your opinion

cvp

@ihf Just to know: are you still using my program?

ihf

@cvp haha...of course. I'm dependent on it :-) Sorry for not getting back to you. I have been distracted by some other things but I am back to using it for a project. Question about auto-save: if autosave is set to line and it has done a save and then I close the program, should it ask about saving?

cvp

@ihf said:

save and then I close the program, should it ask about saving?

It should not if you didn't enter characters after the save, but, obviously bugs are possible

cvp

@ihf I propose to abandon the .rtf format, very old, and which does not allow to display the images included in the text. On the other hand, if you are interested in the pdf format, I could include the choice of text or pdf when sharing the file. What do you think ?

ihf

@cvp I will do some further tests on autosave just to be sure but I think it did ask me if I wanted to save even though I had entered a new line and auto save was set to line. I tried using auto save character and found that the program became a bit slow (not surprisingly). This might be less of a problem on something faster than iPhone 7.

cvp

@ihf said:

I tried using auto save character

Not adviced

cvp

@ihf said:

the program became a bit slow (not surprisingly).

Did you check the duration of the save?

ihf

@cvp Text and PDF make the most sense to me.
I have been getting some Pythonista crashes occasionally while using outline. This is undoubtedly not a problem with your program but it does remind me that Pythonista, lacking any form of maintenance, will be a problem down the line. If @omz has no plan to go back to maintaining/enhancing Pythonista, I wish he would make it open source so that the community could maintain it. There are other options for running python under iOS now but none of them have the kinds of libraries that are necessary to do what you have done.

cvp

@ihf said:

There are other options for running python under iOS now but none of them have the kinds of libraries that are necessary to do what you have done.

I guess that Pyto could be a solution but it should be an enormous work to convert my script.
And the developer seems to be also a lot absent...

cvp

@ihf New V00.74 with

Version V00.74
  - for the option "send text to app", now a choice .txt/.pdf/cancel is provided
    - if .pdf is selected, an outline.pdf file is created supporting
      outline/text color and included images
      nb: paper page is supposed to be an A4 with
          15mm for left margin and 5mm for right margin on the 210mm paper width
                  5mm for top and bottom margins on the 297mm paper height
ihf

@cvp There appears to be a little problem when dates are shown and there are multiple levels.
https://i.imgur.com/TcWTDsw

ihf

@cvp the date column label and sort button seem to disappear at times (perhaps after moving an item? I also managed to lose the top row of icons when I used collapse all to hide the date column.
Wish list: support bold/italic/strikethrough/underline font.

cvp

@ihf said:

I also managed to lose the top row of icons when I used collapse all to hide the date column.

I don't understand, sorry.

cvp

@ihf said:

the date column label and sort button seem to disappear at times

I'd prefer to remove these dates when you modify the outline.
Do you want to do modifications while dates are visible?

cvp

@ihf said:

There appears to be a little problem when dates are shown and there are multiple levels.

I can' reproduce that, can you?

cvp

@ihf said:

Wish list: support bold/italic/strikethrough/underline font.

Before the real process, you have to decide how and which portion of texts could have special attributes:
- different type by level (ex: all lines of 1st level bold)
- different type by row (ex: this line underlined)
- different type by selected text (ex: this word italic)
and thus, how to set these attributes.

For instance, we could first define different font-types, named f1, f2, ....
And we could, via a button "set font-type", attribute one font type to
- all rows of level 1
- one selected row
- one selected word

Think about it.

ihf

@cvp For me, selected text would be the best. That is, no relationship to the outline.

cvp

@ihf said:

For me, selected text would be the best. That is, no relationship to the outline.

Thus, nothing like "all lines of 1st level in bold"?

ihf

@cvp I would probably not use that.

cvp

@ihf said:

I would probably not use that

Ok, we will start with a functionality to set a selected part as bold/italic/strike/underline...
I don't yet know how to store that in content file...

ihf

@cvp when typing on iPhone in portrait mode and I reach the end of the line I get this error:

Traceback (most recent call last):
  File "/var/containers/Bundle/Application/BD1F4CA5-69E3-4F62-BEFE-2AD2B2CD0813/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 869, in __call__
    argtypes = kwargs['argtypes']
KeyError: 'argtypes'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/outline.py", line 3059, in tableview_reload_one_row
    self.tvo.reloadRowsAtIndexPaths_withRowAnimation_([nsindex], UITableViewRowAnimationNone)
  File "/var/containers/Bundle/Application/BD1F4CA5-69E3-4F62-BEFE-2AD2B2CD0813/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 878, in __call__
    args = tuple(_auto_wrap(a, argtype_encodings[i], argtypes[i+2]) for i, a in enumerate(args))
  File "/var/containers/Bundle/Application/BD1F4CA5-69E3-4F62-BEFE-2AD2B2CD0813/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 878, in <genexpr>
    args = tuple(_auto_wrap(a, argtype_encodings[i], argtypes[i+2]) for i, a in enumerate(args))
  File "/var/containers/Bundle/Application/BD1F4CA5-69E3-4F62-BEFE-2AD2B2CD0813/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 695, in _auto_wrap
    return ns(arg)
  File "/var/containers/Bundle/Application/BD1F4CA5-69E3-4F62-BEFE-2AD2B2CD0813/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 1007, in ns
    arr = NSMutableArray.array()
  File "/var/containers/Bundle/Application/BD1F4CA5-69E3-4F62-BEFE-2AD2B2CD0813/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 727, in __call__
    ordered_args = list(args) + [kwargs[key] for key in kwarg_order]
TypeError: 'int' object is not iterable
cvp

@ihf said:

when typing on iPhone in portrait mode and I reach the end of the line I get this error:

Reproductible? Each time, each line?

ihf

@cvp kind of. I just tried again and got an error except the error is slightly different.

Traceback (most recent call last):
  File "/var/containers/Bundle/Application/BD1F4CA5-69E3-4F62-BEFE-2AD2B2CD0813/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 869, in __call__
    argtypes = kwargs['argtypes']
KeyError: 'argtypes'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/outline.py", line 3059, in tableview_reload_one_row
    self.tvo.reloadRowsAtIndexPaths_withRowAnimation_([nsindex], UITableViewRowAnimationNone)
  File "/var/containers/Bundle/Application/BD1F4CA5-69E3-4F62-BEFE-2AD2B2CD0813/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 878, in __call__
    args = tuple(_auto_wrap(a, argtype_encodings[i], argtypes[i+2]) for i, a in enumerate(args))
  File "/var/containers/Bundle/Application/BD1F4CA5-69E3-4F62-BEFE-2AD2B2CD0813/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 878, in <genexpr>
    args = tuple(_auto_wrap(a, argtype_encodings[i], argtypes[i+2]) for i, a in enumerate(args))
  File "/var/containers/Bundle/Application/BD1F4CA5-69E3-4F62-BEFE-2AD2B2CD0813/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 695, in _auto_wrap
    return ns(arg)
  File "/var/containers/Bundle/Application/BD1F4CA5-69E3-4F62-BEFE-2AD2B2CD0813/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 1007, in ns
    arr = NSMutableArray.array()
  File "/var/containers/Bundle/Application/BD1F4CA5-69E3-4F62-BEFE-2AD2B2CD0813/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 727, in __call__
    ordered_args = list(args) + [kwargs[key] for key in kwarg_order]
  File "/var/containers/Bundle/Application/BD1F4CA5-69E3-4F62-BEFE-2AD2B2CD0813/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 727, in <listcomp>
    ordered_args = list(args) + [kwargs[key] for key in kwarg_order]
TypeError: unhashable type: 'dict'
cvp

@ihf said:

I just tried again

Could you explain more precisely what you did, so I could try to reproduce it

ihf

@cvp I merely typed a line and when I got to the end on the right I got the error

cvp

@ihf I'll try tomorrow, end for today

cvp

@ihf said:

For me, selected text would be the best

When you select a portion of the text in a row, the keyboard appears.
Could you imagine a supplementary key like this to start the process of selecting
attributes like bold/italic/underline/strike (not yet programmed at all)

ihf

@cvp Sure, that would be fine. The thing I have not tested yet is how Outline will function when I use an external keyboard on the iPad

cvp

@ihf said:

external keyboard

I don't have one, thus not tested at all

cvp

@ihf you did not answer to questions relative to your tests with dates

  1. @ihf said:

    I also managed to lose the top row of icons when I used collapse all to hide the date column.

I don't understand, sorry.

  1. @ihf said:

    the date column label and sort button seem to disappear at times

I'd prefer to remove these dates when you modify the outline.
Do you want to do modifications while dates are visible?

  1. @ihf said:

    There appears to be a little problem when dates are shown and there are multiple levels.

I can' reproduce that, can you?

ihf

@cvp 1. I have only seen this once (where the Icons do not show up). If it ever happens again I will let you know.
2. No, it is not necessary for the dates to be visible when editing text but it should be possible to move items around with dates visible.
3. I will see if I can reproduce this.
Is the time kept (but not shown) with the date or is it only the day?

cvp

@ihf said:

how Outline will function when I use an external keyboard on the iPad

I guess that the special keys of the above row would not be accessible.
Promote and demote also exist in the popup menu thus are available but for this new key for bold/... would not. I could add the functionality in the popup menu. What do you think about?

cvp

@ihf said:

Is the time kept (but not shown) with the date or is it only the day?

Date and time are memorized (you can see them by editing the .outline as text in Pythonista, but be careful: don't change anything) but not shown actually

cvp

@ihf said:

it should be possible to move items around with dates visible.

It is possible

cvp

@ihf For info, future attributes

ihf

@cvp WIth regard to the font changes, having them in the popup is fine but will the other top row functions be accessible with an external keyboard. (I guess, I should try it and see what it looks like now)

cvp

@ihf said:

will the other top row functions be accessible with an external keyboard

To be accessible, you should get the hexadecimal value of the keys you would use for these functionalities

cvp

@ihf said:

I merely typed a line and when I got to the end on the right I got the error

I don't forget this problem, set as priority in my todo, but, even if I have reproduced once on my iPhone, and even on my iPad in split view, this happened only once... Annoying.
Thus, as I always prefer the fun, I spend actually some time with font attributes.

cvp

@ihf I have programmed the setting of attributes like bold but I have problems with the way I store them, especially when I insert or delete characters in a row where some portions have already attributes. Thus, I'm thinking about another way... Patience...I hoped it for today but it will not be ready.

cvp

@ihf Even if I hate (šŸ˜‚) you when I have to search for (my, I know) bugs, I would thank you for the lot of fun I get when I program things like

cvp

@ihf New V00.75 with

Version V00.75
  - support additional key above keyboard when editing text of row
    - key is functional if portion of text if selected
    - key shows a view to set bold/italic/underline/strikethrough/outline attributes
      to selected portion of text
      - if selected text had already, for each of its characters, same attributes,
        switches are initialized to take them in account
      - multiple attributes are allowed (ex: bold and italic and underlined)
      - changing attributes redisplay the selected text in the window
      - an ok button ends this window and stores the attributes
      nb: you have to know that if you insert or delete a portion of text that 
      === overlaps an attributed text, this one is reset as normal, because
          it seems actually a little bit too complex for me, but I added it
          to my todo list.
    - pdf will also take in account the text attributes
ihf

@cvp This is a very nice addition. I notice that if I apply bold to a word and then select a word a few words later in the same item and apply bold, all words in between are changed to Bold.

cvp

@ihf said

I typed a line and when I got to the end on the right => error

Can you reproduce it "on demand"? If yes, and you restart Pythonista, is it still the case?

cvp

@ihf New V00.76 with

Version V00.76
  - correction of bug "apply bold to a word and then select a word a few words later
    in the same row and apply bold, all words in between are changed to bold"
  - you can now insert or delete anywhere in a text with attributes without losing
    these attributes, but any new character does not get any automatic attribute,
    even if you insert between two characters of same attribute.
    nb: annoying effect, any attributes update via insert/delete loses cursor
cvp

@ihf would you prefer the strikethrough line in an other color?

cvp

@ihf New V00.77 with

Version V00.77
  - add "shadow" attribute
  - add "color" attribute

ihf

@cvp I like all the font options. In so far as the strikethrough line color, I think that it should probably be the color of the font. unrelated: I notice that font changes are not undoable (I mean using undo/redo)

cvp

@ihf said:

font changes are not undoable

I didn't even think about it šŸ¤•, now added in my todo list.
But I remember you that multiple undo's functionality is still buggy.

Edit : now programmed, but does not work, like some other undo's even if it is exactly the same code. Next week, I'l try to correct this annoying bug.
I have already searched but without success, for weeks...

cvp

@ihf New V00.78 with

Version V00.78
  - correction of bug "add character after portion with attributes, new character
    has same attributes until row redisplayed by a scroll"
  - correction of bug "insert/update in attributed  portion of text looses the cursor"
  - add "oblique" attribute
  - add "background color" attribute

cvp

@ihf said

I typed a line and when I got to the end on the right => error

Can you reproduce it "on demand"? If yes, and you restart Pythonista, is it still the case?

ihf

@cvp I tried just now but was not able to reproduce it. I’ll continue trying it and let you know if it reappears. However, I just opened an outline and went to select update date and when I hit view dates I got this error:
https://i.imgur.com/ezqUAXn

cvp

@ihf New V00.79 with

Version V00.79
  - correction of bug "if open outline was displayed with dates, and you create
    a new or open another one, the title of dates was still displayed while dates
    them-selves were not shown"
  - correction of bug "view dates crashes with error on 'dates_sort_mode'"
cvp

@ihf Would you like this functionality (filling outline with other color)?

And this one (exponent, indice)?

ihf

@cvp both of those are very cool, although I’m not certain how much I’d use them. Question about dates: does the due date have any system relationship to ended date or is due date something you set and ended date is strictly based on the state of the checkbox?
Wish list: send reminders on due date/time via email or perhaps pushover notification(easy to do in Python).

cvp

@ihf said:

Question about dates: does the due date have any system relationship to ended date or is due date something you set and ended date is strictly based on the state of the checkbox?

I think that I programmed as you asked:
- due date is set by you
- end date is automatically set when you check the checkbox, and removed if you uncheck the checkbox

cvp

@ihf said:

Wish list: send reminders on due date/time via email or perhaps pushover notification(easy to do in Python).

Which one do you prefer: reminder or notification?
At the hour/minute you have fixed in the "set due date"
Don't forget that Pythonista notification is a local notification on the same device.

ihf

@cvp I was thinking of email or Pushover. Both would require credentials. I have used Pushover in other contexts. Pushover requires code like this:

import http.client, urllib conn = http.client.HTTPSConnection("api.pushover.net:443") conn.request("POST", "/1/messages.json", urllib.parse.urlencode({ "token": "APP_TOKEN", "user": "USER_KEY", "message": "hello world", }), { "Content-type": "application/x-www-form-urlencoded" }) conn.getresponse()

or this library works well also: https://github.com/Wyattjoh/pushover

Email would be best for people who don't have a Pushover account.

cvp

@ihf said:

Pushover

I don't know but why not standard Apple notification?

cvp

@ihf New V00.80 with

Version V00.80
  - correction of bug "recompute frame of popover shield if device rotated
    while shield is active"
  - on an iPhone in landscape mode, attributes popup is too high, change View
    into a ScrollView so each attribute is reachable even if device is rotated
    while script is running"
cvp

@ihf said:

email or Pushover. Both would require credentials

I could start a Shortcut with as "from" an email configured in your iOS settings, thus no credential has to be managed by the script

ihf

@cvp one would want the notification to be sent without user interaction but it occurs to me that this may be of limited utility since the script has to be running in order to send the notification. Maybe I need to rethink this.

cvp

@ihf said:

limited utility since the script has to be running in order to send the notification

Not at all.
When you will set the due date via the script, this one would create a notification which will be stored internally by iOS until this due date/time, then sent to your device, automatically without needing that the script runs at this instant.
The only limitation is that if you set this due date on your iPad, the notification will be sent on this iPad, and not on your iPhone.

cvp

@ihf New V00.81 with

Version V00.81
  - when you set a due date, script will generate a system local notification
    which will alert you at due date/time, even if Pythonista is not running.
    nb: - a default sound is played 
        - if you tap the notification, Pythonista will start and run this script
        - notification is created even if file is not saved after due date setting 
        - notification is only sent on the device where you have set the due date
        - if the outline contains an image, it will be displayed in the notification

Of course, this functionality is only for testing. For instance, the notification is created even if you don't save the file after having set the due date.
Just test by setting a close due date/time to an outline and check what occurs.
If this is what you hope, you would decide which texts, sound, image, action when you tap the notification.
Normally, Pythonista had foreseen several actions/urls through buttons that are shown by a long press on The notification in the notifications center.
If you accept the functionality, I would program that
- the notification would be really created after first save of the file
- if you modify the due date before the notification occurs, The program would cancel the previous notification by storing the notification identifier
- a setting notifications yes/no (ok?)
- a red corner or colored background in the checkbox if a due date is already set (ok?)
- I could even generate a dynamic image containing the filename/outline/text/eventual image/any infos like dates,...
- we could even imagine that one action of the notification could be "set the outline as done" and
the notification could automatically run Pythonista script and open the relative file and set the outline as done, and save the file... Marvelous, isn't?

To be operational, you need to configure once iOS settings/notifications/Pythonista to accept notifications.

Long press could give

ihf

@cvp yes that’s the advantage of ios notifications over Pushover (and similar services)…they can be set in advance. However, the downside of not getting the notification on other ios devices is probably a show stopper for me, since I often work on the outline on the iPad but would want notification on the iPhone/Watch. TW, how do you unset a due date?

cvp

@ihf said:

how do you unset a due date?

You can't but you can change it by resetting it

Do you want a way to unset it?

cvp

@ihf said:

not getting the notification on other ios devices is probably a show stopper for me, since I often work on the outline on the iPad but would want notification on the iPhone/Watch

Let me think about.

Do you have Pyto?

Pyto allows remote notifications via a Pyto server, from a device to another
But no schedule can then be given 🄲

We could imagine this sequence:

On your iPad, you set a due date, the program
- create a local notification for the future
- send a remote notification to your iPhone

On your iPhone, you receive this remote notification and you tap on it thus manual operation
- a program starts, which
--- gets the info (how?, to be studied)
--- creates a local notification for the future

ihf

@cvp I was going back to an old question about supporting tab and shift tab (as demote and promote) and I tried running the script you posted but it shows that tab and back tab are both x’09’. Find this strange since if I am in a form or a web site and I use tab and shift tab it moves the cursor as I would expect. If the keyboard is producing the same keys, how could that be?

cvp

@ihf said:

If the keyboard is producing the same keys, how could that be?

As I don't have any external keyboard, I can't help.

Perhaps one of our guru's @JonB , @ccc , @mikael , @dgelessus , @zrzka could tell us how a Pythonista script could differentiate tab and shift/tab keys? Perhaps using UIKeyCommand? blackMamba?
Thanks to them by advance

cvp

@ihf test tab and shift/tab keys on virtual and external keyboards with this little script

If you try to change field by tapping it with your finger or by the shift/tab, you will see that the same delegates are called, thus it should not be possible to use it as demote key, at least I think so, because they are not received by any delegate. Or perhaps a n ObjectiveC keyboard key interception?
For the tab key, I could use it as promote but that would say that you would no more have a real tab.
It would easier to use F-keys but I don't know we can attribute them an hexadecimal value, perhaps in iOS settings/accessibility/keyboard/full access to keyboard/commands.

Edit: I forgot that I can use my iMac Bluetooth keyboard as external keyboard šŸ¤• I'll do some tests.
Thus, we have to find how to generate a key for Textview_should_change when we tap tab or shift/tab or F-keys reserved for that.

You will see that with shift/tab, iOS calls textview_should_begin of all TextViews... Weird
"UIKit rapidly queries all of the text fields on screen with textFieldShouldBeginEditing: to see which fields can be tabbed into."

import ui

class MyTextViewDelegate (object):
    def textview_should_begin_editing(textview):
        print('textview_should_begin_editing', textview.name)
        return True
    def textview_did_begin_editing(textview):
        print('textview_did_begin_editing', textview.name)
        pass
    def textview_did_end_editing(textview):
        print('textview_did_end_editing', textview.name)
    def textview_should_change(textview, range, replacement):
        print('textview_should_change', textview.name, ord(replacement))
        return True
    def textview_did_change(textview):
        print('textview_did_change', textview.name)
        pass

v = ui.View()
v.frame = (0,0,400,400)
v.background_color = 'gray'
tf1 = ui.TextView(name='tf1')
tf1.frame = (10,10,100,30)
tf1.delegate = MyTextViewDelegate
v.add_subview(tf1)
tf2 = ui.TextView(name='tf2')
tf2.frame = (10,50,100,30)
tf2.delegate = MyTextViewDelegate 
v.add_subview(tf2)
tf3 = ui.TextView(name='tf3')
tf3.frame = (10,90,100,30)
tf3.delegate = MyTextViewDelegate 
v.add_subview(tf3)
v.present('sheet')
cvp

@ihf In parallel with this problem about external keyboard, let us go on with notifications request.

I suppose that your calendar is configured on iCloud Drive so you get alarms notifications on each device.
I think the best way to be notified of a due date on each device would be this:
when you set a due date, the program could create an event with alarm on the due date/time, in a particular calendar. When you change or unset the due date or some time after this one is reached, the program could remove this event from the calendar, so this calendar will no grow infinitely.

What do you think about this solution?

ihf

@cvp I think that would work (at least for me). Advantage, with a separate calendar it would be easy to see all items with due dates (similar to ordinary ios reminders).

cvp

@ihf said:

I think that would work

Ok, I'll do it

cvp

@ihf Relative to promote/demote on external keyboard, I've just tested BlackMamba with my iMac Bluetooth keyboard: I could intercept Ctrl/Left and Ctrl/Right, but I think that we can't intercept Shift/Tab because standard key event.

ihf

@cvp that sounds OK to me. Just for my edification, what does it mean that it is a standard key event? How are other apps able to distinguish tab from shift tab?

cvp

@ihf said:

How are other apps able to distinguish tab from shift tab?

Sincerely, I really don't know but I have read in zrzka (creator of BlackMamba) doc that some standrard keys combinations can not be replaced. Perhaps, we could learn more if @JonB helps us.

cvp

@ihf said:

distinguish tab from shift tab?

If you have tried my little script with 4 textviews, you have seen that Pythonista gets the tab as 09 but does not receive any code for the back tab

ihf

@cvp Yes, that’s what I don’t understand. It’s as if Pythonista conflates the two.

cvp

@ihf said:

I think that would work (at least for me)

Why did you say "at least for me"? The script is for you, isn't it?

cvp

@ihf said:

It’s as if Pythonista conflates the two.

I don't think Pythonista does that, I think that it is so that ObjectiveC TextFields work

ihf

@cvp I just went to view with ended date and got this:
Traceback (most recent call last): File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/outline.py", line 2678, in tableview_cell_for_row if self.dates_sort_mode == 0: AttributeError: 'Outliner' object has no attribute 'dates_sort_mode'

ihf

@cvp I don’t know if it’s already possible to do this but I often start the outline script using an iOS shortcut. It just uses the action to start Pythonista and specifies the script to start. Is there anyway for the shortcut to also specify the outline that the script opens? That way I could have Shortcuts which open various different outlines.

ihf

@cvp I guess this might work if you could pass the name of the outline to the script as a parameter since the iOS shortcut should pass that in.

ihf

@cvp Oh wait, the name of the outline includes the last saved date which means it keeps changing. It would have to use the part of the name that is unchanged.

cvp

@ihf said:

I guess this might work if you could pass the name of the outline to the script as a parameter since the iOS shortcut should pass that in.

I worked until I have added the date and time to the file name to avoid previous problems of incoherence...

I add this request to my long todo list, sorry for you, you will need patience.

cvp

@ihf said:

e name of the outline includes the last saved date which means it keeps changing. It would have to use the part of the name that is unchanged.

I answered the previous post before I have read your last post.''
I would have to find the entire name and it could be difficult because a lsdir xxx.* only works with locally downloaded files... But I can try if you don't let the file a long time not open

cvp

@ihf said:

Traceback (most recent call last):
File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/outline.py", line 2678, in tableview_cell_for_row
if self.dates_sort_mode == 0:
AttributeError: 'Outliner' object has no attribute 'dates_sort_mode' ```

I thought it was solved in v00.79

ihf

@cvp that was with V0.81

cvp

@ihf said:

that was with V0.81

Just found one case... correction follows

cvp

@ihf New V00.82 with

Version V00.82
  - correction of bug "AttributeError: 'Outliner' object has no attribute 
    'dates_sort_mode' when view dates is selected"
  - new button to unset due date, above datepicker it-self
  - remove notifications process, not usable because impossible to send
    a notification to anoter device
cvp

@ihf New V00.83 with

Version V00.83
  - if 1st argument of program is the prefix of an outline file, program
    opens outline with highest file name beginning with this prefix + '_20'

Try but, for me, end of the day

As argument, if your file is 'todo_20210822_123456', use only todo

ihf

@cvp filename began with ToDo. I tried it as parameter in shortcut but no outline was opened.

cvp

@ihf said:

filename began with ToDo. I tried it as parameter in shortcut but no outline was opened.

Before using a shortcut, could you try this way
1. Long press on the run button
2. Type ToDo
3. Tap run

The outline has to be in the current folder and locally downloaded

Anyway, post also the content of the shortcut function of in which folder is your script
pythonista3://outline.py?action=run&args=ToDo

And that works (in local Pythonista files and in iCloud)

ihf

@cvp
pythonista3://outline.py?action=run&args=ToDo works. However long press on Run with parameter gives ā€œfile argument does not exitā€ (sp)
My outlines are in an outline folder.

cvp

@ihf said:

My outlines are in an outline folder

I guess it is the current folder that you see in settings

cvp

@ihf said:

However long press on Run with parameter gives ā€œfile argument does not exitā€ (sp)

The program does not see any difference, are you sure that you type in correct upper/lower case?

Nb: what is (sp)?

ihf

@cvp yes, I am typing correct case. (sp) refers to the spelling error (exit=exist)

cvp

@ihf "exit" corrected.

I don't understand, I've called a file ToDo and tried with run and url, both work

Sure you did not change current path between the two tests?

Sure you have only one argument?

ihf

@cvp strange, it works with an outline called HA and fails with an outline called ToDo

cvp

@ihf is ToDo locally downloaded?

ihf

@cvp yes both files are downloaded. I will do some more testing and make sure it is behaving as I think it is.

cvp

@ihf I did test with ToDo and ok

cvp

@ihf Insert a line print(f) after line 1384 to check if files of folder are seen

Is your ToDo file name of the new styleToDo_yyyymmdd_hhmm.outline?

ihf

@cvp I closed pythonista and restarted shortcuts. I ran a shortcut which starts pythonista with outline ToDo.Pythonista starts and runs outline with outline HA (which is the last outline opened)

cvp

@ihf First of all, which shortcut do you run? I remember that run Pythonista action did not work. (arguments were not passed)
You have to do
Action 1: url =Pythonista3://.......&args=ToDo
Action 2: open url

ihf

@cvp I forgot that the Pythonista action did not pass parameters. I changed it to open the URL and it seems to be working correctly.

cvp

@ihf

cvp

@ihf About calendar event, how do you want it looks? In which calendar?
In thistest, event title includes file name, outline, text

ihf

@cvp that sounds good to me. Could it contain a url to take you into the outline? (of course I understand that would only work on ios devices suitably setup with Pythonista and the outline downloaded , not other ios devices or the Mac.

cvp

@ihf said:

Could it contain a url to take you into the outline?

Sorry, with my poor English, I'm not sure to correctly understand this sentence.

Do you mean this: if the text of the outline contains (at least) one url, I store it (the first one if several) in the url field of the event.

Ho, I think I understand: you want an url to directly start Pythonista Outline program with automatic open of the file.... Smart

ihf

@cvp what I meant was whether the calendar event could include the url to open the outline that contains the event. If the outline item has a URL I suppose that can be part of the text in the calendar event.

cvp

@ihf we crossed our posts

cvp

@ihf said:

I suppose that can be part of the text in the calendar event.

You are right.

Are you sure that is ok to have the whole text in the event title, or do you prefer in the notes?

ihf

@cvp that's a good question. Obviously it would be good if the title conveyed the gist of the outline item but since the item could be of any length, putting it in the Note field makes sense. Perhaps the beginning of the item followed by ...

cvp

@ihf said:

url to open the outline that contains the event.

In which folder is your program? Root of Pythonista? And I guess that your outlines are all in an unique, set as current folder.

ihf

@cvp yes, the outline.py is at root level and my outlines are in a folder set as current folder.

cvp

@ihf I hope that you understand that my program becomes very long and complex (for me).
For instance, I can easily create an event but the process to remove it for several reasons will not be ready shortly.
Remove event if
- save refused
- due date unset
- due date modified
- due date reached since some time
- outline row removed
And quid if after having created an event, you modify its outline or text or file name?

cvp

@ihf said:

url to open the outline that contains the event

Apple event does not contain anymore an url field...
Normally, we add it as first line in notes...

cvp

@ihf

ihf

@cvp Yes, I had not thought through the various cases for what happens if you set a reminder/calendar event and then change something. My inclination is to set the reminder and then if the outline disappears or the item is deleted or changed, c'est la vie. I suppose it would best if the full text of the item was in the notes field, then the reminder kind stands on its own.

ihf

@cvp calendar events do have notes and url fields

cvp

@ihf said:

calendar events do have notes and url fields

No url but notes yes, see example above

cvp

@ihf said:

suppose it would best if the full text of the item was in the notes field,

It is what shows my example above:
- title contains file/outline/20 first characters of text
- notes contain url and full text

ihf

@cvp perhaps we are talking about different calendars?

https://imgur.com/a/fIFDhuL

cvp

@ihf said:

My inclination is to set the reminder and then if the outline disappears or the item is deleted or changed, c'est la vie

Do you confirm: nothing to program in all these cases....
Will stay the cases when
- event is created but save is not confirmed?
- old events to remove after due date?

cvp

@ihf said:

perhaps we are talking about different calendars?

I use standard Apple calendar (iCloud account) and Calendars5 of Readdle as app

What is the app you show in your Imgur image?

ihf

@cvp I am using ICloud calendar but with Apple's Calendar app.
I don't see a need to remove events after due date (afterall, you may just be late getting to it). Perhaps the event should be crated when the save is done?

cvp

@ihf said:

Perhaps the event should be crated when the save is done?

I have to think about it because the program could create the events just before the save and the save crashes 😢

cvp

@ihf I'll upload a new version without changing code, enough for me today.
So you can test the events and tell me what to modify.

and in some days (not free tomorrow) I'll review,the code concerning the save.

cvp

@ihf New V00.84 with, please read carefully and give me some feedback

Version V00.84
  - support Ctrl/right and Ctrl/Left on external keyboard to generate 
    promote/demote on edited outline text, using @zrzka Blackmamba module,
    see https://blackmamba.readthedocs.io/en/stable/about.html
    this needs
      1) installation of Blackmamba in site_packages-3, via typing in console:
         import requests as r; exec(r.get('http://bit.ly/get-blackmamba').text)
      2) some modification of site_packages/pythonista_startup.py: at end, add lines
         import blackmamba
         import blackmamba.log as blackmamba_log
         # Default value is INFO. Use ERROR if you'd like to make Black
         # Mamba quiet. Only errors will be printed.
         blackmamba_log.set_level(blackmamba_log.INFO)
         #blackmamba.main()
      3) restart Pythonista
  - when you set a due date, script will generate an event in a Calendar 
    which will alert you at due date/time, even if Pythonista is not running,
    on all your devices that share the same calendar
    - event title includes file name, outline, text
    - calendar is named "Outline"
      - an error message is displayed if calendar does not exist
    - due date has to be later than date/time when you set it
    - event if immediately written, even if save would not be done
    - not yet programmed: event should be removed if
      - you refuse the save
    - will not be programmed (@ihf confirmation): event should be removed if
      - you unset due date
      - you change due date
      - some time after due date is reached
        - script, at start, will scan the entire calendar to find and check events
      - you remove the outline row
  - sometimes, crash because keyboard_frame_did_change called before tableview was
    created
ihf

@cvp I created a calendar called Outline in iCloud and it shows up on my iPhone and Mac, but I am getting Outline calendar does not exist when I set a due date.

cvp

@ihf did you restart Pythonista and is it allowed to access calendars? In settings

ihf

@cvp I restarted Pythonista but my settings look quite different.
https://i.imgur.com/9ZqfAVa

cvp

@ihf Strange, but you don't have access to Calendar... neither Photos

Try this

import threading
from objc_util import *
# Once Pythonista has been authorized, this code does not need to be executed
#------- begin of commented code
store = ObjCClass('EKEventStore').alloc().init()
access_granted = threading.Event()
def completion(_self, granted, _error):
    access_granted.set()
completion_block = ObjCBlock(completion, argtypes=[c_void_p, c_bool, c_void_p])
store.requestAccessToEntityType_completion_(0, completion_block)
access_granted.wait()
#------- end of commented
ihf

@cvp Brilliant! That worked and the script was able to add an event after setting due date.

ihf

@cvp Deleting the event if marked as completed or deleting and resaving the event if the due date is changed would be nice but it is already quite usable.
Suggested improvements: After setting the due date, some feedback that the event was successfully added, would be helpful. If the program gets a wider audience you might also consider making the calendar event functionality an option or else there will be errors if the calendar is not setup , as well as making the calendar name settable and perhaps the script should create the Calendar if it doesn’t exist.
This is quite a program! šŸ‘

cvp

@ihf said:

This is quite a program! šŸ‘

Thanks, that make me happy

cvp

@ihf said:

Deleting the event if marked as completed or deleting and resaving the event if the due date is changed would be nice but it is already quite usable.
Suggested improvements: After setting the due date, some feedback that the event was successfully added, would be helpful. If the program gets a wider audience you might also consider making the calendar event functionality an option or else there will be errors if the calendar is not setup , as well as making the calendar name settable and perhaps the script should create the Calendar if it doesn’t exist.

Added in my long todo list

cvp

@ihf Did you try Ctrl/Right and Left?

cvp

@ihf said:

After setting the due date, some feedback that the event was successfully added, would be helpful.

That would say that creating the event has to be done immediately, even if not yet saves'or force the save just after. Perhaps the best solution, what do you think?

ihf

@cvp is it Tab and Ctrl-tab that are supposed to be demote and promote? If so, they do not work.

cvp

@ihf said:

is it Tab and Ctrl-tab that are supposed to be demote and promote? If so, they do not work

No, I didn't find a way for them.
It is Cmd and Right together, and Cmd and Left together. (Sorry, my error, I wrote Ctrl but it is Command, I could have set Ctrl but the key is far from the arrows)

Pressing these two keys together should simulate Shift/Tab

These keys are only valid while Outline is running.

If you uncomment the line blackmamba.main() in pythonista_startup.py, you will get a lot of blackmamba shortcuts for the external keyboard. See its doc

cvp

@ihf I suggest that if we add, unset, change a due date, the event was immediately added, deleted or updated and that a save immediately follows.
If not so, and suppose you have touched several events, feed-back of each operation would be impossible
Your opinion, please.

ihf

@cvp yes, an immediate save would seem to be needed.

ihf

@cvp I just started outline.py, the last outline came up and then I got ā€œfile argument does not existā€, and then the msg disappeared.

cvp

@ihf Sure that your last argument did not stay?
If file as argument does not exist, you get a message and program continues with the last open file.
Messages always disappear after 3 seconds. I have been obliged to replace all console.alert by console.hud_alert for threads problem when using ui modal dialogs

ihf

@cvp One problem with using the Command key for the promote/demote is that if you hold Command too long the help menu comes up

cvp

@ihf said:

One problem with using the Command key for the promote/demote is that if you hold Command too long the help menu comes up

The blackmamba module is not in my hands...Perhaps could you enter an issue or question at Github

cvp

@ihf

Sure that your last argument did not stay?
If file as argument does not exist, you get a message and program continues with the last open file.
Messages always disappear after 3 seconds. I have been obliged to replace all console.alert by console.hud_alert for threads problem when using ui modal dialogs

Please tell me

cvp

@ihf said:

One problem with using the Command key for the promote/demote is that if you hold Command too long the help menu comes up

Did you uncomment the line in startup?
If you don't receive any answer from the creator of Blackmamba, tell me, I could spend some time to search in his source code.

ihf

@cvp yes, the parameter was there (ToDo) and it correctly opens the outline, the error message goes away (as you know) but why does it come up?

Unrelated: I suppose this is an ios problem but if I leave outline.py running in the background, after awhile, when I go back, it restarts Pythonista. Is this due to ios not letting things run in the background for very long even when the script is doing nothing?

cvp

@ihf said:

yes, the parameter was there (ToDo) and it correctly opens the outline, the error message goes away (as you know) but why does it come up?

The error message appears because it warns you that YOU runs the script with an argument, thus asking to open a file. If this file does not exist, it's seems logic to tell you that you have an error.

cvp

@ihf said:

Unrelated: I suppose this is an ios problem but if I leave outline.py running in the background, after awhile, when I go back, it restarts Pythonista. Is this due to ios not letting things run in the background for very long even when the script is doing nothing?

Yes problem between iOS and Pythonista.

cvp

@ihf said:

One problem with using the Command key for the promote/demote is that if you hold Command too long the help menu comes up

blackmamba docs says "Just hold Cmd key and iOS will show you all available shortcuts if you can’t remember them." Thus, if it is iOS, no way to avoid it.

ihf

@cvp is it possible to use option or ctrl rather than command as a modifier?

cvp

@ihf said:

is it possible to use option or ctrl rather than command as a modifier?

I don't have any OPTION on my keyboard, but the docs says you can use as modifier
Control
Command
Alt
Shift

Give me your preferred combinations, I will test

NB I used Command because close to arrows

Edit : It seems that Option is Alt

cvp

@cvp said:

If the program gets a wider audience

Sincerely, I hope that will never occur. As much as i enjoy developing new features, I hate support.

ihf

@cvp I fully understand. I just thought that you might want to amortize your effort over a larger audience. In any case, I remain very appreciative of what you have done and I am using it. I am also quite amazed at what you have accomplished.

cvp

@ihf New V00.85 with

Version V00.85
  - added functionalities to Calendar event at due date
    - at start, program will check if Pythonista is authorized to access Calendars
      and there is a calendar named "Outline". If no, user will get an error message
      asking him to run Pythonista with argument "grant_access_to_calendar"
    - file save forced immediately after calendar event add/delete/update
    - add/delete/update an event will give a feedback: success or error
    - set an outline as complete removes the eventual associated event
    - unset a due date removes the associated event
    - change a due date updates the associated event (not delete + add)
    - allow create due date event even if date is already in the past

Finish for today. Tomorrow, I'll test if Ctrl, Alt, Shift as modifier of Left and Right work.

cvp

@ihf said:

I am also quite amazed at what you have accomplished.

Me too šŸ˜‚

ihf

@cvp should delete or update of events be working? I tried to unset a due date but the event was not deleted.

cvp

@ihf said:

should delete or update of events be working

That should. Did you get a popup hud_alert?
I've done several tests now, unset works. I got small errors when checking an outline (set as complete), more about the alerts themselves than on the event processing.
Try to reproduce your problems.

cvp

@ihf I'e also tested the modifiers SHIFT, ALTERNATE, CONTROL, they all work.
I'll foresee a new setting for dynamic selection in next version.

You should even been able to change your choice without restarting the program (tested).

ihf

@cvp I can set the due date and I get the calendar event but if I go back and do unset, nothing happens. No alert, nothing.

cvp

@ihf said:

I can set the due date and I get the calendar event but if I go back and do unset, nothing happens. No alert, nothing.

Strange, for me it works as it should. What is "I go back"?

ihf

@cvp I just meant that I set a date and then I checked to see it is in the calendar and then I go back to the outline, select the same outline item and touch unset date. Would you like a video?

ihf

@cvp actually there isn’t much that a video would add.

cvp

@ihf said:

I go back to the outline, select the same outline item and touch unset date

Try by restarting Pythonista and then unset, if the event exists

ihf

@cvp restarting Pythonista did not help

cvp

@ihf Try with V00.86 just to be sure we use The same version. You can see this version has also new functionality

Version V00.86
  - new setting for "external keyboard modifier"
    - 'no' if no external keyboard used
    - Alt or Cmd or Ctrl or Shift choice
    nb: in case of modification, the user is warned that he has to restart the 
        program
  - correction of bug "error when unsetting a due date created before events 
    process"
  - correction of bug "error 'NameError: name error is not defined' when removing
    not existing event"
  - correction of bug "when setting an outline as complete  (checkbox), an 'error'
    alert was displayed even if the event deletion has worked"
ihf

@cvp I now get alerts when setting and unsetting dates and events are added and deleted as expected.

cvp

@ihf perhaps I did a mix of versions...

Tell me also if use of external keyboard keys ok

ihf

@cvp I tested with external keyboard (Shift-RIght, Shift-Left), worked perfectly. Interesting that Black Mamba can’t use tab but it is not a big deal.

ihf

@cvp I just retested due date functionsand got this:
Traceback (most recent call last): File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 1539, in layout ws,hs = self.get_screen_size() File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 1531, in get_screen_size app = UIApplication.sharedApplication().keyWindow() File "/var/containers/Bundle/Application/8778D1CF-1C08-48BA-9714-9D2CFE524EA1/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 801, in __call__ ordered_args = list(args) + [kwargs[key] for key in kwarg_order] TypeError: 'builtin_function_or_method' object is not iterable

cvp

@ihf said:

I just retested due date functionsand got this:

Traceback (most recent call last):
File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 1539, in layout
ws,hs = self.get_screen_size()
File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 1531, in get_screen_size
app = UIApplication.sharedApplication().keyWindow()
File "/var/containers/Bundle/Application/8778D1CF-1C08-48BA-9714-9D2CFE524EA1/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 801, in call
ordered_args = list(args) + [kwargs[key] for key in kwarg_order]
TypeError: 'builtin_function_or_method' object is not iterable ```

Error that I get sometimes, never with the same case, disappears when you restart Pythonista.
Sorry, not at all in my hands, I think. Comes from keyboard appearing standard code.

cvp

@ihf said:

Interesting that Black Mamba can’t use tab but it is not a big deal.

Feel free to ask @zrzka if he could intercept Tab and Shift/Tab or why he can't.

ihf

@cvp wish list: cut/paste 1 or more outline items from one outline to another.

cvp

@ihf What I could program without too much difficulties would be:
- in file1
- tap an outline => popup menu
- new option 'cut one outline and its children'
- save in clipboard outline, text, infos about dates, image...
- same run or not
- in file 2
- tap an outline => popup menu
- new option 'paste'
- insert clipboard rows like I did for drop operation in move outlines

Of course, if you want to cut outline without children, or even several rows, we have to imagine a way to identify them

your opinion please?

ihf

@cvp I think it’s only worth doing if there is a way to select multiple portions of the outline. If that is complicated, it may not be worth the effort. If it’s only one line then it’s just as easy to copy and paste the text into another outline using the standard cut and paste.

cvp

@ihf said:

select multiple portions

I could do it (almost all šŸ˜‚) but how could we select the multiple lines? Did you think a manner?

For instance,
1. tap first line/popup/option cut-select first
2. tap last line/popup/option cut-select last

Or better, more complex to develop:
- tap first line to be cut, popup, select option cut
- program gives a rubber cursor, with extremity 1 fixed in first outline and you move the 2nd extremity unto the last line. When you raise the finger, cut process begins

Or
- tap first line to be cut, popup, select option cut
- script cleans all checkboxes, except this one of the first outline to be cut, with a red check
- you tap all lines needed to be cut
- and we imagine a way to terminate the selection to start cut process

ihf

@cvp I think the most common way is to have a select button and then allow touch of one or more items and then cut/copy followed by paste somewhere (could be in same outline or a different outline)

cvp

@ihf One question more. There is an option "delete outline with its children"

Quid for cut? If we cut a line, are its children also cut?

ihf

@cvp I’m thinking it would be desirable to be able to move child nodes without moving all children under a parent so I’m inclined to say permit selection of individual items. Does that make sense to you?

cvp

@ihf said:

Does that make sense to you?

Yes, but which will be the level of a child if its parent disappears?

ihf

@cvp good question. How about parents move with children but children can be moved without a parent?

cvp

@ihf seems good. I'll begin tomorrow but it is not a small functionality, thus patience

cvp

@ihf just to show how it will look (no action is yet programmed)

ihf

@cvp looks good! When does paste show up as an option?

cvp

@ihf said:

When does paste show up as an option?

  1. Not yet studied. I wonder if it would not be better to offer paste in the usual popup menu since you only have to select a single row for the paste action. Your opinion please?

  2. For each (un)selected outline, its eventual children will be automatically (un)selected. Do you agree?

  3. the selected lines must they not be contiguous?

  4. You said "move". Do you mean copy?

    How about parents move with children but children can be moved without a parent?

ihf

@cvp 1. Yes,that sounds right.
2. Yes
3.I was thinking that they did not need to be contiguous
4. I was thinking move but now that you mention it, it should probably be an option.

cvp

@ihf said:

I was thinking move but now that you mention it, it should probably be an option.

Not sure, I think we have enough with
1. Delete = delete without saving first in clipboard
2. Cut = delete but saving first in clipboard
3. Copy = saving in clipboard
4. Paste clipboard

Move = Cut followed by a Paste

cvp

@ihf said:

I was thinking that they did not need to be contiguous

Ok, we will try so

cvp

@ihf Another question: when we drag and drop, you can drop under an outline or under its text. When we paste, we will paste rows under the outline, that will say with same level. We could also paste as children of target outline. But how could we differentiate?

ihf

@cvp I was thinking that the lines to be moved would be placed in the 2nd outline at whatever point was selected and that the target outline would be renumbered to accommodate the pasted items. Am I forgetting something?

cvp

@ihf no, you right but pasted lines could be inserted after the selected row,
as same level or as child, like we can do with the drop if you drop under a row or at it right.
Ok, let us forget, you will test and give feedback when ready

cvp

@ihf New V00.87 with

Version V00.87
  - support delete/cut/copy/paste 
    - new button "select" in top menu
      - shield protecting top menu
      - redisplay all rows with selection button hiding checkbox
        and disabling hide-children-button/outline/text/image
      - display a popup menu with delete/cut/copy/cancel options
    - selection button filled in red if selected, yellow if unselected
    - for each (un)selected outline, children are automatically (un)selected
    - if copy/cut option, save selected lines in a file outline.clipboard
      - save level/outline/text/dates/font-attributes 
        but not eventual due date calendar event identifier and hidden flag
    - delete/cut process
    - add option paste in general popup menu of an outline
    - paste the content of the file outline.clipboard with automatic renumbering
      nb: the file is not removed and could be pasted several times
  - horizontal popup menu (only available on iPad) becomes an ui.ScrollView, 
    horizontally scrollable, so all options are reachable, even if in split view,
    or if too much options to be all visible

don't try to use undo anymore, it doesn't work at all and no idea why

Any negative or positive criticism is welcome

ihf

@cvp I tried to select a line (just touching the item’s level #) and got:

Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 234, in 'calling callback function'
  File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/gestures.py", line 402, in gestureAction
    handler_func(data)
  File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 3841, in long_press_handler
    found = self.found_redline
AttributeError: 'Outliner' object has no attribute 'found_redline'
cvp

@ihf said:

found = self.found_redline
AttributeError: 'Outliner' object has no attribute 'found_redline'

It seems to happen when you do a long press on an outline but without move

Nb: very old bug but will be corrected. Long press is for moving and you have tried to use it for selecting

DON't forget that you have a new button at right of undo to select.
And for pasting, a single tap on an outline is needed for its popup menu, not a long press

cvp

@ihf Questions:
There some ways to remove lines:
1. Delete with children in general popup menu
2. Delete selected lines
3. Cut selected lines

Do I need to program an automatic removal of their due date calendar events?

In the same way, if we paste lines which have a due date, doI need to program an automatic creation of their due date calendar events?

ihf

@cvp ideally, yes the due dates would go with the items and be changed to point to the correct outline. If that proves to be too troublesome then I would delete the due dates as part of the move and then I would have to add due dates back. Either that, or leave the due dates and they’ll just point to the wrong outline.

cvp

@ihf said:

delete the due dates as part of the move

I understand your sentence but you still have a problem with copy, not only move.

When you do a move, you do first a cut, and the program does not know if you really will do paste later, thus events would be removed.
But, imagine you do an undo after. I could reset the rows but events are no more there.
I can't do an undo of the events...

I let that in my todo but not for immediate development

There is also a problem if you rename a file. The events would also be updated, in their title and url

That becomes complex to manage

cvp

@ihf New V00.88 with

Version V00.88
  - correction of bug "short long press without moving the finger sometimes
    gives AttributeError: 'Outliner' object has no attribute 'found_redline'"

End for today

ihf

@cvp given the uncertainties of cut and not being able to paste, perhaps we should only do copy and then after it’s confirmed that the copy is done you manually go back and delete the rows that were copied?

ihf

@cvp I was trying to install outline on another iPad and I installed black Mamba:

import requests as r; exec(r.get('http://bit.ly/get-blackmamba').text)
Checking latest Black Mamba release...
Latest release 1.5.2 (2018-05-28) (tag v1.5.2) found
Checking Black Mamba installation...
Black Mamba 0.0.26 installed
Downloading ZIP...
Extracting ZIP archive...
Moving to site-packages-3 /private/var/mobile/Containers/Shared/AppGroup/10326461-C5EE-49C0-8E1C-369955119C79/Pythonista3/Documents/site-packages-3/blackmamba...
Saving installed version release info
Black Mamba 1.5.2 installed 

But now when I run the outline script, I get:

Traceback (most recent call last):
  File "/private/var/mobile/Containers/Shared/AppGroup/10326461-C5EE-49C0-8E1C-369955119C79/Pythonista3/Documents/outline.py", line 47, in <module>
    from   blackmamba.uikit.keyboard import (register_key_event_handler, UIEventKeyCode,           UIKeyModifier, unregister_key_event_handlers)
ModuleNotFoundError: No module named 'blackmamba.uikit.keyboard'; 'blackmamba.uikit' is not a package 

Where did I go wrong?

cvp

@ihf said:

uncertainties of cut and not being able to paste,

What problem did you have?

The clipboard is a file, thus we will not lose the cut part.

cvp

@ihf said:

ModuleNotFoundError: No module named 'blackmamba.uikit.keyboard'; 'blackmamba.uikit' is not a package

Did you restart Pythonista, always needed after installation in site-packages

And check you have the tree site-packages-3/blackmamba/uikit/keyboard.py

ihf

@cvp working again (probably neglected to restart) . Ignore that comment about paste being uncertain

cvp

@ihf said:

Ignore that comment about paste being uncertain

I like this kind of message šŸ˜‚

cvp

@ihf Some questions relative to possible improvements:
1. Do you want to see that a due date is already set, for instance by a clock in the checkbox?

  1. For the actions delete with children from general popup menu and delete/cut selected rows, do you want that I automatically delete the eventual calendar events, without feedback because could be several such rows?
  2. For paste operation, do you want I automatically create a calendar event for each row where due date exists, without feedback because could be several such rows?
  3. As outline of a row can vary frequently by renumbering when you promote/demote or add a row before, we could not store this outline in the event title, keeping only file name and text of the row?
  4. If you use a lot an external keyboard, are you interested to define keys combinations for more actions, like 'font attributes' or some options of popup menu?

I had promised to debug the undo process previous week, but I have been fully occupied by copy/paste and other things. Thus, I apologize and I'll try next week. Not this week-end because the week-end is fun only, thus only new functionalities šŸ˜€

ihf

@cvp I would say YES to all 5 of your questions. I obviously have to work harder to think of new features because you are coming up with great ideas faster than I am :-)

ihf

@cvp I was just typing into an outline and got this:
```
Traceback (most recent call last):
File "/var/containers/Bundle/Application/BD1F4CA5-69E3-4F62-BEFE-2AD2B2CD0813/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 869, in call
argtypes = kwargs['argtypes']
KeyError: 'argtypes'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/private/var/mobile/Containers/Shared/AppGroup/6CCAAFF1-947E-4DC8-B33B-58EE87A0823C/Pythonista3/Documents/outline.py", line 3686, in tableview_reload_one_row
self.tvo.reloadRowsAtIndexPaths_withRowAnimation_([nsindex], UITableViewRowAnimationNone)
File "/var/containers/Bundle/Application/BD1F4CA5-69E3-4F62-BEFE-2AD2B2CD0813/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 878, in call
args = tuple(_auto_wrap(a, argtype_encodings[i], argtypes[i+2]) for i, a in enumerate(args))
File "/var/containers/Bundle/Application/BD1F4CA5-69E3-4F62-BEFE-2AD2B2CD0813/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 878, in
args = tuple(_auto_wrap(a, argtype_encodings[i], argtypes[i+2]) for i, a in enumerate(args))
File "/var/containers/Bundle/Application/BD1F4CA5-69E3-4F62-BEFE-2AD2B2CD0813/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 695, in _auto_wrap
return ns(arg)
File "/var/containers/Bundle/Application/BD1F4CA5-69E3-4F62-BEFE-2AD2B2CD0813/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 1007, in ns
arr = NSMutableArray.array()
File "/var/containers/Bundle/Application/BD1F4CA5-69E3-4F62-BEFE-2AD2B2CD0813/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 727, in call
ordered_args = list(args) + [kwargs[key] for key in kwarg_order]
File "/var/containers/Bundle/Application/BD1F4CA5-69E3-4F62-BEFE-2AD2B2CD0813/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 727, in
ordered_args = list(args) + [kwargs[key] for key in kwarg_order]
TypeError: unhashable type: 'dict' ```

cvp

@ihf said:

I would say YES to all 5 of your questions

Ok, I know what I'll do next days.

cvp

@ihf said:

Traceback (most recent call last):
File "/var/containers/Bundle/Application/BD1F4CA5-69E3-4F62-BEFE-2AD2B2CD0813/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 869, in call
argtypes = kwargs['argtypes']
KeyError: 'argtypes'

I already got that too when I perform multiple runs without restarting Pythonista. I don't think the solution is in my hands if it is not reproducible on demand.

cvp

@ihf

If you use a lot an external keyboard, are you interested to define keys combinations for more actions, like 'font attributes' or some options of popup menu?

Up to you to define keys combinations and their actions. Or perhaps I could do that dynamically but it seems more complex

cvp

@ihf New V00.89 with

Version V00.89
  - identify outlines of which due date is set by a light green background
  - outline no more stored in calendar event title, only file name and text
  - delete eventual calendar event of all outlines deleted by 'delete with children'
  - delete eventual calendar event of all outlines deleted by 'delete/cut selected'
  - add eventual calendar event of all outlines added'by 'paste'
    nb: events are added/deleted without any feedback because could be multiple
  - correction of bug "error if action delete/cut/copy but no outline selected"
ihf

@cvp This has nothing to do with Outline and it may have been reported elsewhere but there appears to be a bug in Pythonista such that if you run Pythonista and leave it (but not kill it) and then try to run a script via the pythonista3:// URL, Pythonista will crash. I noticed this because I am using a trivial shortcut to select the outline I want to open and if Pythonista was used and exited, the shortcut opens Pythonista and it crashes immediately.

cvp

@ihf You know that the script became very long and I remark that I can't even run it twice anymore in the same Pythonista run, if I leave it for one minute. Memory problem?

JonB

@cvp
Is that self.tvo.reloadRowsAtIndexPaths_withRowAnimation_
method being called on the main thread? It probably needs to be.

Alternatively, you might try explicitly calling ns([nsindex) and setting to a variable, rather than letting auto_wrap handle it. I can't think why that would matter, but you might end up with a clearer stacktrace.

Also, it would let you wrap a try/except around the ns() itself, and print out nsindex in the cases where you get an error. Maybe nsindex is the wrong type, etc.

cvp

@JonB said:

reloadRowsAtIndexPaths

Code is

    def tableview_reload_one_row(self, row):
        self.cursor = (row,0) # not needed else if reload done
        #print('tableview_reload_one_row',row)
        NSIndexPath = ObjCClass("NSIndexPath")
        nsindex = NSIndexPath.indexPathForRow_inSection_(row,0)
        UITableViewRowAnimationNone = 5
        #self.tvo.beginUpdates()
        self.tvo.reloadRowsAtIndexPaths_withRowAnimation_([nsindex], UITableViewRowAnimationNone)
        #self.tvo.endUpdates()

method being called on the main thread?

It is not but I don't think it needs to be

And don't forget this problem does not occur frequently but only after we run the script several times in the same Pythonista run...

Anyway, I'll follow your advices:
- main thread
- try/except

For your info, if I force index to be bigger than table length, I don't have any Python error but an ObjectiveC crash with

The app was terminated due to an Objective-C exception. Details below:

2021-08-30 11:43:15.181473
attempt to delete row 100 from section 0 which only contains 39 rows before the update

Remark the word delete even if I don't access the TableView for deleting !?

cvp

@ihf No new version today, perhaps first time šŸ˜‚
Jus to show that I don't do nothing, busy to study external keyboard keys combinations
And I count on you to propose the choice of actions, even from top menu...I'll have to program each case but not a big effort (I hope)

ihf

@cvp this looks like a good list of actions. Are show children and hide children the same as the existing menu items show all and collapse all?

cvp

@ihf said:

Are show children and hide children the same as the existing menu items show all and collapse all?

No, they are the same as in the popup menu of a tapped outline.
BuT they are not yet programmed, they are there are examples. please choose which actions you would want to see there, from any pressed button or menu option chosen. And then I could say if they are possible to be simulated.

ihf

@cvp Show All and Collapse All would be useful keyboard shortcuts. I am using an external keyboard right now and will think about how often I use menu items that might be executed from the keyboard.

Wish list: searching across outlines.

ihf

@cvp Wish list (that probably is a non-starter): Ability to put an item (text snippet, URL, etc.) in an Outline via the Share sheet (perhaps done using a Shortcut). As I write this I realize that given Pythonista, one problem would be how long it would take to perform this action thus negating its value.

cvp

@ihf said:

Wish list: searching across outlines.

That exists: magnifying glass button

cvp

@ihf said:

that probably is a non-starter

I don't understand this expression

ihf

@cvp I know about the magnifying glass and that works well. However, the key word is ā€œacross outlinesā€. In other words, I was referring to the ability to search all outlines at once.
ā€œNon-starterā€ is an expression for something that can’t be done.

cvp

@ihf said:

ability to search all outlines at once.

Understood, sorry,sometimes outline is a file, sometimes it is a row....

Added in my todo list: your wishes become my todo

Thus:
- in the files menu, new option "search"
- TextField to enter the text
- scan all files of your current folder
- show a list of files containing text
- select a file and open

Confirm?

ihf

@cvp prƩcisement

cvp

@ihf šŸ˜€ So you are sure I could understand.

Seriously, I still have problems with my dynamic external keyboard keys code but after that, I'll program the search in files, always happy to postpone my debugging of the undo process.

cvp

@ihf said:

Ability to put an item (text snippet, URL, etc.) in an Outline via the Share sheet (perhaps done using a Shortcut). As I write this I realize that given Pythonista, one problem would be how long it would take to perform this action thus negating its value.

How did you imagine that? Assuming you have a shortcut with the outline program and file name, you still have to say where you want to paste the shared data

ihf

@cvp My thought was that the snippet would be appended to an outline (perhaps the snippets outline). From there you could use the script to move it within the outline or more likely to another outline.

cvp

@ihf said:

perhaps the snippets outline

I don't understand, sincerely sorry

ihf

@cvp my idea, perhaps not fully thought through, is that you would use the share sheet to add a text or other snippet to an outline. You asked where that would go and I don’t have a better idea than to have a specific outline which we could call ā€œsnippetsā€ (or anything) to which it would be appended.

cvp

@ihf said:

my idea, perhaps not fully thought through, is that you would use the share sheet to add a text or other snippet to an outline. You asked where that would go and I don’t have a better idea than to have a specific outline which we could call ā€œsnippetsā€ (or anything) to which it would be appended.

Why not share to "copy" and paste it normally in your outline?

cvp

@ihf said:

add a text or other snippet to an outline.

In this case, outline is a file or a line of a file?

specific outline which we could call ā€œsnippetsā€

In this case, outline is a file or a line of a file?

cvp

@ihf New V00.90 with

Version V00.90
  - support parametrization of supported keys combinations of external keyboard
    - use keyboard button in settings window
    - gray actions have a configured keys combination
    - swipe left an action and confirm 'disable' to remove it from configured
      combinations
    - associating the same combination for two actions is not allowed,
      when you try, the selected modifier/key will blink before to be unselected
    - supported actions (until now):
      - promote (cursor has to be on a text)
      - demote (cursor has to be on a text)
      - font attributes (cursor has to be on a text)    
      - set due date (cursor has to be on a text)
      - collapse all
      - expand all


.

ihf

@cvp of course, you are absolutely right and you can use copy and paste in lieu of the share sheet. The difference is whether you stay in the application that has the text or image rather than doing a copy and going to Pythonista, starting the script and adding it to a particular outline.

cvp

@ihf you can copy in an app and paste in Pythonista, they share the same clipboard.

You said:

add a text or other snippet to an outline.

In this case, outline is a file or a line of a file?

You said:

specific outline which we could call ā€œsnippetsā€

In this case, outline is a file or a line of a file?

ihf

@cvp Let me try again. I was thinking that if one wanted to add a line (an item) to an outline, you could select something in any app and go to the share sheet, select (let's call it) the Outline option (which might be a Shortcut) and this would add the item to a Pythonista outline file. The only difference between this and using copy/paste is that you don't explicitly start the Pythonista app, select the outline script, select the desired outline, and paste the copy there. In the end it may not be much of a savings.

cvp

@ihf said:

I was thinking that if one wanted to add a line (an item) to an outline, you could select something in any app and go to the share sheet, select (let's call it) the Outline option (which might be a Shortcut) and this would add the item to a Pythonista outline file. The only difference between this and using copy/paste is that you don't explicitly start the Pythonista app, select the outline script, select the desired outline, and paste the copy there

First of all, thanks for your patience.

As you know, to share directly to Outline.py should be impossible because the script is too big to run in appex mode. Thus, as you propose, you could share a text from another app to a shortcut of which actions would be:
- get the shared text
- put it in the clipboard
- run Pythonista script with a specific outline file as argument 1 and a flag "use clipboard" as argument 2 ( or argument 2 could be the text it-self, but don't forget you also asked in the past that argument 2 could be a path where to find the argument 1 file in another path than the current. This request is still in my long todo list).

The outline script could:
- identify it is run with argument 2 "use clipboard"
- get text from clipboard
- add this text as new line at end of file of argument 1
- or you could use the standard paste when editing any line in any file, not only the last line in a fixed file.

Of course, if you always want to add the text at the end of the file, and you don't want to edit the file just after, I could write a little script to perform this little process in appex mode. And you could share directly (without passing via a shortcut) to it if you add it in the share list of Pythonista
I could even foresee that you use outline.py it-self as script to get shared text, without defining by advance which file to open, to avoid a lot of configured entries, and display a list of all outlines where you select the file that you want to append

I wait for your decision on what solution you prefer

ihf

@cvp Given the time it takes to start Pythonista and the script (not to mention the frequency of Pythonista crashes), I think your idea of having a simple script that only adds the item to an outline which is then edited later using Outline is fine. Typically all I want to do is to store the clip so I don't forget it. I can of course do this now with several other notebook apps but then I still have the step of getting the items into Outline. Having a (relatively) fast way of getting the item into Outline is a good compromise.

cvp

@ihf said:

Given the time it takes to start Pythonista and the script

Not in appex mode...because even if I use the view class, I do not present it. But use it allows to access to its methods

script that only adds the item to an outline

Do you prefer to pass the outline file name as argument or to choose the outline in a list?

cvp

@ihf New V00.91 with

  - support run in appex mode as share of text to add at end of an outline
    1st argument needs to be an outline file
  - support search files containing specified text
    - new button in Files menu
    - entering text
    - search files containing text in current path
    - shows a list of files
    - open selected file
  - correction of bug "keyboard icon was erroneously forced as a square"
  - correction of bug "setting '1st level has outline' switch did not work on iPad"

I finally decided to use original Pythonista to process the share. It runs in a fraction of second as well as Pythonista is running or not.

I hope feedback for both new functionalities.
Advice: for testing share, take a backup of the outline file you want to append to.šŸ˜…

You have to configure a Pythonista running share for each file you want to append.
Or, I could change to show a list of outlines files where you would have to select one to append.


.

.

.

.

ihf

@cvp I just tried the news file search. It worked fine. After selecting the file, might be nice to have it do the search within the file as if you had used the magnifying glass on the open file. Also, I notice that the te t box for the magnifying glass search (not the new file search) is cutoff at the top by the menu bar (on iPad in Landscape mode).
Will now test the new Share extension.

ihf

@cvp I hope I did this correctly. I created the Shortcut within Pythonista to save to ToDo, selected some text in Safari, hit share, Run Pythonista Script, selected the new Shortcut, and nothing seemed to happen (confirmed when I looked at the outline). Did it several more times after restartingg Pythonista (just in case). Now I am getting:
Traceback (most recent call last): File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 5940, in <module> main() File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 5878, in main os.remove(path + file) TypeError: remove() takes at most 0 arguments (1 given

ihf

@cvp Also, it would seem that if Pythonista is running but no script is running, if I try to do a Share, I get the error that it cannot perform the action because a script is already running. Not terrible, but not what you would like to happen.

cvp

@ihf said:

nothing seemed to happen

Normal, only an hud_alert of 3 seconds should appear "text pasted in ..."

cvp

@ihf said:

Also, it would seem that if Pythonista is running but no script is running, if I try to do a Share, I get the error that it cannot perform the action because a script is already running. Not terrible, but not what you would like to happen.

That should work even Pythonista is running but if your appex is not finished (not normal) and you retry, you could have this message: only one appex run at the time

cvp

@ihf said:

Now I am getting:

Traceback (most recent call last):
File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 5940, in
main()
File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 5878, in main
os.remove(path + file)
TypeError: remove() takes at most 0 arguments (1 given ```

I think it is one more time a crash of Pythonista when we run several times a script.

remove() takes at most 0 arguments Is not normal

cvp

@ihf could you retest without Pythonista running and check if you have the hud_alert

I don't have any problem and the file is updated, and Pythonista was running but no script

ihf

@cvp that was interesting. Right after I got your latest post, I tried again without Pythonista running (was sure I did that before) and got the HUD alert! However, when I then went into Pythonista, I tried to open the file that I was appending, I see 3 files with that name (differing timestamps) and opening any of them now gives:

Traceback (most recent call last): File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 3710, in tableview_cell_for_row v = MyInputAccessoryView(row) File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 1075, in __init__ self.width = mv.get_screen_size()[0] # width of keyboard = screen File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 1708, in get_screen_size for window in UIApplication.sharedApplication().windows(): File "/var/containers/Bundle/Application/8778D1CF-1C08-48BA-9714-9D2CFE524EA1/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 801, in __call__ ordered_args = list(args) + [kwargs[key] for key in kwarg_order] TypeError: 'int' object is not iterable

cvp

@ihf as you can see, it is one more time a not understandable message of Pythonista crash in standard code. Was outline script running while your tests? Perhaps cross of files.
If you save the file just after the share, you could override the append.

ihf

@cvp Now I went back to try again, and I can open any of the 3 files and each one has the appended text (1, 2 or 3 times). It is as if I had to wait (perhaps an iCloud issue) and then I have 3 copies, each with one or more of my Shared texts.

cvp

@ihf said:

perhaps an iCloud issue)

My tests are local...

cvp

@ihf The appex mode opens the latest version if multiple exist, append the shared text and creates a new file as usual to avoid old problems and remove this one I had open.
But of course, if any crash during process or iCloud problems.....

These iCloud problems are annoying... what to do?

ihf

@cvp I tried again to run the extension and again (without Pythonista running) it says cannot run because script is running. I did it after killing the app from which I was doing the Share and tried again. This time the HUD alert came out after about 5-7 second. When I went to open the file in Outline script, I got the "int" object is not iterable.

ihf

@cvp If I open the file in Xcode on my Mac, I can see that the latest append was done.

cvp

@ihf I can't do anything about the message of "already running", the shared script is not finished, perhaps due to writing in an iCloud file

cvp

@ihf If the problem can't be solved and you want to run full outline after the share, why don't you copy the text in your other app and paste it in Pythonista run?

ihf

@cvp I understand, I will just be patient. However, now I restarted Pythonista and the Outline script and any file I try to open is giving that error. After waiting a few minutes and doing it again, the error has gone away and I can open my outlines, including the one to which I used the share extension to append. Since the script isn't changing or presumably maintaining state, I can only assume that this is somehow related to using iCloud. I wouldn't use it but for the fact that I tend to use the iPad and iPhone with this script. Maybe just waiting is the answer for now.

cvp

@ihf said:

After selecting the file, might be nice to have it do the search within the file as if you had used the magnifying glass on the open file

Tomorrow

cvp

@ihf New V00.92 with

Version V00.92
  - in appex mode, after saving the appended file, save its new name in 
    outline.prm so when running outline, we will get the new file as last one
  - correction of bug "the box for the magnifying glass search is cutoff at the top
    by the menu bar (on iPad in Landscape mode)"
ihf

@cvp I did a Share of some text and got:

Traceback (most recent call last):
  File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 5935, in <module>
    main()
  File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 5867, in main
    fil.write(t)    
UnicodeEncodeError: 'ascii' codec can't encode characters in position 2044-2045: ordinal not in range(128)
Traceback (most recent call last):
  File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 1698, in init2
    self.button_files_action('Open')
  File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 2559, in button_files_action
    self.files_action(sender, act)
  File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 2633, in files_action
    self.pick_open_callback(None)       
  File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 3050, in pick_open_callback
    prms = c_prms[1]
IndexError: list index out of range 

Also, should the share accept URLs or images?

cvp

@ihf Concerning list of files containing searched text, I need to have the list of outlines, and the only ways is a listdir but it only returns the locally downloaded files. Thus you can miss those who are not downloaded.

cvp

@ihf said:

UnicodeEncodeError

Did you paste special characters, like emoji?

ihf

@cvp I presume there is no way for the script to download and undownloaded files when it starts?

ihf

@cvp the first time I did the share and got that error, I wa copying an equation and I figured that might be a problem. Then I tried again with text and got it again. I’ll try again..perhaps some state was preserved?

cvp

@ihf it could perhaps if their full names were all known

cvp

@ihf said:

equation and I figured that might be a problem.

Sure. Perhaps I could support it but needs to be studied

ihf

@cvp I just killed Pythonista and tried a share of text again and got the same error.

cvp

@ihf said:

got the same error.

Don't try more. Post The equation please
But end for me today

cvp

@ihf said:

UnicodeEncodeError: 'ascii' codec can't encode characters in position 2044-2045: ordinal not in range(128)
Traceback (most recent call last):
File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 1698, in init2
self.button_files_action('Open')
File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 2559, in button_files_action
self.files_action(sender, act)
File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 2633, in files_action
self.pick_open_callback(None)
File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 3050, in pick_open_callback
prms = c_prms[1]
IndexError: list index out of range

It is not an error during the share, you did open the file in normal outline run?

ihf

@cvp There was another Todo outline file (different timestamp) with 0 length. I deleted it and tried again and the Share worked fine.

ihf

@cvp Here is the equation: š‘ŽĖ™2š‘Ž2=8šœ‹šŗšœŒ3
It does not render correctly in the forum.

ihf

@cvp Tried again and got the "list index out of range". The 0 length file is created and that causes the error until it is deleted.

ihf

@cvp If I try to Share a URL as a URL, it gives an error about there being no text, however; I can Share the URL as text (by highlighting it rather than just long pressing) and then it pastes as an active URL. Being able to paste the URL (or an image ) would be handy.

cvp

@ihf About special characters, they are actually not supported: during the writing, the error occurs but the file is already created, thus length 0, thus error when reading it.

Your wishes become more and more complex

Todo:
- automatic text search in selected file after files search
- paste shared url
- support special characters
- paste a shared image but that needs to download the file and save it locally as other images

cvp

@ihf New V00.93 with

Read carefully limitations about special characters and shared images

Version V00.93
  - support shared url 
  - support special characters
    nb: if characters still generate an error, they are automatically replaced
        by correct ones, using errors="surrogateescape" in open (see Python doc)
  - support shared image
    nb: - image added as medium, left
        - image stored as IMG_paste_yyyymmdd_hhmmss.JPG in current path
        - tested with photo shared (program receives an image)
        - safari shares images via their url, not the image it-self
        - if url ends with .jpg, .jpeg, program downloads the file and
          process as a shared image

we will soon be celebrating the 6000th line of the script

ihf

@cvp Wow! Do you sleep? I will test the new features in v0.93. I am seeing this warning message when the script starts:
/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.26.4) or chardet (3.0.4) doesn't match a supported version! RequestsDependencyWarning)

cvp

@ihf never seen that, tried after Pythonista restart?
New imported module =requests which needs urllib3 and chardet

ihf

@cvp I can't seem to reproduce that error so I'll let you know if it returns.

cvp

@ihf New V00.94 with

Version V00.94
  - if shared url contains "?", take only in account the part before this "?"
    to check if the url points to an image (http://.......xx.jpg?xxxxxx)

End for today, and full busy tomorrow

ihf

@cvp I guess that error is repeatable. Perhaps I need to upgrade one of those modules?

ihf

@cvp is it possible for the Shared image file to be a .png as well as .jpg?

cvp

@ihf said:

Perhaps I need to upgrade one of those modules?

I see in the warning message that the requests module resides in your site-packages.

Documents/site-packages/requests/__init__.py:91: RequestsDependencyWarning

In my Pythonista, I don't have any requests module in my site-packages, thus the script uses standard Pythonista module.
I don't know why you had installed another requests module, try to rename or remove it, and restart Pythonista.

cvp

@ihf New V00.95 with

Version V00.95
  - support shared .png, .heic images
  - when searching files containing a text, selecting a file will simulate
    that user has used the magnifying glass to search the text in the open file
ihf

@cvp I think that deleting the site-packages version of requests solved the problem. Unrelated to Outline: do you have a way of keeping your Pythonista files in sync between ios devices? I have a quite old script that depends on Dropbox and it is rather unreliable. I just wondered if there is a better way now that I am testing with 3 devices.

cvp

@ihf said:

do you have a way of keeping your Pythonista files in sync between ios devices

I use iCloud but I always check in Files if last version of a file has been downloaded.
But I always use my iPad only for Pythonista. I use very rarely my iPhone.
Even with the standard Apple app Numbers, I already have had synchronization problems where the app asked me to choose between two versions of the file I wanted to open

cvp

@ihf two questions:
1) are you missing the undo / redo?
2) are there any bugs or limitations that prevent good use?

ihf

@cvp yes, I occasionally miss undo/redo.
As far as usability goes the most annoying thing (over which you presumably have no control) is how long it takes to start an outline. This is undoubtedly a function of the speed of Pythonista on each platform. It is obvious that it is much faster on my recent iPad Pro vs. my other iPad or my iPhone. As compared with my old notebook/outline app I miss not having the same functionality on the Mac. I don’t know if Pythonista will run on M1 Macs (I don’t have one) so perhaps that’s a way of getting it on the Mac. I wish that I knew Swift programming because you have created a wonderful app that could run well on all iOS and Mac devices if it were translated to Swift. Not withstanding its start up speed, outline is a feature rich and highly useful program. If it were not tied to Pythonista, I think you would have a salable product (I know, I know, you don’t really want to support a product). I think this thread is already one of the longest and most viewed threads on this forum. I hope that others have benefited from it as well.

ihf

@cvp The other problem is that I am getting an inordinate number of Pythonista crashes. I just had a few in a row even after restarting Pythonista. I wasn’t doing anything special other than hitting return or entering a character and all of a sudden it crashed.

cvp

@ihf said:

even after restarting Pythonista.

I get the same crashes. I can't anymore run the script twice in a Pythonista run. And I advice to wait some seconds before restarting Pythonista, it seems to still use some memory. Even if I even don't type any character. The program does not use a lot of memory with a short outline, less than some images, thus I don't understand why

cvp

@ihf said:

I occasionally miss undo/redo.

I have problems with the principle of undo. Assume you set a due date, thus create an event. If you want to undo, the program would have to remove the calendar event also. And if you ask a redo.....recreate the event...

ihf

@cvp On the one hand Pythonista (as you have shown) is a wonderful platform for creating UI rich Python scripts. On the other hand, it is not being supported and is probably a less than ideal place to run "production" programs. I imagine that Swift has reliable libraries that can duplicate those found in Pythonista but someone who knows Swift well would have to do the "translation" from Outline.py. In the meantime, I continue to use it (in production :-)

cvp

@ihf said:

I continue to use it (in production :-)

You say in production, is that for the fun, not for your job?

cvp

@ihf said:

I don’t know if Pythonista will run on M1 Macs

I think that @ccc said it runs

ccc

Pythonista will run on M1 Macs

It does!

ihf

@cvp Not for my job, for personal use. Good to know Pythonista will run on M1 Macs. Now if only @omz would reappear or make Pythonista Open Source.

cvp

@ihf New V00.96 with

Version V00.96
  - deactivation of the whole undo/redo process for testing if it could be 
    the origin of crashes 
    nb: it could not be a vital functionality as it did not work correctly

tell me if you felt any improvement

ihf

@cvp I just downloaded v0.96 ran it and got:

Traceback (most recent call last):
  File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 905, in <module>
    PY3 = sys.version_info[0] >= 3
NameError: name 'sys' is not defined 

Restarting Pythonista did not help.
P.S. I knew that undo/redo was not working so I stopped testing it as I figured it was on your list.

cvp

@ihf sorry For that, I replaced a lot of import xxx into from xxx import yyy, and I forgot this one

New V00.97 with

Version V00.97
  - correction of bug "PY3 = sys.version_info[0] >= 3 NameError: name 'sys'
    is not defined"
cvp

@ihf could you tell me if you have still crashes during a run of the script,

If you process so:
- remove Pythonista
- wait 10 seconds
- restart Pythonista
- run the script

Other question : do you have Pyto, it is open source. I dare not estimate the number of days needed to convert outline.py to Pyto because its ui and its editor are a lot less rich, assuming that all features are supported. But, at least, Pyto it-self is supported and you get updates frequently. I'm always surprised by what a person alone can realize. Even if Pyto is still far from Pythonista, it is obviously a marvelous app for an unique developer.

ihf

@cvp yes, I have Pyto.
I just started outline on my iphone ( I was using it on my iPad yesterday). It crashed Pythonista so I followed the steps you listed and it crashed again. I also tried starting it using pythonista3:// but after I start the script Pythonista crashes. What to do?

cvp

@ihf could you try to get the crash reasons? In fault_log folder or _obj_exception.txt file, both in root

Faultlog, see @dgelessus 's code

For me, crashes have always the same reason "segmentation fault" without any traceback. No way to identify the origin, sorry for you.

Pyto and future Swift Playground 4 would allow to develop an app on iPad...

JonB

@cvp, how repeatable is the crash?

You could consider adding some logging calls to write trace info to a file. Or could use the trace module to for instance log all function calls, then eventually narrow to all lines within a single function.

Have you watched memory at all? For instance, the issue with processing lots of images without doing NSAutoreleasePool. If there is a leak somewhere, it will eventually crash without warning.
Or, maybe if you are opening lots of file handles without closing.

ihf

@cvp @JonB It was completely repeatable but I then decided to try to run a completely different script which ran fine and then I went back to running outline and it ran. If this happens again, I will try to get some better debugging information.

cvp

@JonB said:

Have you watched memory at all? For instance, the issue with processing lots of images without doing NSAutoreleasePool. If there is a leak somewhere, it will eventually crash without warning.
Or, maybe if you are opening lots of file handles without closing.

No memory used, it occurs even with a data file of some bytes.
Script uses maximum files, all using "with open(...)"
It occurs even without images, and anyway, I use sometimes maximum 3 images

cvp

@ihf said:

run a completely different script which ran fine and then I went back to running outline and it ran

Strange...very difficult to identify if depends on what we did before 😰

cvp

@JonB said:

You could consider adding some logging calls to write trace info to a file

Following your advice, I've modified my script to write (without buffering) in a outline.trace file all called functions (mine).
I wanted to write inspect.stack()[1][3] but sometimes I got some index errors, thus I tried str(inspect.stack()) and seeing it contains .........function='name', I extract this name and logs it.

You will laugh but as soon I did (only) that, I don't have any crash more. Wait and see

cvp

@ihf New v00.98 with

Version V00.98
  - trace each called function in outline.trace, without buffering

Thus, if you geT a crash, try to describe your scenario and post the outline.trace file, if possible in GitHub, as this file could be very big, else if you crash at begin.

cvp

@ihf It is a long time since we last had a dialogue here.
Some questions I would like you to answer very sincerely:
1. Are you still using my program?
2. If so, would you be (sincerely, I insist) interested in running it under Pyto? Becuse you would prefer an open source app (even if I don't see who would continue to modify it)
3. The conversion to Pyto seems to me an enormous work which would certainly meet impassable walls, therefore which will take months, but which I would accept to carry out for the challenge.

cvp

@ihf As an example, I spent a lot of hours to make my very little module SetTextFieldPas running in Pyto because a lot of functionalities do not exist or differently, mainly ObjectiveC used in this module. If you see the image below, don't believe some code is associated to all these buttons. Nothing is programmed except the buttons themselves.
It was only to find a coherent SF Symbol because obviously Pythonista internal icons are not available.

ihf

@cvp In answer to your first question, I use the app every day! The problems I was having with Pythonista crashing frequently, especially at start up of Outline, have abated. I found that if Pythonista crashed when I started outline, then if I restarted Pythonista and first ran another script, then outline would start without a problem. I don’t understand why this works but it does.
Your second question is harder to answer. On the one hand having outline run in an environment that is supported (even if that means by an open source community) is an advantage. I only use Pyto occasionally and I have no idea how responsive the open source Community is to maintaining it but at least it is possible. I wish that @omz would either reappear or make his code open source but I am not counting on either happening. It would be a shame if Pythonista stopped working under a future release of iOS but that is a possibility. You have put in a tremendous amount of work to create what I view as an extraordinarily useful app. If you are up for the challenge of moving it to Pyto, I am certainly happy to help test it. In the meantime, rest assured that I’ll continue to use the app and I remain in awe of both your willingness to do this and your skill.

ihf

@cvp I would add that if you were up for an even bigger challenge, converting to Swift, would probably be the best course for the app. Of course, that still begs the question of support for the app (not the platform).

cvp

@ihf I agree with all you said (except when you are too kind about me). I could convert to Pyto (obviously with some limitations, and in a period of 2 months) and I wish I could convert in Swift but I think I'm too old to learn this language from scratch 😢

I'm so sad that Pythonista crashes so. Did you test with the V00.98 and did the crash provide a .trace file allowing to hope to identify the crash reason.

ihf

@cvp I may have spoken a bit too soon. As you know I use outline on several devices. I just try to use it on my iPhone and when I started the outline (not when I started pythonista), pythonista crashed. I realized that I am running version 0.97 on this iPhone so I just downloaded version 0.99. There is an error regarding the directories outline.
versions.

cvp

@ihf yes sorry, I have modified the program to store versions description outside of the code, to win memory, and I did not yet document it here.
Thus you have to download also the outline.versions file from GitHub to the same directory as the .py

New V00.99 and outline.versions with

Version V00.99
  - move versions descriptions from script to outline.versions file
ihf

@cvp I posted the outline.trace after outline crashed at startup (twice) as an issue on github (in cvpe). This is on the iPhone.

cvp

@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.

ihf

@cvp thanks. I will certainly continue to use the script. Have a great weekend!

JonB

@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

cvp

@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[1])
        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[0] and len(self.undo_multiples) > 0:
            if self.undo_multiples[-1][0] 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[1]
                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)
cvp

@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
cvp

@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
cvp

@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.

ihf

@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?

cvp

@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

cvp

@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.

List is

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
ihf

@cvp The menu that permits setting bold, italic, etc. is no longer coming up.

cvp

@ihf said:

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

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

@JonB sorry, never seen this post. I'm in holidays for some days. i'll answer this weekend

cvp

@JonB said:

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.

ihf

@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?

cvp

@ihf said:

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

cvp

@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.

ihf

@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

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?

ccc

CONTINUED AT https://forum.omz-software.com/topic/7248/outliner-with-drag-drop-reordering-part-2 ...