Главная » Просмотр файлов » Wiley.Mobile.Python.Rapid.prototyping.of.applications.on.the.mobile.platform.Dec.2007

Wiley.Mobile.Python.Rapid.prototyping.of.applications.on.the.mobile.platform.Dec.2007 (779889), страница 6

Файл №779889 Wiley.Mobile.Python.Rapid.prototyping.of.applications.on.the.mobile.platform.Dec.2007 (Symbian Books) 6 страницаWiley.Mobile.Python.Rapid.prototyping.of.applications.on.the.mobile.platform.Dec.2007 (779889) страница 62018-01-10СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 6)

Have fun with it!INSTALLING PYTHON FOR S60 ON 3RD EDITION DEVICESFigure 2.3 File manager(a)(b)Figure 2.4 Python running on a phone1718GETTING STARTEDFigure 2.5Our script running on the phone2.1.3 Installation for Mac OS X Users1. Install the downloaded .SIS files to your phoneConnect your phone to your computer using the USB cable, then select‘Data transfer’ or ‘Mass storage’ mode on the phone screen. The memorycard of the phone is mounted as an external ‘hard drive’ and its contentcan be accessed by the Finder application on the Mac. You must havethe memory card inserted into your phone.Copy the downloaded installation files to any folder on the memorycard of your phone, for example, to the root.

Safely remove (un-mount)the phone’s drive from your computer in the same way as with anyexternal hard drive.On the phone, open the File Manager application (usually found onthe desktop of the phone or inside a subfolder e.g. ‘Tools’) and go tothe directory of the memory card where you have stored the installationfiles. Click on the installation files. First, install the PyS60 interpreter(PythonForS60) and then the user interface for the PyS60 interpreter(PythonScriptShell). Follow the on-screen instructions on the phone – forinstance, select ‘Yes’ if a security warning appears on the phone screen.Also, make sure the date is set correctly on the phone.After the installation is complete, your phone shows the Python iconon the desktop or inside one of the desktop folders (Figure 2.1).

Yourphone is now ready to execute Python scripts. Let’s prepare a ‘Helloworld’ script.INSTALLING PYTHON FOR S60 ON 3RD EDITION DEVICES192. Write a Python ScriptYou can write a Python script on your computer with any text editor.Useful editors are, for example, SubEthaEdit, TextMate or BBEdit. We donot recommend using Mac’s TextEdit application, as it might place someinvisible characters in your code which throw an error when executingthe script.Write the following line in your text editor:print "Hello world!"After the code is typed, save the file under the name hello.py. Makesure that the file ending is .py and not .txt.The file is now ready to be executed on your phone! You do not haveto build or compile it any way.

However, it must be copied to the phonefirst.3. Upload a Python Script to a PhoneAgain, connect the phone to your computer as an external ‘hard drive’.Create a folder called Python on the phone’s memory card (drive E:)using the Mac’s Finder application. Copy the hello.py file from yourcomputer to the E:\Python folder on the phone.Safely remove (un-mount) the phone as an external hard drive fromthe computer.

You can now test the script.If your Mac has built-in Bluetooth, you can use it to upload thehello.py file to your phone. Click on the Bluetooth icon at the topof the Mac screen (see Figure 2.8), select ‘Browse device’ and chooseyour phone’s nickname from the list (Bluetooth must be switched onon the phone). Then select ‘Browse’ to open a window showing thephone’s memory card E:\. Drag and drop hello.py from the locationin your Finder application to the E:\Python folder in the newly openedwindow. This saves you having to use the USB cable and mount andun-mount the phone as an external ‘hard drive’.4.

Test a Python ScriptStart the PyS60 interpreter by clicking on the Python icon (Figure 2.1) onthe desktop or inside the appropriate subfolder on your phone. Once thePyS60 interpreter has started up, select ‘Options’ (Figure 2.4(a)) and ‘Runscript’ (Figure 2.4(b)). Choose your script name, e:hello.py, from thelist and select ‘OK’.

Your script should now start up and you should seea green line stating Hello world! (Figure 2.5).Congratulations! You have successfully written and executed yourscript with PyS60! To go through all the examples in the book, just repeatsteps 2–4 for each new script. Have fun with it!20GETTING STARTED2.1.4 Installation for Linux UsersWe assume that your computer has either a built-in Bluetooth capabilityor an external Bluetooth dongle. Also, we assume that Bluetooth isdetected correctly by your distribution and you have the obexftp andhcitool programs installed.

