omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Outliner with drag/drop reordering

    Pythonista
    10
    1003
    840162
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • cvp
      cvp @JonB last edited by 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

      1 Reply Last reply Reply Quote 0
      • cvp
        cvp @ihf last edited by

        @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.

        1 Reply Last reply Reply Quote 0
        • cvp
          cvp @ihf last edited by

          @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.
          1 Reply Last reply Reply Quote 0
          • cvp
            cvp @ihf last edited by 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.

            1 Reply Last reply Reply Quote 0
            • ihf
              ihf last edited by

              @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.

              1 Reply Last reply Reply Quote 0
              • ihf
                ihf last edited by

                @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 1 Reply Last reply Reply Quote 0
                • cvp
                  cvp @ihf last edited by 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.

                  1 Reply Last reply Reply Quote 0
                  • ihf
                    ihf last edited by

                    @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 1 Reply Last reply Reply Quote 0
                    • cvp
                      cvp @ihf last edited by 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
                      
                      1 Reply Last reply Reply Quote 0
                      • ihf
                        ihf last edited by

                        @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 1 Reply Last reply Reply Quote 0
                        • cvp
                          cvp @ihf last edited by 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.

                          1 Reply Last reply Reply Quote 0
                          • ihf
                            ihf last edited by

                            @cvp thanks. I will certainly continue to use the script. Have a great weekend!

                            cvp 3 Replies Last reply Reply Quote 0
                            • JonB
                              JonB last edited by

                              @cvp Are you logging function enter AND exit? What could have happened is set_content_inset was the last method called, but then whatever the calling function was failed

                              cvp 1 Reply Last reply Reply Quote 0
                              • cvp
                                cvp @JonB last edited by 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)
                                
                                1 Reply Last reply Reply Quote 0
                                • cvp
                                  cvp @ihf last edited by 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
                                  
                                  1 Reply Last reply Reply Quote 0
                                  • cvp
                                    cvp @ihf last edited by

                                    @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
                                    
                                    1 Reply Last reply Reply Quote 0
                                    • cvp
                                      cvp @ihf last edited by

                                      @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.

                                      1 Reply Last reply Reply Quote 0
                                      • ihf
                                        ihf last edited by

                                        @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 1 Reply Last reply Reply Quote 0
                                        • cvp
                                          cvp @ihf last edited by 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

                                          1 Reply Last reply Reply Quote 0
                                          • cvp
                                            cvp last edited by 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
                                            
                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Powered by NodeBB Forums | Contributors