omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. 7upser

    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 2
    • Posts 45
    • Best 14
    • Controversial 0
    • Groups 0

    7upser

    @7upser

    17
    Reputation
    816
    Profile views
    45
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    7upser Unfollow Follow

    Best posts made by 7upser

    • RE: SFSymbols?

      If someone interested in a list of string, here we go

      import plistlib
      import io
      
      vFilePath = '/System/Library/CoreServices/CoreGlyphs.bundle/symbol_order.plist'
      
      with open(vFilePath, 'rb') as vFile:
      	vFileObject = io.BytesIO(vFile.read())
      vJsonSFSymbols = plistlib.load(vFileObject)
      
      for vIndex, vJsonSFSymbol in enumerate(vJsonSFSymbols):
      	print(str(vIndex).zfill(4), vJsonSFSymbol)
      
      posted in Pythonista
      7upser
      7upser
    • RE: Pythonista block Phone calls / WhatsApp call

      @cvp It wasn't my Thread 😛

      But you are right Phone calls and WhatsApp are different things.
      Maybe there is a url scheme for whats app, or a action for Shortcuts.

      But back to what i'm interested in (call shortcut and return to pythonista)
      This could work:

      import ui
      import webbrowser
      
      class cUIView(ui.View):
      	def __init__(self, *args, **kwargs):
      		self.width, self.height = 200, 200
      		self.background_color = 'silver'
      		
      		self.vBtn = ui.Button(title = 'test', name = 'btntest')
      		self.vBtn.frame = (50, 50, 100, 100)
      		self.vBtn.background_color = 'white'
      		self.vBtn.action = self.btnAction
      		self.add_subview(self.vBtn)
      		
      	def btnAction(self, vSender):
      		url = 'shortcuts://x-callback-url/run-shortcut?name=testBluetoothOff&x-success=pythonista3://'
      		webbrowser.open(url)
      
      vView = cUIView()
      vView.present('sheet')
      
      posted in Pythonista
      7upser
      7upser
    • RE: Pythonista Text underscore

      In german its named: Tastenformen
      (einstellungen / bedienungshilfen / anzeige & textgröße / tastenformen)

      Never heard this before, i think Apple create a new word....

      posted in Pythonista
      7upser
      7upser
    • RE: Print superscript characters in Python

      You can also add Unicode superscripts to the characters: \u00B2
      for more information see here: Wikipedia

      Result is something like this:

      print(''.join('m/s' + '\u00B2'))
      print('m/s\u00B2')
      
      posted in Pythonista
      7upser
      7upser
    • RE: Trouble with Unicode

      You can test the ios font and their glyphs with a short script:

      from objc_util import *
      
      UIFont = ObjCClass('UIFont')
      vObjCAllFontNames = []
      vObjCFontFamilieNames = UIFont.familyNames()
      for vObjCFontFamilieName in vObjCFontFamilieNames:
      	vObjCFontNamesWithinFamily = UIFont.fontNamesForFamilyName_(vObjCFontFamilieName)
      	vObjCAllFontNames += vObjCFontNamesWithinFamily
      
      vFontFamilieNames = []
      vAllFontNames = []
      
      for vTemp in vObjCFontFamilieNames:
      	vFontFamilieNames.append(str(vTemp))
      for vTemp in vObjCAllFontNames:
      	vAllFontNames.append(str(vTemp))
      
      vAllFontNames.sort()
      for vFont in vAllFontNames:
      	vConsoleFont = [(vFont, 20), (0, 0, 0)]
      
      	console.set_font(vConsoleFont[0][0], vConsoleFont[0][1])
      	console.set_color(vConsoleFont[1][0], vConsoleFont[1][1], vConsoleFont[1][2])
      
      	print(vConsoleFont[0][0])
      	print(u'\u0048\u0065\u006c\u006c\u006f \u0057\u006f\u0072\u006c\u0064\u003a \u10c5\u10c7\u10cd\u10d0\u000a')
      
      console.set_font()
      console.set_color(0.00, 0.00, 0.00)
      
      

      Maybe this is a help for you, but i didn't test it.
      FontInstaller

      posted in Pythonista
      7upser
      7upser
    • RE: Correct way to call Pythonista script from within a Shortcuts workflow?

      This works for me, the script is in This iPad/dir:

      tag

      The iCloud Path should be:
      /private/var/mobile/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents

      but i dont use parameter

      Edit:
      Did a test for parameter with url scheme:
      see here: Pythonista Url scheme

      tag

      works too

      posted in Pythonista
      7upser
      7upser
    • RE: Natural sorting of values in nested dictionary

      I had a similar Problem. I need a german sorted List and locale didn't work with Pythonista. So i have to write my own Sort def. That should solve your Problem.
      But @mikael was faster than light

      
      def myOwnSort(vInput):
      	import re
      	
      	vInput = dict_nested[vInput]['sv_runinskr_trim']
      	vInNr = re.findall('\d+', vInput)
      	vInNr = int(vInNr[0]) if len(vInNr) > 0 else 0
      	vInNr = '{0:0>3}'.format(vInNr)
      	
      	vInChar = re.findall('\D+', vInput)
      	vInChar = vInChar[0] if len(vInChar) > 0 else ''
      	
      	vNewSortKey = vInNr + vInChar
      
      	return vNewSortKey
      
      
      TheOneAndOnlyNewAndPrivateSortedDictionaryWithMyOwnSortKey = sorted(dict_nested, key = myOwnSort)
      
      
      for i in TheOneAndOnlyNewAndPrivateSortedDictionaryWithMyOwnSortKey:
      	print(dict_nested[i]['sv_runinskr_trim'])
      
      
      posted in Pythonista
      7upser
      7upser
    • RE: locale.currency doesn't work

      Still not working, really?

      posted in Pythonista
      7upser
      7upser
    • RE: New to Python....

      Hi, @OkieWolf

      You can post your Code with the top right button in the forum Editor.
      </>
      This result in better formatting Code.

      To debug your Code:
      Close your UI View and click the right Button where you see the Errormessage.

      tag

      Then click on Variables

      tag

      There you can see that ang and rad are strings.
      You can also set Breakpoints by tap and Hold within the Editor.
      Or you can use a print command: print(type(rad))

      You only need to convert them to float. And the Result back to string

      arc = str(float(rad) * float(ang) * pi / 180)
      

      Edit: See you solve your Problem

      posted in Pythonista
      7upser
      7upser
    • RE: Add to Home Screen did not work

      @DaricLiu ,
      Try to reboot your device.
      We have discussed this: see here

      And i found out, it isn't the same Path twice. If you move the Script, it is old Path and new Path.

      posted in Pythonista
      7upser
      7upser

    Latest posts made by 7upser

    • RE: BUG: IDE doesn't work with special characters

      @cvp

      In Pythonista 3.3:

      len('á') = 1 (not 2)
      

      That wasn't a problem earlier.
      When I edit the script with another editor, like Taio, File Browser Pro the length = 1.

      Edited with Taio:
      print(len('á')) = 1
      copy & paste with Pythonista:
      print(len('á')) = 2

      Reference to the iCloud issue:
      I am using Taio editor and tested this. I open the same script in Taio (iPad) and Pythonista (iPad). Then I make changes in Pythonista and switch to Taio. There comes a dialog (Compare, Accept, Discard changes). If I now go to Pythonista (iPhone), the old (unchanged) version is there and Pythonista (iPhone) writes this, old version to the iCloud.
      Pythonista does not fetch any current data from iCloud, even after a cold start, Taio does it even without a cold start. The safest way is to open the scripts via iOS Files App.

      Edit: I often have this problem only on the iPad. I edit with Taio and Pythonista still has the old version.
      Sometimes it is, certainly, due to the iCloud. But not always.

      posted in Pythonista
      7upser
      7upser
    • BUG: IDE doesn't work with special characters

      I need to import some CSV files and search for text. But Pythonista does not find text if there are special characters in it. The special characters (in Pythonista) have a length of 2 and are also composed of 2 characters. But that should be only 1 character. You need an external editor.
      You can test it with this:

      print(len('á'))
      for x in 'áåä':
      	print(x)
      

      And Pythonista still deletes program code via iCloud! If I write / change something on the iPad and then open it on the iPhone all changes are deleted from Pythonista!

      posted in Pythonista
      7upser
      7upser
    • RE: Pythonista block Phone calls / WhatsApp call

      @cvp It wasn't my Thread 😛

      But you are right Phone calls and WhatsApp are different things.
      Maybe there is a url scheme for whats app, or a action for Shortcuts.

      But back to what i'm interested in (call shortcut and return to pythonista)
      This could work:

      import ui
      import webbrowser
      
      class cUIView(ui.View):
      	def __init__(self, *args, **kwargs):
      		self.width, self.height = 200, 200
      		self.background_color = 'silver'
      		
      		self.vBtn = ui.Button(title = 'test', name = 'btntest')
      		self.vBtn.frame = (50, 50, 100, 100)
      		self.vBtn.background_color = 'white'
      		self.vBtn.action = self.btnAction
      		self.add_subview(self.vBtn)
      		
      	def btnAction(self, vSender):
      		url = 'shortcuts://x-callback-url/run-shortcut?name=testBluetoothOff&x-success=pythonista3://'
      		webbrowser.open(url)
      
      vView = cUIView()
      vView.present('sheet')
      
      posted in Pythonista
      7upser
      7upser
    • RE: Pythonista block Phone calls / WhatsApp call

      good argument

      posted in Pythonista
      7upser
      7upser
    • RE: Pythonista block Phone calls / WhatsApp call

      There is also an automation, when App is open.

      posted in Pythonista
      7upser
      7upser
    • RE: Speech Recognition failed

      @cvp
      uuups, sorry. I was too busy today 😇

      posted in Pythonista
      7upser
      7upser
    • RE: Speech Recognition failed

      Maybe he means a Homescreen Symbol.
      @Python567, see here, if yes:

      shortcuts
      But you need to install Pythonista for each User.

      posted in Pythonista
      7upser
      7upser
    • RE: Pythonista Text underscore

      I know tastenform but never heard the plural.
      (btw. plural is in the word tasten)
      And 'operating aids' sounds like my iPad has Aids but is still operating.😷😛

      posted in Pythonista
      7upser
      7upser
    • RE: Pythonista Text underscore

      In german its named: Tastenformen
      (einstellungen / bedienungshilfen / anzeige & textgröße / tastenformen)

      Never heard this before, i think Apple create a new word....

      posted in Pythonista
      7upser
      7upser
    • RE: Print superscript characters in Python

      You can also add Unicode superscripts to the characters: \u00B2
      for more information see here: Wikipedia

      Result is something like this:

      print(''.join('m/s' + '\u00B2'))
      print('m/s\u00B2')
      
      posted in Pythonista
      7upser
      7upser