omz:forum

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

    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 11
    • Posts 61
    • Best 7
    • Controversial 0
    • Groups 0

    smath

    @smath

    10
    Reputation
    1476
    Profile views
    61
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    smath Unfollow Follow

    Best posts made by smath

    • RE: Wish list for next release

      With the unfortunate demise of computable, an iPython notebook with pandas would be awesome.

      posted in Pythonista
      smath
      smath
    • Feature Request: Split screen console

      @omz - You've likely already thought of doing this, but I wanted to see what your thoughts are. I would love to be able to see my code side by side (or top and bottom) with the console. This would be great for debugging purposes. Obviously, this would work best on an iPad with the bigger screen.

      posted in Pythonista
      smath
      smath
    • Tabbed File Editing

      I would love to see tabbed editing implemented in the native pythonista editor, but in the meantime I've come up with a work-around. Tabs is a sidebar that allows you to add the current file as a tab (it will ask you to name the tab). There are probably better ways to do some of these things (I'm still learning a lot about programming), but it works. There are still some things that could be improved, so I welcome advise and tips for improvment. Feel free to improve it yourself (and share it back).

      Just to note: this app will create a database file to store your tabs in. This allows you to close it and resume your session later without losing your tabs. It's meant to be in your actions list, so you can quickly reload your tabs. If you move or delete a file one of the tabs is referencing, it will throw it off. Just delete the database file and rerun it. I may try to fix this in the future.

      posted in Pythonista
      smath
      smath
    • RE: Ranting about feature requests.

      Seems like submitting smaller reviews would be a faster way to find out what makes it past review. Then again, if a feature that Apple might not like got buried among a huge amount of other changes... I guess I can see an argument for larger releases. ;-)

      posted in Pythonista
      smath
      smath
    • RE: Ranting about feature requests.

      I'd be all about smaller realeses more often. I've been waiting for a long time for some of the features I've seen talked about on the forum. I've put myself on the list for the beta multiple times, but to no avail.

      posted in Pythonista
      smath
      smath
    • RE: Download script into Pythonista

      If you have the workflow app, here's another solution for bringing in files that are open in other apps.

      posted in Pythonista
      smath
      smath

    Latest posts made by smath

    • RE: Writing watermarks to PDF files

      Are you wanting to add a watermark to an existing PDF, or make a new PDF with a watermark? If you're making a new document you might want to check out reportlab.

      posted in Pythonista
      smath
      smath
    • RE: Strategy for TableViews with sections

      @JonB Just have to know where to look. II guess I haven't poked around the new version yet.

      @ccc Good point. Fixed.

      posted in Pythonista
      smath
      smath
    • RE: Strategy for TableViews with sections

      @JonB, Thanks for the help. I admit I still don't totally understand how this is works. I haven't been able to find the source code for the ui module. Below is my working code. As with most of my code, I'm sure there's many ways to improve it. I had to change to using an OrderedDict so the order of elements would be preserved.

      import ui
      from collections import OrderedDict
      
      class MyTableViewDataSource (object):
          def tableview_number_of_sections(self,tableview):
              return len(self.data.keys())
              
          def tableview_title_for_header(self,tableview,section):
              return self.data.keys()[section]
              
          def tableview_number_of_rows(self,tableview,section):
              key = self.data.keys()[section]
              return len(self.data[key])
             
          def tableview_cell_for_row(self, tableview, section, row):
              # Create and return a cell for the given section/row
              key = self.data.keys()[section]
              cell = ui.TableViewCell()
              cell.text_label.text = self.data[key][row]
              return cell
              
          def fill_data(self, tableview, data):
              self.data = data
              
      multi_section = ui.TableView()
      multi_section.width = 400
      multi_section.height = 400
      
      table = OrderedDict([('Header1', ['element1', 'element2', 'element3']),
                           ('Header2', ['element3', 'element4', 'element5']),
                           ('Header3', ['element6', 'element7', 'element8']),
                           ('Header4', ['element9', 'element10'])])
      
      data = MyTableViewDataSource()
      
      multi_section.data_source = data
      data.fill_data(multi_section, table)
      
      multi_section.present('sheet')
      
      posted in Pythonista
      smath
      smath
    • RE: Wish list for next release

      With the unfortunate demise of computable, an iPython notebook with pandas would be awesome.

      posted in Pythonista
      smath
      smath
    • RE: Strategy for TableViews with sections

      I'm working on this right now. My understanding is that the trick is making the right data source class as ListDataSource isn't made for multi section data. There is an example in the docs for this that I'm trying to work with, but for some reason my code is not working. I've been able to make a hard coded list that has multiple sections, but I'm trying to make a class to which I can feed a dictionary of the type shown in the code below and have it populate a tableview. Any ideas?

      # coding: utf-8
      
      import ui
      
      class MyTableViewDataSource (object):
          def tableview_number_of_sections(self, tableview):
              # Return the number of sections (defaults to 1)
              return 0
      
          def tableview_number_of_rows(self, tableview, section):
              # Return the number of rows in the section
              #print section
              return 0
      
          def tableview_cell_for_row(self, tableview, section, row):
              # Create and return a cell for the given section/row
              cell = ui.TableViewCell()
              print 'cell name: ', row
              cell.text_label.text = row
              return cell
      
          def tableview_title_for_header(self, tableview, section):
              # Return a title for the given section.
              # If this is not implemented, no section headers will be shown.
              print 'section: ', section
              return section
      
          def tableview_can_delete(self, tableview, section, row):
              # Return True if the user should be able to delete the given row.
              return False
      
          def tableview_can_move(self, tableview, section, row):
              # Return True if a reordering control should be shown for the given row (in editing mode).
              return False
              
          def fill_data(self, tableview, data):
              for section in data:
                  self.tableview_title_for_header(tableview, section)
                  for row in data[section]:
                      self.tableview_cell_for_row(tableview, section, row)
      
      
      multi_section = ui.TableView()
      multi_section.width = 400
      multi_section.height = 400
      
      list = {'Header1': ['element1', 'element2', 'element3'], 'Header2': ['element3', 'element4', 'element5'], 'Header3': ['element6', 'element7', 'element8'], 'Header4': ['element9', 'element10']}
      
      data = MyTableViewDataSource()
      
      multi_section.data_source = data
      data.fill_data(multi_section, list)
      
      multi_section.present('sheet')
      
      posted in Pythonista
      smath
      smath
    • RE: Ranting about feature requests.

      Seems like submitting smaller reviews would be a faster way to find out what makes it past review. Then again, if a feature that Apple might not like got buried among a huge amount of other changes... I guess I can see an argument for larger releases. ;-)

      posted in Pythonista
      smath
      smath
    • RE: Ranting about feature requests.

      I'd be all about smaller realeses more often. I've been waiting for a long time for some of the features I've seen talked about on the forum. I've put myself on the list for the beta multiple times, but to no avail.

      posted in Pythonista
      smath
      smath
    • RE: webrowser.open iOS9 crash

      I assume this would also affect 1.5 users?

      posted in Pythonista
      smath
      smath
    • RE: Benchmarks: What new things does iOS 9 enable in Pythonista?

      For reference against the other iPad 3s, here's one that's still on ios 8.3.

      import platform
      >>> platform.platform()
      'Darwin-14.0.0-iPad3,1-32bit'
      >>> import timeit
      >>> timeit.timeit('import sympy')
      >>> 
      21.3953218460083
      posted in Pythonista
      smath
      smath
    • ios9 and 1.5

      Has anyone installed ios9 while runing pythonista 1.5 who can verify that ios9 won't break it? I seem to remember seeing a while back that one of the beta builds was addressing something having to do with ios9.

      posted in Pythonista
      smath
      smath