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.
Pythonista 1.6 Beta
-
A minor suggestion: the gui doesn't have presets for iPhone 6 or 6+. I haven't been able to run too much, though my standard scripts seem to work fine.
-
Potential bug
in betaView.present(style='full_screen', orientation=('landscape'))
Does not prevent rotation. With or without parens around 'landscape'
IPad Air 2
-
Potential bug in beta
View.present(style='full_screen', orientation=('landscape'))First off, it should be
orientations
(plural), notorientation
, but I assume that's just a typo (you'd get an error otherwise). More importantly, you should pass a sequence of valid orientations, not a single orientation. It looks like you're trying to pass a tuple, but tuples that only contain a single item must contain a trailing comma, like this:('landscape',)
. The method accepts your single string because it expects a sequence, and strings are actually sequences (of characters), but you won't get the proper behavior this way. -
Thanks. Didn't know about the trailing comma formalism in a in a tuple of text strings. Works just fine now. Sorry for false alarm.
-
Any chance of getting lxml in Pythonista 1.6 (and the next version of Editorial too, while I'm at it)? I would really, really like to use openpyxl (or python-xlsx) and python-docx to read/edit Excel and Word docs in my Dropbox but they have lxml as a dependency and, as a C-based library, it's not user-installable.
-
I've been having a lot of fun with the cb module. So far, I've been talking with a ti sensor tag. I have also been using a piconsole to communicate with a Raspberry pi via btle.
I'm having one issue and I'm not sure why. I have issue detecting my iphone. It seems to only detect it on rare occasions. Has anyone else been able to see with iphone while it's in discover mode?
-
Ole, remember to reinsert the xcode export!
-
@filippocld: I have found that using OMZ's online xCode snapshot is not quite as convenient but it works, in case the export functionality is an issue.
-
What is this xCode snapshot? Is this the template project currently needed build your own app? Is there a version we should look at that is for 1.6?
-
You will find a link to the snapshot mentioned in the 1.5 release notes. As far as I know that is still a snapshot of the 1.5 base but I haven't looked lately.
-
I would really appreciate a setting to make folders sort alphabetically within the list of files (Mac style) instead of at the top (Windows style). I find the latter incredibly rage-inducing.
-
@omz Just a few thoughts:
- [Bug] When archiving a folder to send as an email in the export menu, the email share sheet is never presented.
- [Feature Request] Would it be possible to get a color picker dialog?
- [Feature Request] Would it be possible to get a console.hud_alert with a loading icon? Sort of like when creating an archive?
-
[Bug] When archiving a folder to send as an email in the export menu, the email share sheet is never presented.
I can't reproduce this. iPhone or iPad? Which iOS version? Does it work with a single file?
[Feature Request] Would it be possible to get a console.hud_alert with a loading icon? Sort of like when creating an archive?
You can do this with
console.show_activity()
andconsole.hide_activity()
, e.g.:import console import time console.show_activity('Please wait') time.sleep(1) # do some work here... console.hide_activity()
-
@techteej I have a thing for you. It can (AND SHOULD) be cleaned up and or modified to look better.
import ui from random import random def color_chooser_dialog(): ''' Shows a color chooser dialog and returns the color as a hex value. I may have it return a tuple, but most Python modules will accept ANY color representation ''' def slider_action(sender): # Get the root view: v = sender.superview # Get the sliders: r = v['slider1'].value g = v['slider2'].value b = v['slider3'].value # Create the new color from the slider values: v['view1'].background_color = (r, g, b) v['label1'].text = '#%.02X%.02X%.02X' % (r*255, g*255, b*255) def shuffle_action(sender): v = sender.superview s1 = v['slider1'] s2 = v['slider2'] s3 = v['slider3'] s1.value = random() s2.value = random() s3.value = random() slider_action(s1) class ColorMixer (ui.View): def __init__(self): self.val = None self.background_color = 'white' self.frame = (0,0,320,244) view1 = ui.View(name='view1') view1.frame = (6,6,154,59) view1.flex = 'R' label1 = ui.Label(name='label1') label1.frame = (168,6,148,59) label1.flex = 'L' label1.font = ('<system>', 32) label1.number_of_lines = 0 label1.alignment = ui.ALIGN_CENTER label1.text = 'FFFFFF' slider1 = ui.Slider(name='slider1') slider1.frame = (6,73,308,34) slider1.flex = 'W' slider1.tint_color = '#ff0000' slider1.value = .5 slider1.continuous = True slider1.action = slider_action slider2 = ui.Slider(name='slider2') slider2.frame = (6,115,308,34) slider2.flex = 'W' slider2.tint_color = '#00ff00' slider2.value = .5 slider2.continuous = True slider2.action = slider_action slider3 = ui.Slider(name='slider3') slider3.frame = (6,157,308,34) slider3.flex = 'W' slider3.tint_color = '#0000ff' slider3.value = .5 slider3.continuous = True slider3.action = slider_action button1 = ui.Button(name='button1') button1.frame = (168,199,146,38) button1.flex = 'L' button1.title = 'Done' button1.font = ('<system>', 15) button1.action = self.done_action button2 = ui.Button(name='button2') button2.frame = (6,199,145.5,38) button2.flex = 'R' button2.title = 'Shuffle' button2.font = ('<system>', 15) button2.action = shuffle_action self.add_subview(view1) self.add_subview(label1) self.add_subview(slider1) self.add_subview(slider2) self.add_subview(slider3) self.add_subview(button1) self.add_subview(button2) shuffle_action(button2) def done_action(self, sender): self.val = self['label1'].text self.close() w = ColorMixer() w.present('popover') w.wait_modal() return w.val if __name__ == '__main__': print color_chooser_dialog()
Just remember to put
@ui.in_background
if you call it. I made that mistake too many times. -
@omz As for the bug, iPad on iOS 8.1.1 (and I had it on iOS 8.1 as well). Actually doesn't work on a single file either.
@blmacbeth Just think though, wouldn't
dialogs.color_picker_dialog(title='', multiple=False)
that returns a color be so much easier? -
ui.TableView.row_height is still always -1.
-
Not sure why line 10 gives me an error.
# coding: utf-8 import dialogs import reminders import ui v = ui.load_view('reminders') reminders_table = v['reminders'] def picked(sender): item = sender.items[sender.selected_row] # gives me error r = item['reminder'] r.completed = True r.save() del sender.items[sender.selected_row] def grabbed(): global todo_items, completed_items todo = reminders.get_reminders(completed=False) todo_items = [{'title': r.title, 'reminder': r} for r in todo] done = reminders.get_reminders(completed=True) completed_items = [{'title': r.title, 'reminder': r} for r in done] reminders_table.data_source = ui.ListDataSource(items=todo_items) reminders_table.data_source.action = picked reminders_table.reload() def button_action(sender): if segment.selected_index == 0: reminders_table.data_source = ui.ListDataSource(items=todo_items) reminders_table.data_source.action = picked reminders_table.reload() elif segment.selected_index == 1: reminders_table.data_source = ui.ListDataSource(items=completed_items) reminders_table.data_source.action = picked reminders_table.reload() @ui.in_background def but_action(sender): fields = [{'key' : 'name', 'type' : 'text', 'value' : 'Name your reminder'},] result=dialogs.form_dialog(title='Create a Reminder', fields=fields) r = reminders.Reminder() r.title = result['name'] r.save() segment.selected_index = 0 grabbed() segment = v['segmentedcontrol1'] segment.action = button_action reminders_table.data_source.action = picked create_button = ui.ButtonItem() create_button.image = ui.Image.named('ionicons-ios7-plus-empty-32') create_button.action = but_action grabbed() v.right_button_items = [create_button] v.present('sheet')
-
I've got a bad image loading related bug. If you do this:
import ui imageurl = 'http://s9.postimage.org/n92phj9tr/image1.jpg' v = ui.View() v.background_color = 'white' im = ui.ImageView() im.flex = 'LRTBWH' im.load_from_url(imageurl) v.add_subview(im) v.present()
Then run, cancel, and run again, Pythonista hangs and has to be closed from multitasking, then often the icon has to be pressed twice just to open it again.
-
I've found something that I think is a weird bug...I ran the exact same code on a Windows machine (albeit in Python 3.4) and it worked fine. However in Pythonista it does..well..nothing.
<li>maxchar = 128
<li>charset = range(maxchar)<li>for n in charset:
<li> print "{0:2s} => {1:2s}".format(str(n), chr(n))The problem seems to be in the
for
loop, every time I run the script nothing is printed. I check the value of n and it is equal to 0. I have no idea why.Apologies for the bullet points..it was the only way I could get newlines by insertings list element HTML tags. They wer'nt present in the code. Also the print statement was indented. (I'm terrible at markdown)
-
One thing that is sometimes strange is that certain errors don't show up in the console, but show up as a red dropdown in the filename in the editor. That's what happened when I ran your code. You will notice the filename changes to re, then when you click on it it shows the error. Not sure why some errors show up this way, some show as red arrows, and some show in the console.
As for the specific problem, apparently you cannot print null bytes ( try
print chr(0)
in the console to see the exception).maxchar = 128 charset = range(maxchar) for n in charset: try: print "{0:2s} => {1:2s}".format(str(n), chr(n)) except TypeError: print 'type error with n={}'.format(n)
To properly format code, you want three backticks, on a newline, with a newline before it, and likewise at the end. Note this doesn't show up in the preview. Backticks are annoying on ios, I have a shortcut. You can also just use four leading spaces, on each line following a blank line.