• robertiii

    How do I use this and setup several different types of annotations with different images for different kinds. For instance, using a picture of a light to mark a light, a picture of a bush to mark and bush, and a picture of a tree to mark a tree.

    posted in Pythonista read more
  • robertiii

    So I know that this is a very old thread, however I have wanted to be able to emplement this kind of thing. I keep getting the following error on the the line

    class_ptr = c.objc_allocateClassPair(NSObject.ptr, 'OMMapViewDelegate', 0)
    

    argument 2: <class 'TypeError'>: wrong type

    What needs to change to allow me to use this? Thanks in advance!

    posted in Pythonista read more
  • robertiii

    Know this is old, but wondering about being able to get correct formatting for tables.

    posted in Pythonista read more
  • robertiii

    Is there any way to import python modules into editorial?

    posted in Editorial read more
  • robertiii

    Is is possible to call ‘pythonista://...’ and get it to return data in the callback. I know that I can use pythonista to get data say from Workflow app, but is it possible the other way around?

    posted in Pythonista read more
  • robertiii

    Been trying to figure out profile building and totally lost!

    posted in Pythonista read more
  • robertiii

    How do I create a home screen icon link to a script. I have looked all over and not found anything that works.

    posted in Pythonista read more
  • robertiii

    How do I use this and get arguments from workflow?

    posted in Pythonista read more
  • robertiii

    Thank you. I feel like an idiot!!!!! I knew this and went over the code several times. Thank you so much!

    posted in Pythonista read more
  • robertiii

    I have no idea why nothing is called when I tap the cell. The cells populate correctly with data and everything works, including delete, except for selecting.

    # coding: utf-8
    import ui
    import sqlite3
    from master import master_root_view
    from detail import detail_root_view
    
    data = []
    
    def initDatabase():
        try:
            conn = sqlite3.connect('questions.db')
            c = conn.cursor()
            c.execute('''CREATE TABLE questions (question, correctAnswer, option1, option2, option3, option4, level, id)''')
            conn.commit()
            conn.close()
        except:
            pass
    
    def getQuestions():
        try:
            conn = sqlite3.connect('questions.db')
            conn.row_factory = lambda cursor, row: row[0]
            c = conn.cursor()
            ids = c.execute('SELECT id FROM questions').fetchall()
            conn.close()
            data.clear()
            for id in ids:
                if id not in data:
                    data.append(int(id))
            return ids
        except:
            pass
    
    def missing_elements(L):
        start, end = L[0], L[-1]
        return sorted(set(range(start, end + 1)).difference(L))
    
    class questionList(object): #also acts as the data_source.  Can be separate, but this is easier.  
        def __init__(self,items):   
            getQuestions()
            self.items = items
            self.currentNumLines = len(items)
            self.currentTitle = None
            self.currentRow = None
            self.selectedSong = None
                    
        def tableview_did_select(self, tableview, section, row):
            # Called when a row was selected.
            print('Tapped Cell')
            tableview.reload_data() # forces changes into the displayed list
        
        def tableview_did_deselect(self, tableview, section, row):
            # Called when a row was de-selected (in multiple selection mode).
            pass
        
        def tableview_title_for_delete_button(self, tableview, section, row):
            # Return the title for the 'swipe-to-***' button.
            return 'Delete' # or 'bye bye' or 'begone!!!'   
                    
        def tableview_number_of_sections(self, tableview):
            # Return the number of sections (defaults to 1). Someone else can mess with 
            # sections and section logic
            return 1
            
        def tableview_number_of_rows(self, tableview, section):
            # Return the number of rows in the section
            #getQuestions()
            return len(data) #needed to be in sync with displayed version, 
    
        def tableview_cell_for_row(self, tableview, section, row):
            # Create and return a cell for the given section/row
            cell = ui.TableViewCell()
            conn = sqlite3.connect('questions.db')
            c = conn.cursor()
            question = c.execute('SELECT question FROM questions WHERE id=?', (1,)).fetchone()[0]
            conn.close()
            cell.text_label.text = str(question)
            return cell 
            
        def tableview_title_for_delete_button(self, tableview, section, row):
            # Return the title for the 'swipe-to-***' button.
            return 'Delete' # or 'bye bye' or 'begone!!!'
                
        def tableview_can_delete(self, tableview, section, row):
            # Return True if the user should be able to delete the given row.
            return True # you can use logic to lock out specific ("pinned" entries) 
        
        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 True # see above
        
        def tableview_delete(self, tableview, section, row):
            # Called when the user confirms deletion of the given row.
            conn = sqlite3.connect('questions.db')
            c = conn.cursor()
            c.execute('DELETE FROM questions WHERE id = ?',(data[row],))
            conn.commit()
            conn.close()
            data.pop(row)
            self.currentNumLines -= 1 # see above regarding hte "syncing"
            tableview.delete_rows((row,)) # this animates the deletion  could also 'tableview.reload_data()'
            
        
        def tableview_move_row(self, tableview, from_section, from_row, to_section, to_row):
            # Called when the user moves a row with the reordering control (in editing mode).
            self.displayItems = listShuffle(self.items,from_row,to_row) 
            # cynchronizes what is displayed with the underlying list
    
    def setup():
        splitView = ui.View()
        splitView.width = 800
        splitView.height = 800
        splitView.background_color='white'
        splitView.add_subview(master_root_view)
        splitView.add_subview(detail_root_view)
    
        master_root_view.width = 600
        master_root_view.height = splitView.height
        master_root_view.flex='H'
    
        detail_root_view.flex='WHR'
        detail_root_view.x+=master_root_view.width
        detail_root_view.width=splitView.width-master_root_view.width
        detail_root_view.height = splitView.height
    
        questions = master_root_view['questionsList']
        questionDel = questionList(data)
        questions.data_source = questions.data_source = questionDel
        questions.reload()
    
        initDatabase()
        splitView.present('landscape')
        return splitView
    
    setup()
    

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!