omz:forum

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

    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 1
    • Followers 0
    • Topics 2
    • Posts 4
    • Best 1
    • Controversial 0
    • Groups 0

    seriph

    @seriph

    1
    Reputation
    210
    Profile views
    4
    Posts
    0
    Followers
    1
    Following
    Joined Last Online

    seriph Unfollow Follow

    Best posts made by seriph

    • RE: Trouble performing actions using NavigationView

      Thank you, @ccc and @cvp for the helpful replies. I reviewed the reference @cvp suggested and it clear that NavigationView isn't the best tool for what I want to do: a program that displays the chords and lyrics from ChordPro files with the correct formatting and autoscrolling, including a scrollable list of the .chordpro files and a scrollable list of songs they contain.

      I was able to repurpose a single TableView to handle all of this, which saved me from the complexity of working with NavigationView. I plan to try out the script in a guitar jam next month.

      posted in Pythonista
      seriph
      seriph

    Latest posts made by seriph

    • RE: Trouble performing actions using NavigationView

      Thank you, @ccc and @cvp for the helpful replies. I reviewed the reference @cvp suggested and it clear that NavigationView isn't the best tool for what I want to do: a program that displays the chords and lyrics from ChordPro files with the correct formatting and autoscrolling, including a scrollable list of the .chordpro files and a scrollable list of songs they contain.

      I was able to repurpose a single TableView to handle all of this, which saved me from the complexity of working with NavigationView. I plan to try out the script in a guitar jam next month.

      posted in Pythonista
      seriph
      seriph
    • Trouble performing actions using NavigationView

      I am unable to use button actions on a table view, all within a subview using NavigationView. I would like to be able to click a button on the subview and have it manipulate the table view, but even trying to print the contents of objects in the subview isn't working, as shown below. I expect I am simply referencing the variables the wrong way, but I have not been able to get through this impasse. I get errors shown as comments in the code below.

      To create the example below, I use two pyui files which I have summarized. If there is a way to share the pyui files in the forum, let me know. I tried embedding the json for the pyui as a string, but that didn't work. And I am sorry the example code is so complicated. I am happy to provide clarification.

      import ui
      
      # rootView.pyui contents:
      # Text Field: name = displayString, action = none
      # Button: name = displayButton, action = self.bt_display
      # Table View: name = rootviewListTable
      
      # subView.pyui contents:
      # Text Field: name = svDisplayString, action = none
      # Button: name = svDisplayButton, action = self.bt_svDisplay
      # Button: name = attributesButton, action = self.bt_attributes
      # Table View: name = svText
      
      def make_button_item(action, image_name):
          return ui.ButtonItem(action=action, image=ui.Image.named(image_name))
      
      class navviewManager(ui.View):
      
              def __init__(self):
                      self.currentSongTitle = ""
                      self.root_view = ui.load_view("rootView.pyui")
                      self.root_view.left_button_items = [
                              make_button_item(self.bt_close, "ionicons-close-24")
                      ]
                      self.root_view.right_button_items = [
                              make_button_item(self.bt_subview, "ionicons-arrow-right-b-24")
                      ]
                      self.nav_view = ui.NavigationView(self.root_view)
                      self.nav_view.present(hide_title_bar=True)
                      
              def bt_subview(self, sender):
                      sub_view = load_view("subView.pyui")
                      sub_view.name = "subview"
                      myText = "This is myText"
                      myList = ui.ListDataSource(myText)
                      myTextTable= sub_view["svText"]
                      myTextTable.data_source = myTextTable.delegate = myList
                      myTextTable.data_source.delete_enabled = myTextTable.editing = False
                      self.nav_view.push_view(sub_view)
      
              def bt_display(self, sender):
                      displayTerm = self.root_view["displayString"].text
                      myList = ui.ListDataSource(displayTerm)
                      
                      myRootListTable = self.root_view["rootviewListTable"]
                      myRootListTable.data_source = myRootListTable.delegate = myList
                      myRootListTable.data_source.delete_enabled = myRootListTable.editing = False
                      myRootListTable.reload_data()
                      
              def bt_svDisplay(self, sender):
                      svDisplayTerm = self.nav_view["svDisplayString"].text
                      # AttributeError: 'NoneType' object has no attribute 'text'
                      myList = ui.ListDataSource(svDisplayTerm)
                      
                      svListTable = self.nav_view["svText"]
                      svListTable.data_source = svListTable.delegate = myList
                      svListTable.data_source.delete_enabled = svListTable.editing = False
                      svListTable.reload_data()
              
              def bt_attributes(self, sender):
                      print(self.root_view["displayString"].text)  # OK
                      print(vars(self.root_view["displayString"])) # OK
                      print(vars(self.nav_view["svDisplayString"]))
                      # TypeError: vars() argument must have __dict__ attribute
      
              def bt_close(self, sender):
                  self.nav_view.close()
                               
      manager = navviewManager()
      
      posted in Pythonista
      seriph
      seriph
    • RE: full_screen parameter in NavigationView not working for me

      @cvp Thank you. My program works now. Next time I will try the in-forum Search function rather that rely on an Internet search engine.

      posted in Pythonista
      seriph
      seriph
    • full_screen parameter in NavigationView not working for me

      My first posting. I am unable to use NavigationView in full_screen mode. Any guidance would be appreciated. Here is an example where I have changed the .present argument from hide_title_bar=True to 'full_screen' from an on-line example found here. Despite specifying full_screen, it still appears as an overlay in the middle portion of my screen.

      -Seriph

      import ui
      
      
      def make_button_item(action, image_name):
          return ui.ButtonItem(action=action, image=ui.Image.named(image_name))
      
      
      class NavView(ui.View):
          def __init__(self):
              root_view = ui.load_view()
              root_view.left_button_items = [
                  make_button_item(self.bt_close, "ionicons-close-24")
              ]
              root_view.right_button_items = [
                  make_button_item(self.bt_subview, "ionicons-arrow-right-b-24")
              ]
              self.nav_view = ui.NavigationView(root_view)
              self.nav_view.present('full_screen') # hide_title_bar=True)
              
          def bt_subview(self, sender):
              sub_view = ui.load_view("switchview1.pyui")
              sub_view.name = "subview"
              sub_view["btn_Okay"].action = self.bt_action
              sub_view["btn_Cancel"].action = self.bt_action
              self.nav_view.push_view(sub_view)
      
          def bt_close(self, sender):
              self.nav_view.close()
      
          def bt_action(self, sender):
              print("action from " + sender.name)
      
      
      NavView()
      
      posted in Pythonista
      seriph
      seriph