omz:forum

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

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

    Balur

    @Balur

    I am Hungarian, my English is not so good.
    Coding is a hobby for me. I'm new to Python and Pythonista but I have some coding experience in other languages.

    3
    Reputation
    1212
    Profile views
    17
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    Balur Unfollow Follow

    Best posts made by Balur

    • Mute top keys and code completion sounds, is it possible?

      Just a little thing I know, but...
      Is it possible to mute top keys and code completion sounds without poke the vibrate switch?

      posted in Pythonista
      Balur
      Balur
    • RE: How can I get console width?

      I think I got the missing piece. After a little testing it seems the default console font is Menlo, 14.

      import ui
      def getConsoleWidth(font=('Menlo',14)):
        screenWidth = ui.get_screen_size().width
        charWidth = ui.measure_string('.',font=font).width
        return int(screenWidth / charWidth-1.5)
      

      I'm not sure why subtract by 1.5 exactly, but I think console margin have something to do with it. Tested on my iphone and ipad mini, both orientations.

      posted in Pythonista
      Balur
      Balur
    • How can I get console width?

      Hi Guys,

      I'm new here and new to Python language also.
      Is there any working way to get console width in Pythonista? I mean in character count in one row, like 40 or 36.

      posted in Pythonista
      Balur
      Balur

    Latest posts made by Balur

    • RE: Sync between devices, how to?

      @DavidHutchison Thank you again. With SKIP_FILES collection, can complete folders be skipped without add file by file? Config file is a good direction. I'm definitely looking forward to it.

      Yesterday I also found two more issues about empty folders and re-uploading deleted files.

      posted in Pythonista
      Balur
      Balur
    • RE: Sync between devices, how to?

      @DavidHutchison Thank you for your update. I tested in my enviroment and I bumped into 2 issues.

      posted in Pythonista
      Balur
      Balur
    • RE: Sync between devices, how to?

      @upwart I know there is a better approach, but I did the following 3 line modifications:

      Add this line top level, around line 20:
      FILE_FILTER = ('.py','.pyui','.txt')

      Replace line 122:
      before: if file['is_dir'] == False and file['mime_type'].endswith('python'):
      after: if file['is_dir'] == False and file['path'].endswith(FILE_FILTER):

      Replace line 250:
      before: if not file in processed_files and not os.path.isdir(file) and not file.startswith('.') and file.endswith('.py'):
      after: if not file in processed_files and not os.path.isdir(file) and not file.startswith('.') and file.endswith(FILE_FILTER):

      @ccc Thank you for opening an issue about nested folders, hope someone will pick it up soon.

      posted in Pythonista
      Balur
      Balur
    • RE: Sync between devices, how to?

      @ccc It's upload only .py files, and only in one folder deep. Is this working as expected?

      1. Sketchpad/HelloWorld.py
      2. Projects/RandomThing/RandomThing.py

      First file uploaded, second not. Pyui files and .txt neither.

      I find where can I add more file type to the jam, but not the nested directories.

      posted in Pythonista
      Balur
      Balur
    • RE: Sync between devices, how to?

      @ccc Am I have the right one? I think not. I am currently using freekrai's version. You mean what I linked last, dhutchison's repo?

      Really sorry I have issue with English as well.

      I gave a quick look at dhutchison's DropboxSync. I had problem with it, because it's only sync very few files. Do it have any limitation?

      posted in Pythonista
      Balur
      Balur
    • RE: How can I get console width?

      @ccc Edited. Tried my best.

      posted in Pythonista
      Balur
      Balur
    • RE: Sync between devices, how to?

      @ccc I read this, thanks for mentioning. GitHub, collaboration, fostered code etc are totally new to me, so I'm a bit puzzled. Which one you prefer or suggest? This one?

      posted in Pythonista
      Balur
      Balur
    • RE: How can I get console width?

      @omz @Webmaster4o Well done, works for me too.

      @JonB Thank you, I extended the functions based on your answer. If you find something about 1/3 screen console, please let me know.

      # coding: utf-8
      import ui
      import objc_util
      
      def getDefaultConsoleFont():
      	defaults=objc_util.ObjCClass('NSUserDefaults').standardUserDefaults()
      	return (str(defaults.stringForKey_('OutputFontName')),\
      			defaults.integerForKey_('OutputFontSize'))
      
      def getCurrentConsoleFont():
      	app=objc_util.ObjCClass('UIApplication').sharedApplication()
      	cv=app.delegate().consoleViewController()
      	cv.view()
      	font=cv.outputFont()
      	font_family=str(font.familyNameForCSSFontFamilyValue())
      	#font_family2=str(font.familyName())
      	font_size=font.pointSize()
      	char_width=font.advancementForGlyph_(68).width
      	line_height=font.lineHeight()
      	return (font_family, font_size), char_width, line_height
      
      def getConsoleCharWidth():
      	font,charWidth,lineHeight=getCurrentConsoleFont()
      	screenWidth=ui.get_screen_size().width
      	#charWidth=ui.measure_string('.',font=font).width
      	return int(screenWidth / charWidth-1.5)	
      
      if __name__ == '__main__':
      	ccwidth=getConsoleCharWidth()
      	currentFont,_,_=getCurrentConsoleFont()
      	defaultFont=getDefaultConsoleFont()
      	print('currentConsoleFont='+str(currentFont))
      	print('defaultConsoleFont='+str(defaultFont))
      	print('consoleCharWidth = '+str(ccwidth))
      	print('='*ccwidth)
      

      Sorry for copy paste, it's a bit long.

      posted in Pythonista
      Balur
      Balur
    • RE: Sync between devices, how to?

      @Webmaster4o, Oh , that's unfortunate.

      @marcus67, I have a NAS with WebDAV service. I'll check your link soon. Thank you.

      posted in Pythonista
      Balur
      Balur
    • Mute top keys and code completion sounds, is it possible?

      Just a little thing I know, but...
      Is it possible to mute top keys and code completion sounds without poke the vibrate switch?

      posted in Pythonista
      Balur
      Balur