Skip to content

Commit

Permalink
Merge branch 'saera_sync' of github.com:taixzo/saera into saera_sync
Browse files Browse the repository at this point in the history
Conflicts:
	saera2.py
  • Loading branch information
taixzo committed Nov 16, 2016
2 parents e28c59e + 040e388 commit ea1eccb
Show file tree
Hide file tree
Showing 40 changed files with 7,429 additions and 114 deletions.
22 changes: 21 additions & 1 deletion FirstPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Page {

onStatusChanged: {
if (status === PageStatus.Active) {
pageStack.pushAttached(Qt.resolvedUrl("SecondPage.qml"));
pageStack.pushAttached(Qt.resolvedUrl("SecondPage.qml"), {"py":py});
}
}

Expand Down Expand Up @@ -75,6 +75,11 @@ Page {
volume.visible = false;
}

function addSpokenText(msg, img, lat, lon) {
console.log("called")
listModel.append({value:msg, who: "me", link:false, image:"", lat:0, lon:0, spot_preview: ""});
}

function process_spoken_text(res) {
goBusy()
listModel.append({value: res, who: "me", link: false, image: "", lat: 0, lon: 0, spot_preview: ""});
Expand Down Expand Up @@ -185,6 +190,7 @@ Page {
}

function sayRich(message, img, lat, lon) {
// console.log(message + ", " + img + ", "+ lat + ", "+ lon)
var images = {}
images[-3] = "image://theme/icon-direction-hard-left"
images[-2] = "image://theme/icon-direction-left"
Expand Down Expand Up @@ -240,6 +246,7 @@ Page {
setHandler('load_msg', page.load_msg)
setHandler('enablePTP', page.enablePTP)
setHandler('sayRich', page.sayRich)
setHandler('addSpokenText', page.addSpokenText)
setHandler('set_vol', page.set_vol)
setHandler('process_spoken_text', page.process_spoken_text)
setHandler('goBusy', page.goBusy)
Expand Down Expand Up @@ -286,6 +293,16 @@ Page {
delegate: Item {
width: ListView.view.width

MouseArea {
anchors.fill: parent
onClicked: {
if (who=="me") {
inputfield.text = t.text
inputfield.forceActiveFocus()
}
}
}

Image {
id: i
anchors {
Expand All @@ -304,6 +321,7 @@ Page {
rightMargin: lat ? 10 : 0
}
color: "#FFFFFF"
font.pixelSize: Theme.fontSizeMedium
text: lat ? dist(lat, lon) : ""
}

Expand Down Expand Up @@ -331,6 +349,7 @@ Page {
margins: Theme.paddingLarge
}
text: value
font.pixelSize: Theme.fontSizeMedium
wrapMode: Text.Wrap
width: parent.width - 2 * Theme.paddingLarge
horizontalAlignment: who=="me" ? Text.AlignRight : Text.AlignLeft
Expand Down Expand Up @@ -436,6 +455,7 @@ Page {
anchors.top: loadingIndicator.bottom
anchors.horizontalCenter: loadingIndicator.horizontalCenter
text: "Loading"
font.pixelSize: Theme.fontSizeMedium
color: Theme.highlightColor
}

Expand Down
22 changes: 21 additions & 1 deletion SecondPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@

import QtQuick 2.0
import Sailfish.Silica 1.0
import io.thp.pyotherside 1.0


Page {
id: page
id: page2

property Python py

SilicaFlickable {
anchors.fill: parent
Column {
Expand Down Expand Up @@ -92,6 +96,22 @@ Page {
font.pixelSize: Theme.fontSizeLarge
}
}
Row {
width: parent.width
spacing: parent.spacing
x: parent.spacing

TextSwitch {
id: modeSwitch
text: "Enable 24-hour mode"
description: "Currently in 12 hour mode"
onCheckedChanged: {
console.log(checked ? "Checked" : "Unchecked")
modeSwitch.description = "Currently in " + (checked ? "24" : "12") + " hour mode"
py.call('saera2.set_24_hour_mode', [checked], function(res){})
}
}
}
}
}
}
Expand Down
Binary file added flite/cmu_us_clb.flitevox
Binary file not shown.
14 changes: 14 additions & 0 deletions geopy/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""
geopy is a Python 2 and 3 client for several popular geocoding web services.
geopy makes it easy for Python developers to locate the coordinates of
addresses, cities, countries, and landmarks across the globe using third-party
geocoders and other data sources.
geopy is tested against CPython 2.7, CPython 3.2, CPython 3.4, PyPy, and PyPy3.
"""

from geopy.point import Point
from geopy.location import Location
from geopy.geocoders import * # pylint: disable=W0401
from geopy.util import __version__
99 changes: 99 additions & 0 deletions geopy/compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
"""
Compatibility...
"""

import sys

py3k = sys.version_info >= (3, 0)

if py3k: # pragma: no cover
string_compare = str
else: # pragma: no cover
string_compare = (str, unicode)

# Unicode compatibility, borrowed from 'six'
if py3k: # pragma: no cover
def u(s):
"""
Convert to Unicode with py3k
"""
return s
else: # pragma: no cover
def u(s):
"""
Convert to Unicode with unicode escaping
"""
return unicode(s.replace(r'\\', r'\\\\'), 'unicode_escape')

if py3k: # pragma: no cover
from urllib.parse import urlencode, quote # pylint: disable=W0611,F0401,W0611,E0611
from urllib.request import (Request, urlopen, # pylint: disable=W0611,F0401,W0611,E0611
build_opener, ProxyHandler,
URLError, install_opener,
HTTPPasswordMgrWithDefaultRealm,
HTTPBasicAuthHandler)
from urllib.error import HTTPError # pylint: disable=W0611,F0401,W0611,E0611

def itervalues(d):
"""
Function for iterating on values due to methods
renaming between Python 2 and 3 versions
For Python2
"""
return iter(d.values())
def iteritems(d):
"""
Function for iterating on items due to methods
renaming between Python 2 and 3 versions
For Python2
"""
return iter(d.items())

else: # pragma: no cover
from urllib import urlencode as original_urlencode, quote # pylint: disable=W0611,F0401,W0611,E0611
from urllib2 import (Request, HTTPError, # pylint: disable=W0611,F0401,W0611,E0611
ProxyHandler, URLError, urlopen,
build_opener, install_opener,
HTTPPasswordMgrWithDefaultRealm,
HTTPBasicAuthHandler)

def force_str(str_or_unicode):
"""
Python2-only, ensures that a string is encoding to a str.
"""
if isinstance(str_or_unicode, unicode):
return str_or_unicode.encode('utf-8')
else:
return str_or_unicode

def urlencode(query, doseq=0):
"""
A version of Python's urllib.urlencode() function that can operate on
unicode strings. The parameters are first cast to UTF-8 encoded strings
and then encoded as per normal.
Based on the urlencode from django.utils.http
"""
if hasattr(query, 'items'):
query = query.items()
return original_urlencode(
[(force_str(k),
[force_str(i) for i in v]
if isinstance(v, (list, tuple)) else force_str(v))
for k, v in query],
doseq)

def itervalues(d):
"""
Function for iterating on values due to methods
renaming between Python 2 and 3 versions
For Python3
"""
return d.itervalues()
def iteritems(d):
"""
Function for iterating on items due to methods
renaming between Python 2 and 3 versions
For Python3
"""
return d.iteritems()
Loading

0 comments on commit ea1eccb

Please sign in to comment.