In many distributions, they can be installedfrom packages obexftp and bluez-utils.1. Install the downloaded .SIS files to your phoneFirst, enable Bluetooth on your phone. Then, on the command line,execute the following command:hcitool scanThis performs Bluetooth scanning. You should see the name of yourphone in the list, with its Bluetooth address (e.g., 00:17:ED:AC:56:FE).Next, you can upload the SIS files to your phone with the followingcommands:obexftp -b 00:17:ED:AC:56:FE -c E: -p PythonForS60...SISobexftp -b 00:17:ED:AC:56:FE -c E: -p PythonScriptShell...SISReplace the Bluetooth address above with your phone’s actual Bluetooth address.

Also, replace the file names with the actual names of thefiles that you downloaded.On the phone, open the File Manager application (usually found onthe desktop of the phone or inside a subfolder e.g. ‘Tools’) and go tothe root of the memory card. You should see the two files there. Clickon the installation files. First, install the PyS60 interpreter (PythonForS60)and then the user interface for the PyS60 interpreter (PythonScriptShell).Follow the on-screen instructions on the phone – for instance, select ‘Yes’if a security warning appears on the phone screen.

Also, make sure thedate is set correctly on the phone.2. Write a Python ScriptYou can write a Python script on your computer with any text editor.Useful editors are, for example, Vim or Emacs.Write the following line in your text editor:print "Hello world!"After the code is typed, save the file under the name hello.py. Makesure that the file ending is .py and not .txt.The file is now ready to be executed on your phone! You do not haveto build or compile it any way. However, it must be copied to the phonefirst.INSTALLING PYTHON FOR S60 ON 2ND EDITION DEVICES213. Upload a Python Script to a PhoneWe use the same obexftp tool for this as in Step 1. Execute the followingcommand on the command line, replacing the Bluetooth address withyour phone’s actual address:obexftp -b 00:17:ED:AC:56:FE -c E: -C Python -p hello.py4.

Test a Python ScriptStart the PyS60 interpreter by clicking on the Python icon (Figure 2.1) onthe desktop or inside the appropriate subfolder on your phone. Once thePyS60 interpreter has started up, select ‘Options’ (Figure 2.4(a)) and then‘Run script’ (Figure 2.4(b)). Choose your script name, e:hello.py, fromthe list and select ‘OK’.

Your script should now start up and you shouldsee a green line stating Hello world! (Figure 2.5).Congratulations! You have successfully written and executed yourscript with PyS60! To go through all the examples in the book, just repeatsteps 2–4 for each new script. Have fun with it!2.2 Installing Python for S60 on 2nd Edition DevicesWe assume that your computer has either a built-in Bluetooth capabilityor an external Bluetooth dongle. You should have Bluetooth working onyour computer.2.2.1 Download the Installation FilesYou need to download two installation files from the Internet to yourcomputer. You find them at SourceForge’s PyS60 project page, http://sourceforge.net/projects/pys60.

There are many versions of files available on that website. All you need are two files: the PyS60 interpreter andthe user interface for the PyS60 interpreter.The file names consist of four components:• the name• the version number, for example, 1.4.0 (make sure you choose thelatest version, that is, the largest number)• the edition number (in this case, 2ndEd)• the choice of Feature Pack; depending on your phone model, youshould choose files ending with FP2 or FP3 (Table D.1 shows whichis suitable for your phone).22GETTING STARTEDAssuming that version 1.4.0 is the latest version and your phone usesFeature Pack 2, you download PythonForS60 1 4 0 2ndEdFP2.SIS(the PyS60 interpreter) and PythonScriptShell 1 4 0 2ndEdFP2.SIS (the user interface).2.2.2Send the Installation Files to the PhoneYou use Bluetooth to send the files to the phone’s message inbox. Makesure you have switched on Bluetooth on your phone (settings can befound in the ‘Connect’ panel).Windows UsersIn the File Explorer application, go to the location of the installationfiles.

Характеристики

Тип файла
PDF-файл
Размер
3,61 Mb
Материал
Тип материала
Высшее учебное заведение

Список файлов книги

Свежие статьи
Популярно сейчас
Почему делать на заказ в разы дороже, чем купить готовую учебную работу на СтудИзбе? Наши учебные работы продаются каждый год, тогда как большинство заказов выполняются с нуля. Найдите подходящий учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6447
Авторов
на СтудИзбе
306
Средний доход
с одного платного файла
Обучение Подробнее