omz:forum

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

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

    ryubai

    @ryubai

    0
    Reputation
    904
    Profile views
    27
    Posts
    0
    Followers
    1
    Following
    Joined Last Online

    ryubai Unfollow Follow

    Latest posts made by ryubai

    • RE: What what what!! New version in TestFlight!!!

      @JonB Yes,it has been for 3 year since last updated.

      posted in Pythonista
      ryubai
      ryubai
    • RE: how to return nil in a objc new class function?

      @cvp thank you very much.
      i prefer to use uitableviewcontroller,it connect data source and delegate automatically.
      your code works but when I transfer to UITableViewController,it crashs.

      posted in Pythonista
      ryubai
      ryubai
    • RE: how to return nil in a objc new class function?

      @cvp i don’t understand how to .. i want to subclass a UITableViewcontroller and add a action when i left swipe a cell.
      could you show me the right way in the code i provided?
      sorry for my poor understanding.

      posted in Pythonista
      ryubai
      ryubai
    • RE: how to return nil in a objc new class function?

      @cvp i try the code below,but still crash,what’s the problem?

      from objc_util import *
      import ui
      
      @on_main_thread
      def main_tableview():
      	def tableView_numberOfRowsInSection_(_self, _cmd,_tv,_section):
      		return 3
      	
      	def numberOfSectionsInTableView_(_self, _cmd,_tv):
      		return 1
      	
      	def tableView_cellForRowAtIndexPath_(_self, _cmd,_tv,_indexpath):
      		cell=ObjCInstance(_tv).dequeueReusableCellWithIdentifier("cell1") 
      		if cell==None:
      			cell=ObjCClass('UITableViewCell').alloc().initWithStyle_reuseIdentifier_(3,"cell2")
      		
      		cell.textLabel().text = 'test'
      		return cell.ptr
      	
      	def tableView_trailingSwipeActionsConfigurationForRowAtIndexPath_(_self,_cmd,_tv,_indexPath): 
      		return None
      		
      	tvc1 = create_objc_class('UITableViewController',ObjCClass('UITableViewController'),methods=[tableView_numberOfRowsInSection_,numberOfSectionsInTableView_,tableView_cellForRowAtIndexPath_,tableView_trailingSwipeActionsConfigurationForRowAtIndexPath_])
      	
      	return  tvc1.alloc().init().autorelease()	
      	
      @on_main_thread
      def main():
      
      	root_vc = UIApplication.sharedApplication().keyWindow().rootViewController()
      	tbc=main_tableview()
      	root_vc.presentViewController_animated_completion_(tbc, True, None)
      	
      if __name__=='__main__':
      	main()
      
      posted in Pythonista
      ryubai
      ryubai
    • RE: how to return nil in a objc new class function?

      @cvp when i comment # return none,i got it.
      thanks very much.

      posted in Pythonista
      ryubai
      ryubai
    • RE: how to return nil in a objc new class function?

      @cvp thanks

      i have checked _objc_exception.txt and saw nothing in this crash.
      try the example you provided,when i do a left swipe,it just show “delete” button.
      i have no idea how the code below work

      	# set actions if swipe
      	UIContextualAction = ObjCClass('UIContextualAction').alloc()
      	UIContextualAction.setTitle_("Drizzel's action 😅")
      	# block does not have parameter nor return, thus we can use a Python def
      	UIContextualAction.setHandler_(handler)
      	UIContextualAction.setBackgroundColor_(ObjCClass('UIColor').blueColor().colorWithAlphaComponent(0.5))
      	
      	UISwipeActionsConfiguration = ObjCClass('UISwipeActionsConfiguration').configurationWithActions_([UIContextualAction])
      
      posted in Pythonista
      ryubai
      ryubai
    • how to return nil in a objc new class function?

      hey~i need to return none in a objc new class function,but it crash’s when i use return none.how can i solve it? thanks very much.

      def tableView_trailingSwipeActionsConfigurationForRowAtIndexPath_(_self,_cmd,_tv,_indexPath):       
      		return None
      
      posted in Pythonista
      ryubai
      ryubai
    • RE: rubicon.objc’s problem

      @JonB

      thanks.
      it seems not convenient for debug, and i still use objc_util as OC bridge.

      posted in Pythonista
      ryubai
      ryubai
    • RE: help about return type

      @JonB

      run more than once will raise such errs,then how to solve?

      ctypes_patch.make_callback_returnable(CGSize)
      File "/private/var/mobile/Containers/Shared/AppGroup/02422888-CC52-45FC-BB53-72013D3F4AFA/Pythonista3/Documents/site-packages/ctypes_patch.py", line 128, in make_callback_returnable
      raise ValueError("The ctype {} already has a getfunc")
      ValueError: The ctype {} already has a getfunc

      posted in Pythonista
      ryubai
      ryubai
    • rubicon.objc’s problem

      latest when i try rubicon_objc.
      the code below, run once is normal. run anther time will raise a err.
      how can i solve it? thanks in advance

      RuntimeError: An Objective-C class named b'Handler' already exists

      code:

      from rubicon.objc import NSObject, objc_method

      class Handler(NSObject):
      @objc_method
      def initWithValue_(self, v: int):
      self.value = v
      return self

      @objc_method
      def pokeWithValue_andName_(self, v: int, name) -> float:
          print("My name is", name)
          return v / 2.0
      

      my_handler = Handler.alloc().initWithValue(42)

      posted in Pythonista
      ryubai
      ryubai