omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. superrune

    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.


    • Profile
    • Following 0
    • Followers 0
    • Topics 6
    • Posts 22
    • Best 2
    • Controversial 0
    • Groups 0

    superrune

    @superrune

    2
    Reputation
    948
    Profile views
    22
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    superrune Unfollow Follow

    Best posts made by superrune

    • Can’t get present full screen to work in the latest beta

      Hi!

      It seems like the command ui.present(style = 'full_screen') no longer gives a full screen view but rather a windowed view in the updated Pythonista. Anyone else seen this? Is this a bug or new behaviour?

      posted in Pythonista
      superrune
      superrune
    • Pythonista app saving to iOS 11 Files?

      Hi! Pardon me if this has been asked, I could not find it in the search.

      I have made a drawing app that is working quite well. One thing I have not solved is the loading and saving of images, and instead of loading and saving from Camera Roll, I thought it would be better to save them to iCloud or Dropbox. Can Pythonista open a file requester to let the user save to the new Files system in iOS 11?

      posted in Pythonista
      superrune
      superrune

    Latest posts made by superrune

    • RE: Pythonista 3 3.4 (340006) beta: Paramiko exception about PY_SSIZE_T_CLEAN macro

      @JonB Thanks for replying. I am not that experienced in Python, so half of the release notes are cryptic to me 🙂 I see the notes mention saving to jpeg has issues, but my code does png. I guess it goes for the same?

      posted in Pythonista
      superrune
      superrune
    • RE: Pythonista 3 3.4 (340006) beta: Paramiko exception about PY_SSIZE_T_CLEAN macro

      I have the same issue with one of my scripts. This is the code that is causing the error:

      def pil_to_ui(img):
      	with BytesIO() as bIO:
      		img.save(bIO, 'png')
      		return ui.Image.from_data(bIO.getvalue())
      

      The last line seem to be the one triggering the error message.

      posted in Pythonista
      superrune
      superrune
    • Palm rejection in Pythonista?

      Hi!

      I have done a pixel art app with Pythonista. Everything is working as it should, and the painting experience is great through Python. But I wish the app had palm rejection when I used my Apple Pencil. Does anyone know if that is possible with Pythonista?

      posted in Pythonista
      superrune
      superrune
    • RE: Can’t get present full screen to work in the latest beta

      Relieved it was such a simple fix. Thanks!!

      posted in Pythonista
      superrune
      superrune
    • Can’t get present full screen to work in the latest beta

      Hi!

      It seems like the command ui.present(style = 'full_screen') no longer gives a full screen view but rather a windowed view in the updated Pythonista. Anyone else seen this? Is this a bug or new behaviour?

      posted in Pythonista
      superrune
      superrune
    • RE: Finding a more elegant way of communicating between views

      Thanks @cvp! This is great!

      posted in Pythonista
      superrune
      superrune
    • RE: Finding a more elegant way of communicating between views

      Cool, saw your answer now!! I keep replying to fast :)

      posted in Pythonista
      superrune
      superrune
    • RE: Finding a more elegant way of communicating between views

      Cool, now most of the script seems to work as it should. Thanks again!

      I changed the text assignment to this, and now it appears where I intended:

              # Sends the selected image to the pixel Editor
              self.superview['File Label'].text = selectedFile 
      

      filePreview should exist though, should it not? I created it as an imageview a couple lines up, so is should be within the scope of the file window. Looks more like the function isnt called at all when I press the different table lines.

      Here is how it looks right now:

      import ui
      from glob import glob
      from os.path import basename
      
      class fileWindow(ui.View):
          def __init__(self):
              self.frame=(100, 150, 300, 300)
              self.name = 'File window'
              self.border_width = 2
              print ('Loader superview at init:', self.superview)
              
              imagefiles = [basename(x) for x in glob('*.*')]
      
              
              filelistData = ui.ListDataSource(imagefiles)
              filelistData.delete_enabled=False
              
              filelist = ui.TableView(frame=(10, 10 ,150, 280), data_source=filelistData, name='filelist')
              filelist.row_height = 24
              filelist.action = self.fileSelected # This does not work...
              self.add_subview(filelist)
              
              filePreview = ui.ImageView(frame=(170,10,120,100))
              filePreview.background_color = 'black'
              self.add_subview(filePreview)
              
              loadButton = ui.Button(name='Load', frame=(170,120,64,32), title='Load')
              loadButton.background_color = 'white'
              loadButton.action = self.loadAction
              self.add_subview(loadButton)
              
              ui.delay(self.x,0.01)
              
          def x(self):
              print ('Loader superview type = ', type(self.superview))
              
          def loadAction(self,sender):
              selectedFile = self['filelist'].data_source.items[self['filelist'].selected_row[1]]
              print ('Selected ' + selectedFile + ' from sender: ' + sender.name)
              # Sends the selected image to the pixel Editor
              self.superview['File Label'].text = selectedFile
              
          def fileSelected(self,sender):
              # This does not work..
              print('Gonk!!')
              filePreview.background_color = 'red'
              
      class pixelEditor(ui.View): 
          def __init__(self, width=640, height=480):
              self.bg_color = 'grey'
                  
              fileButton = ui.Button(name='File', frame=(10,80,64,32), title='File:')
              fileButton.background_color = 'white'
              fileButton.action = self.openFileWindow
              self.add_subview(fileButton)
              
              fileLabel = ui.Label(frame=(100, 80, 300, 32), font=('HelveticaNeue-Light', 32), text='___')
              fileLabel.name = 'File Label'
              self.add_subview(fileLabel)
              
              print(self.superview)
              
          def openFileWindow(self, sender):
              fv = fileWindow()
              self.add_subview(fv)
              #fv.present()
              print('File window opened.')
          
      
      v = pixelEditor()
      v.present('fullscreen')
      
      posted in Pythonista
      superrune
      superrune
    • RE: Finding a more elegant way of communicating between views

      @cvp said:

      print ('Loader superview type = ', type(self.superview))

      Thanks,

      I still have to do a fv.present() inside the openFileWindow function, right? The window will not show up otherwise...

      print ('Loader superview type = ', type(self.superview)) now returns a NoneType, though.

      I still want to put the selected file name into fileLabel.text - how would you go about doing that?

      posted in Pythonista
      superrune
      superrune
    • RE: Finding a more elegant way of communicating between views

      Thanks, that also worked. I had the sub-window opening OK a couple steps back as well. But the next problem still remains, though, even in this version.

      I do a print ('Loader superview:', self.superview) when I init the fileWindow, to see that there is a parent view I can put the selected file into, but that still returns None. Is there a way to get the new view properly assigned as a child of the first pixelEditor view?

      edit: I see you have made a new function that prints the superview, but it returns fileWindow. So the windows parent is itself? Why is the superview not pixelEditor?

      Thanks for taking the time to help me out!!

      posted in Pythonista
      superrune
      superrune