├── debian ├── compat ├── source │ └── format ├── install ├── control ├── copyright ├── changelog └── rules ├── src └── gqrcode │ ├── mylibs │ ├── __init__.py │ ├── structure.py │ ├── ECC.py │ ├── theqrmodule.py │ ├── draw.py │ ├── data.py │ ├── matrix.py │ └── constant.py │ ├── util.py │ ├── comun.py │ ├── dasync.py │ ├── gif.py │ ├── progreso.py │ ├── myqr.py │ ├── gqrcode.py │ └── mainwindow.py ├── AUTHORS ├── images ├── email.png ├── sms.png ├── text.png ├── vcard.png ├── wifi.png ├── qrcode.png └── geolocation.png ├── .gitmodules ├── data ├── gqrcode.desktop └── icons │ └── gqrcode.svg ├── LICENSE ├── bin └── gqrcode ├── .gitignore ├── README.md └── po ├── eu.po ├── en.po ├── de.po ├── tr.po ├── fr.po ├── it.po ├── ro.po ├── es.po └── gl.po /debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /src/gqrcode/mylibs/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Lorenzo Carbonell Cerezo 2 | -------------------------------------------------------------------------------- /images/email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atareao/gqrcode/HEAD/images/email.png -------------------------------------------------------------------------------- /images/sms.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atareao/gqrcode/HEAD/images/sms.png -------------------------------------------------------------------------------- /images/text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atareao/gqrcode/HEAD/images/text.png -------------------------------------------------------------------------------- /images/vcard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atareao/gqrcode/HEAD/images/vcard.png -------------------------------------------------------------------------------- /images/wifi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atareao/gqrcode/HEAD/images/wifi.png -------------------------------------------------------------------------------- /images/qrcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atareao/gqrcode/HEAD/images/qrcode.png -------------------------------------------------------------------------------- /images/geolocation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atareao/gqrcode/HEAD/images/geolocation.png -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "src/qreader"] 2 | path = src/qreader 3 | url = git@github.com:ewino/qreader.git 4 | -------------------------------------------------------------------------------- /debian/install: -------------------------------------------------------------------------------- 1 | bin/gqrcode /usr/bin 2 | src/gqrcode/*.py /usr/share/gqrcode/gqrcode 3 | src/gqrcode/mylibs/*.py /usr/share/gqrcode/gqrcode/mylibs 4 | data/gqrcode.desktop /usr/share/applications 5 | data/icons/gqrcode.svg /usr/share/icons/hicolor/scalable/apps 6 | debian/changelog /usr/share/gqrcode 7 | -------------------------------------------------------------------------------- /data/gqrcode.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Encoding=UTF-8 3 | Name=gqrcode 4 | Version=0.1.3 5 | Comment=A graphical interface to create and read QRcode 6 | Comment[es]=Un interfaz gráfico para leer y escribir códigos QRCode 7 | GenericName=gqrcode 8 | Terminal=false 9 | Icon=gqrcode 10 | Type=Application 11 | Exec=/usr/bin/gqrcode 12 | Categories=Utility; 13 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: gqrcode 2 | Section: utils 3 | Priority: extra 4 | Maintainer: Lorenzo Carbonell Cerezo 5 | Build-Depends: debhelper (>= 9) 6 | Standards-Version: 3.9.5 7 | Homepage: http://www.atareao.es 8 | 9 | Package: gqrcode 10 | Architecture: all 11 | Depends: ${misc:Depends}, ${python:Depends}, 12 | python3, 13 | python3-gi, 14 | python3-pil, 15 | python3-requests, 16 | gir1.2-gtk-3.0, 17 | gir1.2-gdkpixbuf-2.0, 18 | gir1.2-osmgpsmap-1.0, 19 | zbar-tools 20 | Description: An application to create and decode QR Codes 21 | gqrcode is a very simple application that can create QR codes. This codes 22 | can have background, and can be animated QR codes. There are posibilities to 23 | create codes for simple text, geolocations, telephone number, email, url, 24 | WiFi Login, SMS, email messages and vCards. 25 | -------------------------------------------------------------------------------- /src/gqrcode/mylibs/structure.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from .constant import required_remainder_bits, lindex, grouping_list 4 | 5 | def structure_final_bits(ver, ecl, data_codewords, ecc): 6 | final_message = interleave_dc(ver, ecl, data_codewords) + interleave_ecc(ecc) 7 | 8 | # convert to binary & Add Remainder Bits if Necessary 9 | final_bits = ''.join(['0'*(8-len(i))+i for i in [bin(i)[2:] for i in final_message]]) + '0' * required_remainder_bits[ver-1] 10 | 11 | return final_bits 12 | 13 | def interleave_dc(ver, ecl, data_codewords): 14 | id = [] 15 | for t in zip(*data_codewords): 16 | id += list(t) 17 | g = grouping_list[ver-1][lindex[ecl]] 18 | if g[3]: 19 | for i in range(g[2]): 20 | id.append(data_codewords[i-g[2]][-1]) 21 | return id 22 | 23 | def interleave_ecc(ecc): 24 | ie = [] 25 | for t in zip(*ecc): 26 | ie += list(t) 27 | return ie 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2012-2019 Lorenzo Carbonell Cerezo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/gqrcode/mylibs/ECC.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from .constant import GP_list, ecc_num_per_block, lindex, po2, log 4 | 5 | #ecc: Error Correction Codewords 6 | def encode(ver, ecl, data_codewords): 7 | en = ecc_num_per_block[ver-1][lindex[ecl]] 8 | ecc = [] 9 | for dc in data_codewords: 10 | ecc.append(get_ecc(dc, en)) 11 | return ecc 12 | 13 | def get_ecc(dc, ecc_num): 14 | gp = GP_list[ecc_num] 15 | remainder = dc 16 | for i in range(len(dc)): 17 | remainder = divide(remainder, *gp) 18 | return remainder 19 | 20 | def divide(MP, *GP): 21 | if MP[0]: 22 | GP = list(GP) 23 | for i in range(len(GP)): 24 | GP[i] += log[MP[0]] 25 | if GP[i] > 255: 26 | GP[i] %= 255 27 | GP[i] = po2[GP[i]] 28 | return XOR(GP, *MP) 29 | else: 30 | return XOR([0]*len(GP), *MP) 31 | 32 | 33 | def XOR(GP, *MP): 34 | MP = list(MP) 35 | a = len(MP) - len(GP) 36 | if a < 0: 37 | MP += [0] * (-a) 38 | elif a > 0: 39 | GP += [0] * a 40 | 41 | remainder = [] 42 | for i in range(1, len(MP)): 43 | remainder.append(MP[i]^GP[i]) 44 | return remainder 45 | -------------------------------------------------------------------------------- /bin/gqrcode: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # -*- coding: UTF-8 -*- 3 | # 4 | # GQRCode 5 | # 6 | # Copyright (C) 2011-2016 Lorenzo Carbonell Cerezo 7 | # lorenzo.carbonell.cerezo@gmail.com 8 | # 9 | # This program is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program. If not, see . 21 | # 22 | # 23 | # 24 | import os 25 | import sys 26 | 27 | USRDIR = '/usr' 28 | SHAREDIR = os.path.join(USRDIR, 'share', 'gqrcode') 29 | CURRENTDIR = os.path.abspath(os.path.dirname(__file__)) 30 | 31 | if __name__ == '__main__': 32 | print(CURRENTDIR) 33 | if CURRENTDIR.startswith(USRDIR): 34 | sys.path.append(SHAREDIR) 35 | else: 36 | sys.path.append(os.path.normpath(os.path.join(CURRENTDIR, '../src'))) 37 | from gqrcode.gqrcode import main 38 | 39 | main() 40 | exit(0) 41 | -------------------------------------------------------------------------------- /src/gqrcode/mylibs/theqrmodule.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from . import data, ECC, structure, matrix, draw 4 | 5 | # ver: Version from 1 to 40 6 | # ecl: Error Correction Level (L,M,Q,H) 7 | # get a qrcode picture of 3*3 pixels per module 8 | 9 | 10 | def get_qrcode(ver, ecl, toencode, save_place): 11 | # Data Coding 12 | ver, data_codewords = data.encode(ver, ecl, toencode) 13 | # Error Correction Coding 14 | ecc = ECC.encode(ver, ecl, data_codewords) 15 | # Structure final bits 16 | final_bits = structure.structure_final_bits(ver, ecl, data_codewords, ecc) 17 | # Get the QR Matrix 18 | qrmatrix = matrix.get_qrmatrix(ver, ecl, final_bits) 19 | # Draw the picture and Save it, then return the real ver and the absolute 20 | # name 21 | return ver, draw.draw_qrcode(save_place, qrmatrix) 22 | 23 | 24 | def get_qrcode_pilimage(ver, ecl, toencode): 25 | # Data Coding 26 | ver, data_codewords = data.encode(ver, ecl, toencode) 27 | # Error Correction Coding 28 | ecc = ECC.encode(ver, ecl, data_codewords) 29 | # Structure final bits 30 | final_bits = structure.structure_final_bits(ver, ecl, data_codewords, ecc) 31 | # Get the QR Matrix 32 | qrmatrix = matrix.get_qrmatrix(ver, ecl, final_bits) 33 | # Draw the picture and Save it, then return the real ver and the absolute 34 | # name 35 | return ver, draw.draw_qrcode_to_pilimage(qrmatrix) 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | 27 | # PyInstaller 28 | # Usually these files are written by a python script from a template 29 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 30 | *.manifest 31 | *.spec 32 | 33 | # Installer logs 34 | pip-log.txt 35 | pip-delete-this-directory.txt 36 | 37 | # Unit test / coverage reports 38 | htmlcov/ 39 | .tox/ 40 | .coverage 41 | .coverage.* 42 | .cache 43 | nosetests.xml 44 | coverage.xml 45 | *,cover 46 | .hypothesis/ 47 | 48 | # Translations 49 | *.mo 50 | *.pot 51 | 52 | # Django stuff: 53 | *.log 54 | local_settings.py 55 | 56 | # Flask instance folder 57 | instance/ 58 | 59 | # Scrapy stuff: 60 | .scrapy 61 | 62 | # Sphinx documentation 63 | docs/_build/ 64 | 65 | # PyBuilder 66 | target/ 67 | 68 | # IPython Notebook 69 | .ipynb_checkpoints 70 | 71 | # pyenv 72 | .python-version 73 | 74 | # celery beat schedule file 75 | celerybeat-schedule 76 | 77 | # dotenv 78 | .env 79 | 80 | # virtualenv 81 | venv/ 82 | ENV/ 83 | 84 | # Spyder project settings 85 | .spyderproject 86 | 87 | # Rope project settings 88 | .ropeproject 89 | 90 | # Builder 91 | debian/files 92 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | This work was packaged for Debian by: 2 | 3 | Lorenzo Carbonell on Mon, 07 Jun 2010 06:25:19 +0200 4 | 5 | It was downloaded from: 6 | 7 | http://www.atareao.es 8 | 9 | Upstream Author(s): 10 | 11 | Lorenzo Carbonell 12 | 13 | Copyright: 14 | 15 | 16 | 17 | License: 18 | 19 | This program is free software: you can redistribute it and/or modify 20 | it under the terms of the GNU General Public License as published by 21 | the Free Software Foundation, either version 3 of the License, or 22 | (at your option) any later version. 23 | 24 | This package is distributed in the hope that it will be useful, 25 | but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | GNU General Public License for more details. 28 | 29 | You should have received a copy of the GNU General Public License 30 | along with this program. If not, see . 31 | 32 | On Debian systems, the complete text of the GNU General 33 | Public License version 3 can be found in `/usr/share/common-licenses/GPL-3'. 34 | 35 | The Debian packaging is: 36 | 37 | Copyright (C) 2010 Lorenzo Carbonell 38 | 39 | # Please chose a license for your packaging work. If the program you package 40 | # uses a mainstream license, using the same license is the safest choice. 41 | # Please avoid to pick license terms that are more restrictive than the 42 | # packaged work, as it may make Debian's contributions unacceptable upstream. 43 | # If you just want it to be GPL version 3, leave the following line in. 44 | 45 | and is licensed under the GPL version 3, see above. 46 | 47 | # Please also look if there are files or directories which have a 48 | # different copyright/license attached and list them here. 49 | -------------------------------------------------------------------------------- /src/gqrcode/util.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # This file is part of GQRCode 5 | # 6 | # Copyright (c) 2012-2019 Lorenzo Carbonell Cerezo 7 | # 8 | # Permission is hereby granted, free of charge, to any person obtaining a copy 9 | # of this software and associated documentation files (the "Software"), to deal 10 | # in the Software without restriction, including without limitation the rights 11 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | # copies of the Software, and to permit persons to whom the Software is 13 | # furnished to do so, subject to the following conditions: 14 | # 15 | # The above copyright notice and this permission notice shall be included in all 16 | # copies or substantial portions of the Software. 17 | # 18 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | # SOFTWARE. 25 | import gi 26 | try: 27 | gi.require_version('GdkPixbuf', '2.0') 28 | except Exception as e: 29 | print(e) 30 | exit(1) 31 | from gi.repository import GdkPixbuf 32 | import requests 33 | import json 34 | 35 | 36 | def get_latitude_longitude(): 37 | try: 38 | response = requests.get('http://ip-api.com/json') 39 | if response.status_code == 200: 40 | ans = json.loads(response.text) 41 | return ans['lat'], ans['lon'] 42 | except Exception as e: 43 | print(e) 44 | return 0, 0 45 | 46 | 47 | def update_preview_cb(file_chooser, preview): 48 | filename = file_chooser.get_preview_filename() 49 | try: 50 | pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(filename, 128, 128) 51 | preview.set_from_pixbuf(pixbuf) 52 | have_preview = True 53 | except Exception as e: 54 | print(e) 55 | have_preview = False 56 | file_chooser.set_preview_widget_active(have_preview) 57 | return 58 | 59 | if __name__ == '__main__': 60 | ll = get_latitude_longitude() 61 | if ll is not None: 62 | print(ll) 63 | exit(0) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Welcome to GQRCode 👋 2 | 3 | ![Version](https://img.shields.io/badge/version-0.5.3-blue.svg?cacheSeconds=2592000) 4 | [![Documentation](https://img.shields.io/badge/documentation-yes-brightgreen.svg)](https://www.atareao.es/aplicacion/crear-codigos-qr-en-ubuntu/) 5 | [![Twitter: atareao](https://img.shields.io/twitter/follow/atareao.svg?style=social)](https://twitter.com/atareao) 6 | 7 | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/0b82a753282f4e59bfc1ac03bf4ad120)](https://www.codacy.com/manual/atareao/gqrcode?utm_source=github.com&utm_medium=referral&utm_content=atareao/gqrcode&utm_campaign=Badge_Grade) 8 | [![CodeFactor](https://www.codefactor.io/repository/github/atareao/gqrcode/badge)](https://www.codefactor.io/repository/github/atareao/gqrcode) 9 | 10 | Create your own QR Codes for everything you want 11 | 12 | > gqrcode is a very simple application that can create QR codes. This codes can have background, and can be animated QR codes. There are posibilities to create codes for simple text, geolocations, telephone number, email, url, WiFi Login, SMS, email messages and vCards... 13 | 14 | ## 🏠 [Homepage](https://www.atareao.es/aplicacion/crear-codigos-qr-en-ubuntu/) 15 | 16 | ## Install 17 | 18 | This applicaciont isn't in the Software Center of Ubuntu, but you can install it from personal repository. Open a terminal and run this commands. 19 | 20 | ```sh 21 | sudo add-apt-repository ppa:atareao/atareao 22 | sudo apt-get update 23 | sudo apt-get install gqrcode 24 | ``` 25 | 26 | ### Required dependecies 27 | 28 | If you install this application from PPA Repository don't worry about install dependencies 29 | 30 | ``` 31 | python3, 32 | python3-gi, 33 | python3-pil, 34 | python3-requests, 35 | gir1.2-gtk-3.0, 36 | gir1.2-gdkpixbuf-2.0, 37 | gir1.2-osmgpsmap-1.0, 38 | zbar-tools 39 | ``` 40 | 41 | ### Run this app 42 | 43 | ![Geolocation](images/geolocation.png) 44 | 45 | ![Email](images/email.png) 46 | 47 | ![SMS](images/sms.png) 48 | 49 | ![Text](images/text.png) 50 | 51 | ![VCard](images/vcard.png) 52 | 53 | ![Wifi Passwords](images/wifi.png) 54 | 55 | And the final result 56 | 57 | ![QR Code](images/qrcode.png) 58 | 59 | ## Author 60 | 61 | 👤 **Lorenzo Carbonell (a.k.a. atareao)** 62 | 63 | * Twitter: [@atareao](https://twitter.com/atareao) 64 | * Github: [@atareao](https://github.com/atareao) 65 | 66 | ## 🤝 Contributing 67 | 68 | Contributions, issues and feature requests are welcome!
Feel free to check [issues page](https://github.com/atareao/gqrcode/issues/). 69 | 70 | ## Show your support 71 | 72 | Give a ⭐️ if this project helped you! 73 | -------------------------------------------------------------------------------- /src/gqrcode/mylibs/draw.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import gi 3 | try: 4 | gi.require_version('GLib', '2.0') 5 | gi.require_version('GdkPixbuf', '2.0') 6 | except Exception as e: 7 | print(e) 8 | exit(1) 9 | from gi.repository import GLib 10 | from gi.repository import GdkPixbuf 11 | from PIL import Image 12 | import os 13 | 14 | 15 | def image2pixbuf(image): 16 | data = image.tobytes() 17 | w, h = image.size 18 | data = GLib.Bytes.new(data) 19 | if image.mode == 'RGB': 20 | return GdkPixbuf.Pixbuf.new_from_bytes(data, GdkPixbuf.Colorspace.RGB, 21 | False, 8, w, h, w * 3) 22 | elif image.mode == '1': 23 | print(5) 24 | image = image.convert('RGBA') 25 | data = image.tobytes() 26 | w, h = image.size 27 | data = GLib.Bytes.new(data) 28 | return GdkPixbuf.Pixbuf.new_from_bytes(data, 29 | GdkPixbuf.Colorspace.RGB, 30 | True, 8, w, h, w * 4) 31 | else: 32 | print(3) 33 | print(image.mode) 34 | print(type(image), image.mode, '----') 35 | print(4) 36 | return GdkPixbuf.Pixbuf.new_from_bytes(data, GdkPixbuf.Colorspace.RGB, 37 | True, 8, w, h, w * 4) 38 | 39 | 40 | def pixbuf2image(pixbuf): 41 | data = pixbuf.get_pixels() 42 | w = pixbuf.props.width 43 | h = pixbuf.props.height 44 | stride = pixbuf.props.rowstride 45 | if pixbuf.props.has_alpha is True: 46 | mode = 'RGBA' 47 | else: 48 | mode = 'RGB' 49 | return Image.frombytes(mode, (w, h), data, 'raw', mode, stride) 50 | 51 | 52 | def draw_qrcode_to_pilimage(qrmatrix): 53 | unit_len = 10 54 | x = y = 4*unit_len 55 | pic = Image.new('1', [(len(qrmatrix)+8)*unit_len]*2, 'white') 56 | 57 | for line in qrmatrix: 58 | for module in line: 59 | if module: 60 | draw_a_black_unit(pic, x, y, unit_len) 61 | x += unit_len 62 | x, y = 4*unit_len, y+unit_len 63 | return pic 64 | 65 | 66 | def draw_qrcode(abspath, qrmatrix): 67 | unit_len = 3 68 | x = y = 4*unit_len 69 | pic = Image.new('1', [(len(qrmatrix)+8)*unit_len]*2, 'white') 70 | 71 | for line in qrmatrix: 72 | for module in line: 73 | if module: 74 | draw_a_black_unit(pic, x, y, unit_len) 75 | x += unit_len 76 | x, y = 4*unit_len, y+unit_len 77 | 78 | saving = os.path.join(abspath, 'qrcode.png') 79 | pic.save(saving) 80 | return saving 81 | 82 | 83 | def draw_a_black_unit(p, x, y, ul): 84 | for i in range(ul): 85 | for j in range(ul): 86 | p.putpixel((x + i, y + j), 0) 87 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | gqrcode (0.5.3-0extras19.10.02) eoan; urgency=medium 2 | 3 | * Clea 4 | * Fix ip location 5 | 6 | -- Lorenzo Carbonell Sun, 27 Oct 2019 20:22:58 +0100 7 | 8 | gqrcode (0.5.2-0extras17.04.1) zesty; urgency=medium 9 | 10 | * None found 11 | * Fixed bugs 12 | 13 | -- Lorenzo Carbonell Wed, 09 Aug 2017 13:13:46 +0200 14 | 15 | gqrcode (0.5.1-0extras17.04.0) zesty; urgency=medium 16 | 17 | * Updated translations 18 | * Updated tools 19 | 20 | -- Lorenzo Carbonell Thu, 27 Jul 2017 11:40:20 +0200 21 | 22 | gqrcode (0.5.0-0extras17.04.5) zesty; urgency=medium 23 | 24 | * parse 25 | * removed dh_python 26 | 27 | -- Lorenzo Carbonell Thu, 27 Jul 2017 10:14:58 +0200 28 | 29 | gqrcode (0.4.1-0extras17.04.3) zesty; urgency=medium 30 | 31 | * Loop in gifs 32 | * Ñ-ñ 33 | 34 | -- Lorenzo Carbonell Fri, 30 Jun 2017 19:26:30 +0200 35 | 36 | gqrcode (0.4.0-0extras17.04.6) zesty; urgency=medium 37 | 38 | * Create QRs with background 39 | * Create animated QRs 40 | * Added CVcard 41 | * Improved geolocation 42 | * Added work in background 43 | 44 | -- Lorenzo Carbonell Thu, 29 Jun 2017 15:57:56 +0200 45 | 46 | gqrcode (0.3.0-1ubuntu1) wily; urgency=medium 47 | 48 | * Added geolocation 49 | * Added plain text 50 | * Added telephone number 51 | * Added email 52 | * Added url 53 | * Added wifi login 54 | 55 | -- Lorenzo Carbonell Sun, 10 Apr 2016 23:46:10 +0200 56 | 57 | gqrcode (0.2.0-1ubuntu5) wily; urgency=medium 58 | 59 | * Ported to wily 60 | 61 | -- Lorenzo Carbonell Mon, 29 Feb 2016 22:36:23 +0100 62 | 63 | gqrcode (0.1.5-1ubuntu1) oneiric; urgency=low 64 | 65 | * Ported to PyGObject 66 | * Using python-encode to create QRCodes 67 | 68 | -- Lorenzo Carbonell Sat, 18 Feb 2012 09:16:38 +0100 69 | 70 | gqrcode (0.1.4-1ubuntu1) maverick; urgency=low 71 | 72 | * Fixed a bug with codification 73 | 74 | -- Lorenzo Mon, 28 Mar 2011 06:46:04 +0200 75 | 76 | gqrcode (0.1.3-1ubuntu1) maverick; urgency=low 77 | 78 | * Fixed a bug with desktop launcher 79 | 80 | -- Lorenzo Sun, 27 Mar 2011 22:46:16 +0200 81 | 82 | gqrcode (0.1.2-1ubuntu1) maverick; urgency=low 83 | 84 | * Fixed a bug with english language added galician language 85 | 86 | -- Lorenzo Sun, 27 Mar 2011 11:13:29 +0200 87 | 88 | gqrcode (0.1.1-1ubuntu1) maverick; urgency=low 89 | 90 | * Fixed a bug with gqrcode extension 91 | 92 | -- Lorenzo Sun, 27 Mar 2011 11:01:26 +0200 93 | 94 | gqrcode (0.1.0-1ubuntu1) maverick; urgency=low 95 | 96 | * First release of gqrcode 97 | 98 | -- Lorenzo Sun, 27 Mar 2011 10:28:00 +0100 99 | -------------------------------------------------------------------------------- /src/gqrcode/comun.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # This file is part of GQRCode 5 | # 6 | # Copyright (c) 2012-2019 Lorenzo Carbonell Cerezo 7 | # 8 | # Permission is hereby granted, free of charge, to any person obtaining a copy 9 | # of this software and associated documentation files (the "Software"), to deal 10 | # in the Software without restriction, including without limitation the rights 11 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | # copies of the Software, and to permit persons to whom the Software is 13 | # furnished to do so, subject to the following conditions: 14 | # 15 | # The above copyright notice and this permission notice shall be included in all 16 | # copies or substantial portions of the Software. 17 | # 18 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | # SOFTWARE. 25 | 26 | import os 27 | import sys 28 | import locale 29 | import gettext 30 | 31 | 32 | def is_package(): 33 | return __file__.find('src') < 0 34 | 35 | ###################################### 36 | 37 | 38 | APP = 'gqrcode' 39 | APPNAME = 'GQRCode' 40 | 41 | # check if running from source 42 | if is_package(): 43 | ROOTDIR = '/usr/share' 44 | LANGDIR = os.path.join(ROOTDIR, 'locale-langpack') 45 | APPDIR = os.path.join(ROOTDIR, APP) 46 | CHANGELOG = os.path.join(ROOTDIR, 'gqrcode', 'changelog') 47 | ICONDIR = os.path.join(ROOTDIR, 'icons', 'hicolor', 'scalable', 'apps') 48 | ICON = os.path.join(ICONDIR, 'gqrcode.svg') 49 | else: 50 | ROOTDIR = os.path.dirname(__file__) 51 | LANGDIR = os.path.normpath(os.path.join(ROOTDIR, '../../template1')) 52 | APPDIR = ROOTDIR 53 | DEBIANDIR = os.path.normpath(os.path.join(ROOTDIR, '../../debian')) 54 | CHANGELOG = os.path.join(DEBIANDIR, 'changelog') 55 | ICON = os.path.normpath(os.path.join(ROOTDIR, 56 | '../../data/icons/gqrcode.svg')) 57 | 58 | HTML_WAI = os.path.join(APPDIR, 'whereami.html') 59 | 60 | f = open(CHANGELOG, 'r') 61 | line = f.readline() 62 | f.close() 63 | pos = line.find('(') 64 | posf = line.find(')', pos) 65 | VERSION = line[pos + 1:posf].strip() 66 | if not is_package(): 67 | VERSION = VERSION + '-src' 68 | 69 | #### 70 | try: 71 | current_locale, encoding = locale.getdefaultlocale() 72 | language = gettext.translation(APP, LANGDIR, [current_locale]) 73 | language.install() 74 | print(language) 75 | if sys.version_info[0] == 3: 76 | _ = language.gettext 77 | else: 78 | _ = language.ugettext 79 | except Exception as e: 80 | print(e) 81 | _ = str 82 | APPNAME = _(APPNAME) 83 | -------------------------------------------------------------------------------- /src/gqrcode/dasync.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # This file is part of GQRCode 5 | # 6 | # Copyright (c) 2012-2019 Lorenzo Carbonell Cerezo 7 | # 8 | # Permission is hereby granted, free of charge, to any person obtaining a copy 9 | # of this software and associated documentation files (the "Software"), to deal 10 | # in the Software without restriction, including without limitation the rights 11 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | # copies of the Software, and to permit persons to whom the Software is 13 | # furnished to do so, subject to the following conditions: 14 | # 15 | # The above copyright notice and this permission notice shall be included in all 16 | # copies or substantial portions of the Software. 17 | # 18 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | # SOFTWARE. 25 | 26 | import gi 27 | try: 28 | gi.require_version('GLib', '2.0') 29 | except Exception as e: 30 | print(e) 31 | exit(1) 32 | from gi.repository import GLib 33 | import threading 34 | import traceback 35 | 36 | __all__ = ['async_function'] 37 | 38 | 39 | def _async_call(f, args, kwargs, on_done): 40 | def run(data): 41 | f, args, kwargs, on_done = data 42 | error = None 43 | result = None 44 | try: 45 | result = f(*args, **kwargs) 46 | except Exception as e: 47 | e.traceback = traceback.format_exc() 48 | error = 'Unhandled exception in asyn call:\n{}'.format(e.traceback) 49 | GLib.idle_add(lambda: on_done(result, error)) 50 | 51 | data = f, args, kwargs, on_done 52 | thread = threading.Thread(target=run, args=(data,)) 53 | thread.daemon = True 54 | thread.start() 55 | 56 | 57 | def async_function(on_done=None): 58 | ''' 59 | A decorator that can be used on free functions so they will always be 60 | called asynchronously. The decorated function should not use any resources 61 | shared by the main thread. 62 | 63 | Example: 64 | def do_async_stuff(self, input_string): 65 | def on_async_done(result, error): 66 | # Do stuff with the result and handle errors in the main thread. 67 | if error: 68 | print(error) 69 | elif result: 70 | print(result) 71 | 72 | @async_function(on_done=on_async_done) 73 | def do_expensive_stuff_in_thread(input_string): 74 | # Pretend to do expensive stuff... 75 | time.sleep(10) 76 | stuff = input_string + ' Done in a different thread' 77 | return stuff 78 | 79 | do_expensive_stuff_in_thread(input_string) 80 | ''' 81 | 82 | def wrapper(f): 83 | def run(*args, **kwargs): 84 | _async_call(f, args, kwargs, on_done) 85 | return run 86 | return wrapper 87 | -------------------------------------------------------------------------------- /src/gqrcode/gif.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # This file is part of GQRCode 5 | # 6 | # Copyright (c) 2012-2019 Lorenzo Carbonell Cerezo 7 | # 8 | # Permission is hereby granted, free of charge, to any person obtaining a copy 9 | # of this software and associated documentation files (the "Software"), to deal 10 | # in the Software without restriction, including without limitation the rights 11 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | # copies of the Software, and to permit persons to whom the Software is 13 | # furnished to do so, subject to the following conditions: 14 | # 15 | # The above copyright notice and this permission notice shall be included in all 16 | # copies or substantial portions of the Software. 17 | # 18 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | # SOFTWARE. 25 | 26 | from PIL import Image 27 | 28 | ''' 29 | https://gist.github.com/BigglesZX/4016539 30 | ''' 31 | 32 | 33 | def analyseImage(filename): 34 | ''' 35 | Pre-press pass over the image to determine the mode (full or additive). 36 | Necessary as assessing single frames isn't reliable. Need to know the mode 37 | before processing all frames. 38 | ''' 39 | im = Image.open(filename) 40 | results = { 41 | 'size': im.size, 42 | 'mode': 'full', 43 | } 44 | try: 45 | while True: 46 | if im.tile: 47 | tile = im.tile[0] 48 | update_region = tile[1] 49 | update_region_dimensions = update_region[2:] 50 | if update_region_dimensions != im.size: 51 | results['model'] = 'parcial' 52 | break 53 | im.seek(im.tell() + 1) 54 | except EOFError as e: 55 | print(e) 56 | return results 57 | 58 | 59 | def get_frames(filename): 60 | ''' 61 | Iterate the GIF, extracting each frame as PIL.Image 62 | ''' 63 | mode = analyseImage(filename)['mode'] 64 | image = Image.open(filename) 65 | i = 0 66 | p = image.getpalette() 67 | last_frame = image.convert('RGBA') 68 | try: 69 | frames = [] 70 | while True: 71 | print('Reading image {0}, mode:{1}'.format(i, mode)) 72 | if not image.getpalette(): 73 | image.putpalette(p) 74 | new_frame = Image.new('RGBA', image.size) 75 | if mode == 'partial': 76 | new_frame.paset(last_frame) 77 | new_frame.paste(image, (0, 0), image.convert('RGBA')) 78 | frames.append(new_frame) 79 | i += 1 80 | last_frame = new_frame 81 | image.seek(image.tell() + 1) 82 | except EOFError as e: 83 | print(e) 84 | return frames 85 | 86 | 87 | def main(): 88 | print(get_frames('/home/lorenzo/Escritorio/bee.gif')) 89 | 90 | 91 | if __name__ == '__main__': 92 | main() 93 | exit(0) 94 | -------------------------------------------------------------------------------- /data/icons/gqrcode.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 21 | 22 | 24 | image/svg+xml 25 | 27 | 28 | 29 | 30 | 31 | 33 | 35 | 39 | 43 | 47 | 48 | 58 | 59 | 83 | 90 | 95 | 96 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # Sample debian/rules that uses debhelper. 3 | # This file is public domain software, originally written by Joey Hess. 4 | # 5 | # This version is for packages that are architecture independent. 6 | 7 | # Uncomment this to turn on verbose mode. 8 | #export DH_VERBOSE=1 9 | 10 | build: build-stamp 11 | build-stamp: 12 | dh_testdir 13 | 14 | # Add here commands to compile the package. 15 | #$(MAKE) 16 | 17 | touch build-stamp 18 | 19 | clean: 20 | dh_testdir 21 | dh_testroot 22 | rm -f build-stamp 23 | 24 | # Add here commands to clean up after the build process. 25 | #$(MAKE) clean 26 | #$(MAKE) distclean 27 | 28 | dh_clean 29 | 30 | install: build 31 | dh_testdir 32 | dh_testroot 33 | dh_prep 34 | dh_installdirs 35 | dh_install 36 | # Create languages directories 37 | mkdir -p ${CURDIR}/debian/gqrcode/usr/share/locale-langpack/de/LC_MESSAGES 38 | mkdir -p ${CURDIR}/debian/gqrcode/usr/share/locale-langpack/en/LC_MESSAGES 39 | mkdir -p ${CURDIR}/debian/gqrcode/usr/share/locale-langpack/es/LC_MESSAGES 40 | mkdir -p ${CURDIR}/debian/gqrcode/usr/share/locale-langpack/eu/LC_MESSAGES 41 | mkdir -p ${CURDIR}/debian/gqrcode/usr/share/locale-langpack/fr/LC_MESSAGES 42 | mkdir -p ${CURDIR}/debian/gqrcode/usr/share/locale-langpack/gl/LC_MESSAGES 43 | mkdir -p ${CURDIR}/debian/gqrcode/usr/share/locale-langpack/it/LC_MESSAGES 44 | mkdir -p ${CURDIR}/debian/gqrcode/usr/share/locale-langpack/ro/LC_MESSAGES 45 | mkdir -p ${CURDIR}/debian/gqrcode/usr/share/locale-langpack/tr/LC_MESSAGES 46 | # End create languages directories 47 | # Compile languages 48 | msgfmt po/de.po -o ${CURDIR}/debian/gqrcode/usr/share/locale-langpack/de/LC_MESSAGES/gqrcode.mo 49 | msgfmt po/en.po -o ${CURDIR}/debian/gqrcode/usr/share/locale-langpack/en/LC_MESSAGES/gqrcode.mo 50 | msgfmt po/es.po -o ${CURDIR}/debian/gqrcode/usr/share/locale-langpack/es/LC_MESSAGES/gqrcode.mo 51 | msgfmt po/eu.po -o ${CURDIR}/debian/gqrcode/usr/share/locale-langpack/eu/LC_MESSAGES/gqrcode.mo 52 | msgfmt po/fr.po -o ${CURDIR}/debian/gqrcode/usr/share/locale-langpack/fr/LC_MESSAGES/gqrcode.mo 53 | msgfmt po/gl.po -o ${CURDIR}/debian/gqrcode/usr/share/locale-langpack/gl/LC_MESSAGES/gqrcode.mo 54 | msgfmt po/it.po -o ${CURDIR}/debian/gqrcode/usr/share/locale-langpack/it/LC_MESSAGES/gqrcode.mo 55 | msgfmt po/ro.po -o ${CURDIR}/debian/gqrcode/usr/share/locale-langpack/ro/LC_MESSAGES/gqrcode.mo 56 | msgfmt po/tr.po -o ${CURDIR}/debian/gqrcode/usr/share/locale-langpack/tr/LC_MESSAGES/gqrcode.mo 57 | # End comile languages 58 | # Add here commands to install the package into debian/. 59 | #$(MAKE) prefix=`pwd`/debian/`dh_listpackages`/usr install 60 | 61 | # Build architecture-independent files here. 62 | binary-indep: build install 63 | dh_testdir 64 | dh_testroot 65 | dh_installchangelogs 66 | dh_installdocs 67 | dh_installexamples 68 | # added gconf and icons 69 | dh_gconf 70 | dh_icons 71 | # dh_installmenu 72 | # dh_installdebconf 73 | # dh_installlogrotate 74 | # dh_installemacsen 75 | # dh_installcatalogs 76 | # dh_installpam 77 | # dh_installmime 78 | # dh_installinit 79 | # dh_installcron 80 | # dh_installinfo 81 | # dh_installwm 82 | # dh_installudev 83 | # dh_lintian 84 | # dh_bugfiles 85 | # dh_undocumented 86 | dh_installman 87 | dh_link 88 | dh_compress 89 | dh_fixperms 90 | # dh_perl 91 | # dh_pysupport 92 | dh_installdeb 93 | dh_gencontrol 94 | dh_md5sums 95 | dh_builddeb 96 | 97 | # Build architecture-dependent files here. 98 | binary-arch: build install 99 | # We have nothing to do by default. 100 | 101 | binary: binary-indep binary-arch 102 | .PHONY: build clean binary-indep binary-arch binary install 103 | -------------------------------------------------------------------------------- /src/gqrcode/mylibs/data.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from .constant import char_cap, required_bytes, mindex, lindex, num_list, alphanum_list, grouping_list, mode_indicator 4 | 5 | # ecl: Error Correction Level(L,M,Q,H) 6 | def encode(ver, ecl, str): 7 | mode_encoding = { 8 | 'numeric': numeric_encoding, 9 | 'alphanumeric': alphanumeric_encoding, 10 | 'byte': byte_encoding, 11 | 'kanji': kanji_encoding 12 | } 13 | 14 | ver, mode = analyse(ver, ecl, str) 15 | 16 | print('line 16: mode:', mode) 17 | 18 | code = mode_indicator[mode] + get_cci(ver, mode, str) + mode_encoding[mode](str) 19 | 20 | # Add a Terminator 21 | rqbits = 8 * required_bytes[ver-1][lindex[ecl]] 22 | b = rqbits - len(code) 23 | code += '0000' if b >= 4 else '0' * b 24 | 25 | # Make the Length a Multiple of 8 26 | while len(code) % 8 != 0: 27 | code += '0' 28 | 29 | # Add Pad Bytes if the String is Still too Short 30 | while len(code) < rqbits: 31 | code += '1110110000010001' if rqbits - len(code) >= 16 else '11101100' 32 | 33 | data_code = [code[i:i+8] for i in range(len(code)) if i%8 == 0] 34 | data_code = [int(i,2) for i in data_code] 35 | 36 | g = grouping_list[ver-1][lindex[ecl]] 37 | data_codewords, i = [], 0 38 | for n in range(g[0]): 39 | data_codewords.append(data_code[i:i+g[1]]) 40 | i += g[1] 41 | for n in range(g[2]): 42 | data_codewords.append(data_code[i:i+g[3]]) 43 | i += g[3] 44 | 45 | return ver, data_codewords 46 | 47 | def analyse(ver, ecl, str): 48 | if all(i in num_list for i in str): 49 | mode = 'numeric' 50 | elif all(i in alphanum_list for i in str): 51 | mode = 'alphanumeric' 52 | else: 53 | mode = 'byte' 54 | 55 | m = mindex[mode] 56 | l = len(str) 57 | for i in range(40): 58 | if char_cap[ecl][i][m] > l: 59 | ver = i + 1 if i+1 > ver else ver 60 | break 61 | 62 | return ver, mode 63 | 64 | def numeric_encoding(str): 65 | str_list = [str[i:i+3] for i in range(0,len(str),3)] 66 | code = '' 67 | for i in str_list: 68 | rqbin_len = 10 69 | if len(i) == 1: 70 | rqbin_len = 4 71 | elif len(i) == 2: 72 | rqbin_len = 7 73 | code_temp = bin(int(i))[2:] 74 | code += ('0'*(rqbin_len - len(code_temp)) + code_temp) 75 | return code 76 | 77 | def alphanumeric_encoding(str): 78 | code_list = [alphanum_list.index(i) for i in str] 79 | code = '' 80 | for i in range(1, len(code_list), 2): 81 | c = bin(code_list[i-1] * 45 + code_list[i])[2:] 82 | c = '0'*(11-len(c)) + c 83 | code += c 84 | if i != len(code_list) - 1: 85 | c = bin(code_list[-1])[2:] 86 | c = '0'*(6-len(c)) + c 87 | code += c 88 | 89 | return code 90 | 91 | def byte_encoding(str): 92 | code = '' 93 | for i in str: 94 | c = bin(ord(i.encode('iso-8859-1')))[2:] 95 | c = '0'*(8-len(c)) + c 96 | code += c 97 | return code 98 | 99 | def kanji_encoding(str): 100 | pass 101 | 102 | # cci: character count indicator 103 | def get_cci(ver, mode, str): 104 | if 1 <= ver <= 9: 105 | cci_len = (10, 9, 8, 8)[mindex[mode]] 106 | elif 10 <= ver <= 26: 107 | cci_len = (12, 11, 16, 10)[mindex[mode]] 108 | else: 109 | cci_len = (14, 13, 16, 12)[mindex[mode]] 110 | 111 | cci = bin(len(str))[2:] 112 | cci = '0' * (cci_len - len(cci)) + cci 113 | return cci 114 | 115 | if __name__ == '__main__': 116 | s = '123456789' 117 | v, datacode = encode(1, 'H', s) 118 | print(v, datacode) 119 | -------------------------------------------------------------------------------- /src/gqrcode/progreso.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # This file is part of GQRCode 5 | # 6 | # Copyright (c) 2012-2019 Lorenzo Carbonell Cerezo 7 | # 8 | # Permission is hereby granted, free of charge, to any person obtaining a copy 9 | # of this software and associated documentation files (the "Software"), to deal 10 | # in the Software without restriction, including without limitation the rights 11 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | # copies of the Software, and to permit persons to whom the Software is 13 | # furnished to do so, subject to the following conditions: 14 | # 15 | # The above copyright notice and this permission notice shall be included in all 16 | # copies or substantial portions of the Software. 17 | # 18 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | # SOFTWARE. 25 | 26 | import gi 27 | try: 28 | gi.require_version('Gtk', '3.0') 29 | gi.require_version('GObject', '2.0') 30 | except Exception as e: 31 | print(e) 32 | exit(1) 33 | from gi.repository import Gtk 34 | from gi.repository import GObject 35 | 36 | 37 | class Progreso(Gtk.Dialog): 38 | __gsignals__ = { 39 | 'i-want-stop': (GObject.SIGNAL_RUN_FIRST, GObject.TYPE_NONE, ()), 40 | } 41 | 42 | def __init__(self, title, parent, max_value=0): 43 | Gtk.Dialog.__init__(self, title, parent) 44 | self.set_position(Gtk.WindowPosition.CENTER_ALWAYS) 45 | self.set_size_request(330, 30) 46 | self.set_resizable(False) 47 | self.connect('destroy', self.close) 48 | # self.set_modal(True) 49 | vbox = Gtk.VBox(spacing=5) 50 | vbox.set_border_width(5) 51 | self.get_content_area().add(vbox) 52 | # 53 | frame1 = Gtk.Frame() 54 | vbox.pack_start(frame1, True, True, 0) 55 | table = Gtk.Table(2, 2, False) 56 | frame1.add(table) 57 | # 58 | self.label = Gtk.Label() 59 | table.attach(self.label, 0, 2, 0, 1, 60 | xpadding=5, 61 | ypadding=5, 62 | xoptions=Gtk.AttachOptions.SHRINK, 63 | yoptions=Gtk.AttachOptions.EXPAND) 64 | # 65 | self.progressbar = Gtk.ProgressBar() 66 | self.progressbar.set_size_request(300, 0) 67 | table.attach(self.progressbar, 0, 1, 1, 2, 68 | xpadding=5, 69 | ypadding=5, 70 | xoptions=Gtk.AttachOptions.SHRINK, 71 | yoptions=Gtk.AttachOptions.EXPAND) 72 | button_stop = Gtk.Button() 73 | button_stop.set_size_request(40, 40) 74 | button_stop.set_image( 75 | Gtk.Image.new_from_stock(Gtk.STOCK_STOP, Gtk.IconSize.BUTTON)) 76 | button_stop.connect('clicked', self.on_button_stop_clicked) 77 | table.attach(button_stop, 1, 2, 1, 2, 78 | xpadding=5, 79 | ypadding=5, 80 | xoptions=Gtk.AttachOptions.SHRINK) 81 | self.stop = False 82 | self.max_value = max_value 83 | self.value = 0.0 84 | self.show_all() 85 | 86 | def get_stop(self): 87 | return self.stop 88 | 89 | def on_button_stop_clicked(self, widget): 90 | self.stop = True 91 | self.emit('i-want-stop') 92 | 93 | def set_max_value(self, max_value): 94 | self.max_value = max_value 95 | 96 | def set_value(self, anobject=None, value=1): 97 | if value >= 0 and value <= self.max_value: 98 | self.value = value 99 | fraction = self.value/self.max_value 100 | self.progressbar.set_fraction(fraction) 101 | if self.value == self.max_value: 102 | self.hide() 103 | 104 | def close(self, widget=None): 105 | self.destroy() 106 | 107 | def increase(self): 108 | self.value += 1.0 109 | fraction = self.value/self.max_value 110 | self.progressbar.set_fraction(fraction) 111 | if self.value == self.max_value: 112 | self.hide() 113 | 114 | def decrease(self): 115 | self.value -= 1.0 116 | fraction = self.value/self.max_value 117 | self.progressbar.set_fraction(fraction) 118 | 119 | 120 | if __name__ == '__main__': 121 | p = Progreso('Prueba', None) 122 | p.run() 123 | -------------------------------------------------------------------------------- /po/eu.po: -------------------------------------------------------------------------------- 1 | # Basque translations for gqrcode package. 2 | # Copyright (C) 2011 THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the gqrcode package. 4 | # Lorenzo , 2011. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: gqrcode 0.5.2\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2019-10-26 11:09+0200\n" 11 | "PO-Revision-Date: 2011-03-27 10:06+0200\n" 12 | "Last-Translator: Lorenzo \n" 13 | "Language-Team: Basque\n" 14 | "Language: eu\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | 19 | #: src/gqrcode/mainwindow.py:197 20 | msgid "Set text to encode: " 21 | msgstr "" 22 | 23 | #: src/gqrcode/mainwindow.py:237 24 | msgid "Set number to encode:" 25 | msgstr "" 26 | 27 | #: src/gqrcode/mainwindow.py:249 28 | msgid "Set email:" 29 | msgstr "" 30 | 31 | #: src/gqrcode/mainwindow.py:261 32 | msgid "Set url:" 33 | msgstr "" 34 | 35 | #: src/gqrcode/mainwindow.py:273 36 | msgid "SSID/Network name:" 37 | msgstr "" 38 | 39 | #: src/gqrcode/mainwindow.py:282 40 | msgid "Password:" 41 | msgstr "" 42 | 43 | #: src/gqrcode/mainwindow.py:292 44 | msgid "Network type:" 45 | msgstr "" 46 | 47 | #: src/gqrcode/mainwindow.py:296 48 | msgid "WEP" 49 | msgstr "" 50 | 51 | #: src/gqrcode/mainwindow.py:297 52 | msgid "WPA/WPA2" 53 | msgstr "" 54 | 55 | #: src/gqrcode/mainwindow.py:298 56 | msgid "No encryption" 57 | msgstr "" 58 | 59 | #: src/gqrcode/mainwindow.py:311 60 | msgid "Telephone Number:" 61 | msgstr "" 62 | 63 | #: src/gqrcode/mainwindow.py:320 64 | msgid "SMS Message:" 65 | msgstr "" 66 | 67 | #: src/gqrcode/mainwindow.py:338 68 | msgid "Email:" 69 | msgstr "" 70 | 71 | #: src/gqrcode/mainwindow.py:347 72 | msgid "Subject:" 73 | msgstr "" 74 | 75 | #: src/gqrcode/mainwindow.py:356 76 | msgid "Body:" 77 | msgstr "" 78 | 79 | #: src/gqrcode/mainwindow.py:374 80 | msgid "Fist name" 81 | msgstr "" 82 | 83 | #: src/gqrcode/mainwindow.py:375 84 | msgid "Last name" 85 | msgstr "" 86 | 87 | #: src/gqrcode/mainwindow.py:376 88 | msgid "Job title" 89 | msgstr "" 90 | 91 | #: src/gqrcode/mainwindow.py:377 92 | msgid "Telephone Number (work)" 93 | msgstr "" 94 | 95 | #: src/gqrcode/mainwindow.py:378 96 | msgid "Fax Number (work)" 97 | msgstr "" 98 | 99 | #: src/gqrcode/mainwindow.py:379 100 | msgid "Cell Phone" 101 | msgstr "" 102 | 103 | #: src/gqrcode/mainwindow.py:380 104 | msgid "Email Address (work)" 105 | msgstr "" 106 | 107 | #: src/gqrcode/mainwindow.py:381 108 | msgid "Website Address" 109 | msgstr "" 110 | 111 | #: src/gqrcode/mainwindow.py:382 112 | msgid "Organization" 113 | msgstr "" 114 | 115 | #: src/gqrcode/mainwindow.py:383 116 | msgid "Street Address (work)" 117 | msgstr "" 118 | 119 | #: src/gqrcode/mainwindow.py:384 120 | msgid "City" 121 | msgstr "" 122 | 123 | #: src/gqrcode/mainwindow.py:385 124 | msgid "State" 125 | msgstr "" 126 | 127 | #: src/gqrcode/mainwindow.py:386 128 | msgid "Zip/Postcode" 129 | msgstr "" 130 | 131 | #: src/gqrcode/mainwindow.py:387 132 | msgid "Country" 133 | msgstr "" 134 | 135 | #: src/gqrcode/mainwindow.py:388 136 | msgid "Notes" 137 | msgstr "" 138 | 139 | #: src/gqrcode/mainwindow.py:456 140 | msgid "Open QR Image" 141 | msgstr "" 142 | 143 | #: src/gqrcode/mainwindow.py:461 144 | msgid "Load background" 145 | msgstr "" 146 | 147 | #: src/gqrcode/mainwindow.py:462 148 | msgid "Reset background" 149 | msgstr "" 150 | 151 | #: src/gqrcode/mainwindow.py:467 152 | msgid "Save QR Image" 153 | msgstr "" 154 | 155 | #: src/gqrcode/mainwindow.py:472 156 | msgid "Close" 157 | msgstr "" 158 | 159 | #: src/gqrcode/mainwindow.py:483 160 | msgid "Text" 161 | msgstr "" 162 | 163 | #: src/gqrcode/mainwindow.py:484 164 | msgid "Geolocation" 165 | msgstr "" 166 | 167 | #: src/gqrcode/mainwindow.py:485 168 | msgid "Telephone number" 169 | msgstr "" 170 | 171 | #: src/gqrcode/mainwindow.py:486 172 | msgid "Email" 173 | msgstr "" 174 | 175 | #: src/gqrcode/mainwindow.py:487 176 | msgid "Url" 177 | msgstr "" 178 | 179 | #: src/gqrcode/mainwindow.py:488 180 | msgid "Wifi Login" 181 | msgstr "" 182 | 183 | #: src/gqrcode/mainwindow.py:489 184 | msgid "SMS" 185 | msgstr "" 186 | 187 | #: src/gqrcode/mainwindow.py:490 188 | msgid "Email message" 189 | msgstr "" 190 | 191 | #: src/gqrcode/mainwindow.py:491 192 | msgid "vCard" 193 | msgstr "" 194 | 195 | #: src/gqrcode/mainwindow.py:503 196 | msgid "Encode" 197 | msgstr "" 198 | 199 | #: src/gqrcode/mainwindow.py:512 200 | msgid "Homepage" 201 | msgstr "" 202 | 203 | #: src/gqrcode/mainwindow.py:517 204 | msgid "Code" 205 | msgstr "" 206 | 207 | #: src/gqrcode/mainwindow.py:518 208 | msgid "Issues" 209 | msgstr "" 210 | 211 | #: src/gqrcode/mainwindow.py:523 212 | msgid "Twitter" 213 | msgstr "" 214 | 215 | #: src/gqrcode/mainwindow.py:524 216 | msgid "Facebook" 217 | msgstr "" 218 | 219 | #: src/gqrcode/mainwindow.py:525 220 | msgid "Google+" 221 | msgstr "" 222 | 223 | #: src/gqrcode/mainwindow.py:530 224 | msgid "Donations" 225 | msgstr "" 226 | 227 | #: src/gqrcode/mainwindow.py:535 228 | msgid "About" 229 | msgstr "" 230 | 231 | #: src/gqrcode/mainwindow.py:667 232 | msgid "Creating QR Code" 233 | msgstr "" 234 | 235 | #: src/gqrcode/mainwindow.py:697 236 | msgid "File" 237 | msgstr "" 238 | 239 | #: src/gqrcode/mainwindow.py:702 240 | msgid "load file" 241 | msgstr "" 242 | 243 | #: src/gqrcode/mainwindow.py:710 244 | msgid "Save as" 245 | msgstr "" 246 | 247 | #: src/gqrcode/mainwindow.py:726 248 | msgid "Set file to load qrcode" 249 | msgstr "" 250 | 251 | #: src/gqrcode/mainwindow.py:732 src/gqrcode/mainwindow.py:767 252 | #: src/gqrcode/mainwindow.py:914 253 | msgid "png files" 254 | msgstr "" 255 | 256 | #: src/gqrcode/mainwindow.py:756 257 | msgid "Set file for QR background" 258 | msgstr "" 259 | 260 | #: src/gqrcode/mainwindow.py:761 261 | msgid "Image files" 262 | msgstr "" 263 | 264 | #: src/gqrcode/mainwindow.py:771 265 | msgid "jpeg files" 266 | msgstr "" 267 | 268 | #: src/gqrcode/mainwindow.py:775 src/gqrcode/mainwindow.py:934 269 | msgid "gif files" 270 | msgstr "" 271 | 272 | #: src/gqrcode/mainwindow.py:907 src/gqrcode/mainwindow.py:927 273 | msgid "Set file to save encode image" 274 | msgstr "" 275 | 276 | #: src/gqrcode/gqrcode.py:202 277 | msgid "QRCode coder and decoder" 278 | msgstr "" 279 | -------------------------------------------------------------------------------- /po/en.po: -------------------------------------------------------------------------------- 1 | # English translations for gqrcode package. 2 | # Copyright (C) 2011 THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the gqrcode package. 4 | # Lorenzo , 2011. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: gqrcode 0.5.2\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2019-10-26 11:09+0200\n" 11 | "PO-Revision-Date: 2011-03-27 10:06+0200\n" 12 | "Last-Translator: Lorenzo \n" 13 | "Language-Team: English\n" 14 | "Language: en\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 19 | 20 | #: src/gqrcode/mainwindow.py:197 21 | msgid "Set text to encode: " 22 | msgstr "Set text to encode: " 23 | 24 | #: src/gqrcode/mainwindow.py:237 25 | #, fuzzy 26 | msgid "Set number to encode:" 27 | msgstr "Set text to encode: " 28 | 29 | #: src/gqrcode/mainwindow.py:249 30 | msgid "Set email:" 31 | msgstr "" 32 | 33 | #: src/gqrcode/mainwindow.py:261 34 | msgid "Set url:" 35 | msgstr "" 36 | 37 | #: src/gqrcode/mainwindow.py:273 38 | msgid "SSID/Network name:" 39 | msgstr "" 40 | 41 | #: src/gqrcode/mainwindow.py:282 42 | msgid "Password:" 43 | msgstr "" 44 | 45 | #: src/gqrcode/mainwindow.py:292 46 | msgid "Network type:" 47 | msgstr "" 48 | 49 | #: src/gqrcode/mainwindow.py:296 50 | msgid "WEP" 51 | msgstr "" 52 | 53 | #: src/gqrcode/mainwindow.py:297 54 | msgid "WPA/WPA2" 55 | msgstr "" 56 | 57 | #: src/gqrcode/mainwindow.py:298 58 | msgid "No encryption" 59 | msgstr "" 60 | 61 | #: src/gqrcode/mainwindow.py:311 62 | msgid "Telephone Number:" 63 | msgstr "" 64 | 65 | #: src/gqrcode/mainwindow.py:320 66 | msgid "SMS Message:" 67 | msgstr "" 68 | 69 | #: src/gqrcode/mainwindow.py:338 70 | msgid "Email:" 71 | msgstr "" 72 | 73 | #: src/gqrcode/mainwindow.py:347 74 | msgid "Subject:" 75 | msgstr "" 76 | 77 | #: src/gqrcode/mainwindow.py:356 78 | msgid "Body:" 79 | msgstr "" 80 | 81 | #: src/gqrcode/mainwindow.py:374 82 | msgid "Fist name" 83 | msgstr "" 84 | 85 | #: src/gqrcode/mainwindow.py:375 86 | msgid "Last name" 87 | msgstr "" 88 | 89 | #: src/gqrcode/mainwindow.py:376 90 | msgid "Job title" 91 | msgstr "" 92 | 93 | #: src/gqrcode/mainwindow.py:377 94 | msgid "Telephone Number (work)" 95 | msgstr "" 96 | 97 | #: src/gqrcode/mainwindow.py:378 98 | msgid "Fax Number (work)" 99 | msgstr "" 100 | 101 | #: src/gqrcode/mainwindow.py:379 102 | msgid "Cell Phone" 103 | msgstr "" 104 | 105 | #: src/gqrcode/mainwindow.py:380 106 | msgid "Email Address (work)" 107 | msgstr "" 108 | 109 | #: src/gqrcode/mainwindow.py:381 110 | msgid "Website Address" 111 | msgstr "" 112 | 113 | #: src/gqrcode/mainwindow.py:382 114 | msgid "Organization" 115 | msgstr "" 116 | 117 | #: src/gqrcode/mainwindow.py:383 118 | msgid "Street Address (work)" 119 | msgstr "" 120 | 121 | #: src/gqrcode/mainwindow.py:384 122 | msgid "City" 123 | msgstr "" 124 | 125 | #: src/gqrcode/mainwindow.py:385 126 | msgid "State" 127 | msgstr "" 128 | 129 | #: src/gqrcode/mainwindow.py:386 130 | msgid "Zip/Postcode" 131 | msgstr "" 132 | 133 | #: src/gqrcode/mainwindow.py:387 134 | msgid "Country" 135 | msgstr "" 136 | 137 | #: src/gqrcode/mainwindow.py:388 138 | msgid "Notes" 139 | msgstr "" 140 | 141 | #: src/gqrcode/mainwindow.py:456 142 | msgid "Open QR Image" 143 | msgstr "" 144 | 145 | #: src/gqrcode/mainwindow.py:461 146 | msgid "Load background" 147 | msgstr "" 148 | 149 | #: src/gqrcode/mainwindow.py:462 150 | msgid "Reset background" 151 | msgstr "" 152 | 153 | #: src/gqrcode/mainwindow.py:467 154 | #, fuzzy 155 | msgid "Save QR Image" 156 | msgstr "Save as" 157 | 158 | #: src/gqrcode/mainwindow.py:472 159 | msgid "Close" 160 | msgstr "" 161 | 162 | #: src/gqrcode/mainwindow.py:483 163 | msgid "Text" 164 | msgstr "" 165 | 166 | #: src/gqrcode/mainwindow.py:484 167 | msgid "Geolocation" 168 | msgstr "" 169 | 170 | #: src/gqrcode/mainwindow.py:485 171 | msgid "Telephone number" 172 | msgstr "" 173 | 174 | #: src/gqrcode/mainwindow.py:486 175 | msgid "Email" 176 | msgstr "" 177 | 178 | #: src/gqrcode/mainwindow.py:487 179 | msgid "Url" 180 | msgstr "" 181 | 182 | #: src/gqrcode/mainwindow.py:488 183 | msgid "Wifi Login" 184 | msgstr "" 185 | 186 | #: src/gqrcode/mainwindow.py:489 187 | msgid "SMS" 188 | msgstr "" 189 | 190 | #: src/gqrcode/mainwindow.py:490 191 | msgid "Email message" 192 | msgstr "" 193 | 194 | #: src/gqrcode/mainwindow.py:491 195 | msgid "vCard" 196 | msgstr "" 197 | 198 | #: src/gqrcode/mainwindow.py:503 199 | msgid "Encode" 200 | msgstr "Encode" 201 | 202 | #: src/gqrcode/mainwindow.py:512 203 | msgid "Homepage" 204 | msgstr "" 205 | 206 | #: src/gqrcode/mainwindow.py:517 207 | msgid "Code" 208 | msgstr "" 209 | 210 | #: src/gqrcode/mainwindow.py:518 211 | msgid "Issues" 212 | msgstr "" 213 | 214 | #: src/gqrcode/mainwindow.py:523 215 | msgid "Twitter" 216 | msgstr "" 217 | 218 | #: src/gqrcode/mainwindow.py:524 219 | msgid "Facebook" 220 | msgstr "" 221 | 222 | #: src/gqrcode/mainwindow.py:525 223 | msgid "Google+" 224 | msgstr "" 225 | 226 | #: src/gqrcode/mainwindow.py:530 227 | msgid "Donations" 228 | msgstr "" 229 | 230 | #: src/gqrcode/mainwindow.py:535 231 | msgid "About" 232 | msgstr "" 233 | 234 | #: src/gqrcode/mainwindow.py:667 235 | msgid "Creating QR Code" 236 | msgstr "" 237 | 238 | #: src/gqrcode/mainwindow.py:697 239 | msgid "File" 240 | msgstr "" 241 | 242 | #: src/gqrcode/mainwindow.py:702 243 | msgid "load file" 244 | msgstr "" 245 | 246 | #: src/gqrcode/mainwindow.py:710 247 | msgid "Save as" 248 | msgstr "Save as" 249 | 250 | #: src/gqrcode/mainwindow.py:726 251 | msgid "Set file to load qrcode" 252 | msgstr "Set file to load qrcode" 253 | 254 | #: src/gqrcode/mainwindow.py:732 src/gqrcode/mainwindow.py:767 255 | #: src/gqrcode/mainwindow.py:914 256 | msgid "png files" 257 | msgstr "" 258 | 259 | #: src/gqrcode/mainwindow.py:756 260 | #, fuzzy 261 | msgid "Set file for QR background" 262 | msgstr "Set file to load qrcode" 263 | 264 | #: src/gqrcode/mainwindow.py:761 265 | msgid "Image files" 266 | msgstr "" 267 | 268 | #: src/gqrcode/mainwindow.py:771 269 | msgid "jpeg files" 270 | msgstr "" 271 | 272 | #: src/gqrcode/mainwindow.py:775 src/gqrcode/mainwindow.py:934 273 | msgid "gif files" 274 | msgstr "" 275 | 276 | #: src/gqrcode/mainwindow.py:907 src/gqrcode/mainwindow.py:927 277 | msgid "Set file to save encode image" 278 | msgstr "Set file to save encode image" 279 | 280 | #: src/gqrcode/gqrcode.py:202 281 | msgid "QRCode coder and decoder" 282 | msgstr "" 283 | 284 | #, fuzzy 285 | #~ msgid "Encoded text:" 286 | #~ msgstr "Encode" 287 | 288 | #~ msgid "Decode" 289 | #~ msgstr "Decode" 290 | 291 | #~ msgid "Decoded" 292 | #~ msgstr "Decoded" 293 | 294 | #~ msgid "An application to code and decode" 295 | #~ msgstr "An application to code and decode" 296 | 297 | #~ msgid "Load qrcode image" 298 | #~ msgstr "Load qrcode image" 299 | -------------------------------------------------------------------------------- /src/gqrcode/mylibs/matrix.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from .constant import alig_location, format_info_str, version_info_str, lindex 4 | 5 | def get_qrmatrix(ver, ecl, bits): 6 | num = (ver - 1) * 4 + 21 7 | qrmatrix = [[None] * num for i in range(num)] 8 | # [([None] * num * num)[i:i+num] for i in range(num * num) if i % num == 0] 9 | 10 | # Add the Finder Patterns & Add the Separators 11 | add_finder_and_separator(qrmatrix) 12 | 13 | # Add the Alignment Patterns 14 | add_alignment(ver, qrmatrix) 15 | 16 | # Add the Timing Patterns 17 | add_timing(qrmatrix) 18 | 19 | # Add the Dark Module and Reserved Areas 20 | add_dark_and_reserving(ver, qrmatrix) 21 | 22 | maskmatrix = [i[:] for i in qrmatrix] 23 | 24 | # Place the Data Bits 25 | place_bits(bits, qrmatrix) 26 | 27 | # Data Masking 28 | mask_num, qrmatrix = mask(maskmatrix, qrmatrix) 29 | 30 | # Format Information 31 | add_format_and_version_string(ver, ecl, mask_num, qrmatrix) 32 | 33 | return qrmatrix 34 | 35 | def add_finder_and_separator(m): 36 | for i in range(8): 37 | for j in range(8): 38 | if i in (0, 6): 39 | m[i][j] = m[-i-1][j] = m[i][-j-1] = 0 if j == 7 else 1 40 | elif i in (1, 5): 41 | m[i][j] = m[-i-1][j] = m[i][-j-1] = 1 if j in (0, 6) else 0 42 | elif i == 7: 43 | m[i][j] = m[-i-1][j] = m[i][-j-1] = 0 44 | else: 45 | m[i][j] = m[-i-1][j] = m[i][-j-1] = 0 if j in (1, 5, 7) else 1 46 | 47 | def add_alignment(ver, m): 48 | if ver > 1: 49 | coordinates = alig_location[ver-2] 50 | for i in coordinates: 51 | for j in coordinates: 52 | if m[i][j] is None: 53 | add_an_alignment(i, j, m) 54 | 55 | def add_an_alignment(row, column, m): 56 | for i in range(row-2, row+3): 57 | for j in range(column-2, column+3): 58 | m[i][j] = 1 if i in (row-2, row+2) or j in (column-2, column+2) else 0 59 | m[row][column] = 1 60 | 61 | def add_timing(m): 62 | for i in range(8, len(m)-8): 63 | m[i][6] = m[6][i] = 1 if i % 2 ==0 else 0 64 | 65 | def add_dark_and_reserving(ver, m): 66 | for j in range(8): 67 | m[8][j] = m[8][-j-1] = m[j][8] = m[-j-1][8] = 0 68 | m[8][8] = 0 69 | m[8][6] = m[6][8] = m[-8][8] = 1 70 | 71 | if ver > 6: 72 | for i in range(6): 73 | for j in (-9, -10, -11): 74 | m[i][j] = m[j][i] = 0 75 | 76 | def place_bits(bits, m): 77 | bit = (int(i) for i in bits) 78 | 79 | up = True 80 | for a in range(len(m)-1, 0, -2): 81 | a = a-1 if a <= 6 else a 82 | irange = range(len(m)-1, -1, -1) if up else range(len(m)) 83 | for i in irange: 84 | for j in (a, a-1): 85 | if m[i][j] is None: 86 | m[i][j] = next(bit) 87 | up = not up 88 | 89 | def mask(mm, m): 90 | mps = get_mask_patterns(mm) 91 | scores = [] 92 | for mp in mps: 93 | for i in range(len(mp)): 94 | for j in range(len(mp)): 95 | mp[i][j] = mp[i][j] ^ m[i][j] 96 | scores.append(compute_score(mp)) 97 | best = scores.index(min(scores)) 98 | return best, mps[best] 99 | 100 | def get_mask_patterns(mm): 101 | def formula(i, row, column): 102 | if i == 0: 103 | return (row + column) % 2 == 0 104 | elif i == 1: 105 | return row % 2 == 0 106 | elif i == 2: 107 | return column % 3 == 0 108 | elif i == 3: 109 | return (row + column) % 3 == 0 110 | elif i == 4: 111 | return (row // 2 + column // 3) % 2 == 0 112 | elif i == 5: 113 | return ((row * column) % 2) + ((row * column) % 3) == 0 114 | elif i == 6: 115 | return (((row * column) % 2) + ((row * column) % 3)) % 2 == 0 116 | elif i == 7: 117 | return (((row + column) % 2) + ((row * column) % 3)) % 2 == 0 118 | 119 | mm[-8][8] = None 120 | for i in range(len(mm)): 121 | for j in range(len(mm)): 122 | mm[i][j] = 0 if mm[i][j] is not None else mm[i][j] 123 | mps = [] 124 | for i in range(8): 125 | mp = [ii[:] for ii in mm] 126 | for row in range(len(mp)): 127 | for column in range(len(mp)): 128 | mp[row][column] = 1 if mp[row][column] is None and formula(i, row, column) else 0 129 | mps.append(mp) 130 | 131 | return mps 132 | 133 | def compute_score(m): 134 | def evaluation1(m): 135 | def ev1(ma): 136 | sc = 0 137 | for mi in ma: 138 | j = 0 139 | while j < len(mi)-4: 140 | n = 4 141 | while mi[j:j+n+1] in [[1]*(n+1), [0]*(n+1)]: 142 | n += 1 143 | (sc, j) = (sc+n-2, j+n) if n > 4 else (sc, j+1) 144 | return sc 145 | return ev1(m) + ev1(list(map(list, zip(*m)))) 146 | 147 | def evaluation2(m): 148 | sc = 0 149 | for i in range(len(m)-1): 150 | for j in range(len(m)-1): 151 | sc += 3 if m[i][j] == m[i+1][j] == m[i][j+1] == m[i+1][j+1] else 0 152 | return sc 153 | 154 | def evaluation3(m): 155 | def ev3(ma): 156 | sc = 0 157 | for mi in ma: 158 | j = 0 159 | while j < len(mi)-10: 160 | if mi[j:j+11] == [1,0,1,1,1,0,1,0,0,0,0]: 161 | sc += 40 162 | j += 7 163 | elif mi[j:j+11] == [0,0,0,0,1,0,1,1,1,0,1]: 164 | sc += 40 165 | j += 4 166 | else: 167 | j += 1 168 | return sc 169 | return ev3(m) + ev3(list(map(list, zip(*m)))) 170 | 171 | def evaluation4(m): 172 | darknum = 0 173 | for i in m: 174 | darknum += sum(i) 175 | percent = darknum / (len(m)**2) * 100 176 | s = int((50 - percent) / 5) * 5 177 | return 2*s if s >=0 else -2*s 178 | 179 | score = evaluation1(m) + evaluation2(m)+ evaluation3(m) + evaluation4(m) 180 | return score 181 | 182 | def add_format_and_version_string(ver, ecl, mask_num, m): 183 | fs = [int(i) for i in format_info_str[lindex[ecl]][mask_num]] 184 | for j in range(6): 185 | m[8][j] = m[-j-1][8] = fs[j] 186 | m[8][-j-1] = m[j][8] = fs[-j-1] 187 | m[8][7] = m[-7][8] = fs[6] 188 | m[8][8] = m[8][-8] = fs[7] 189 | m[7][8] = m[8][-7] = fs[8] 190 | 191 | if ver > 6: 192 | vs = (int(i) for i in version_info_str[ver-7]) 193 | for j in range(5, -1, -1): 194 | for i in (-9, -10, -11): 195 | m[i][j] = m[j][i] = next(vs) 196 | -------------------------------------------------------------------------------- /po/de.po: -------------------------------------------------------------------------------- 1 | # German translations for gqrcode package. 2 | # Copyright (C) 2011 THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the gqrcode package. 4 | # Lorenzo , 2011. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: gqrcode 0.5.2\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2019-10-26 11:09+0200\n" 11 | "PO-Revision-Date: 2011-03-27 10:06+0200\n" 12 | "Last-Translator: Lorenzo \n" 13 | "Language-Team: German\n" 14 | "Language: de\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 19 | 20 | #: src/gqrcode/mainwindow.py:197 21 | msgid "Set text to encode: " 22 | msgstr "Set Text zu codieren:" 23 | 24 | #: src/gqrcode/mainwindow.py:237 25 | #, fuzzy 26 | msgid "Set number to encode:" 27 | msgstr "Set Text zu codieren:" 28 | 29 | #: src/gqrcode/mainwindow.py:249 30 | msgid "Set email:" 31 | msgstr "" 32 | 33 | #: src/gqrcode/mainwindow.py:261 34 | msgid "Set url:" 35 | msgstr "" 36 | 37 | #: src/gqrcode/mainwindow.py:273 38 | msgid "SSID/Network name:" 39 | msgstr "" 40 | 41 | #: src/gqrcode/mainwindow.py:282 42 | msgid "Password:" 43 | msgstr "" 44 | 45 | #: src/gqrcode/mainwindow.py:292 46 | msgid "Network type:" 47 | msgstr "" 48 | 49 | #: src/gqrcode/mainwindow.py:296 50 | msgid "WEP" 51 | msgstr "" 52 | 53 | #: src/gqrcode/mainwindow.py:297 54 | msgid "WPA/WPA2" 55 | msgstr "" 56 | 57 | #: src/gqrcode/mainwindow.py:298 58 | msgid "No encryption" 59 | msgstr "" 60 | 61 | #: src/gqrcode/mainwindow.py:311 62 | msgid "Telephone Number:" 63 | msgstr "" 64 | 65 | #: src/gqrcode/mainwindow.py:320 66 | msgid "SMS Message:" 67 | msgstr "" 68 | 69 | #: src/gqrcode/mainwindow.py:338 70 | msgid "Email:" 71 | msgstr "" 72 | 73 | #: src/gqrcode/mainwindow.py:347 74 | msgid "Subject:" 75 | msgstr "" 76 | 77 | #: src/gqrcode/mainwindow.py:356 78 | msgid "Body:" 79 | msgstr "" 80 | 81 | #: src/gqrcode/mainwindow.py:374 82 | msgid "Fist name" 83 | msgstr "" 84 | 85 | #: src/gqrcode/mainwindow.py:375 86 | msgid "Last name" 87 | msgstr "" 88 | 89 | #: src/gqrcode/mainwindow.py:376 90 | msgid "Job title" 91 | msgstr "" 92 | 93 | #: src/gqrcode/mainwindow.py:377 94 | msgid "Telephone Number (work)" 95 | msgstr "" 96 | 97 | #: src/gqrcode/mainwindow.py:378 98 | msgid "Fax Number (work)" 99 | msgstr "" 100 | 101 | #: src/gqrcode/mainwindow.py:379 102 | msgid "Cell Phone" 103 | msgstr "" 104 | 105 | #: src/gqrcode/mainwindow.py:380 106 | msgid "Email Address (work)" 107 | msgstr "" 108 | 109 | #: src/gqrcode/mainwindow.py:381 110 | msgid "Website Address" 111 | msgstr "" 112 | 113 | #: src/gqrcode/mainwindow.py:382 114 | msgid "Organization" 115 | msgstr "" 116 | 117 | #: src/gqrcode/mainwindow.py:383 118 | msgid "Street Address (work)" 119 | msgstr "" 120 | 121 | #: src/gqrcode/mainwindow.py:384 122 | msgid "City" 123 | msgstr "" 124 | 125 | #: src/gqrcode/mainwindow.py:385 126 | msgid "State" 127 | msgstr "" 128 | 129 | #: src/gqrcode/mainwindow.py:386 130 | msgid "Zip/Postcode" 131 | msgstr "" 132 | 133 | #: src/gqrcode/mainwindow.py:387 134 | msgid "Country" 135 | msgstr "" 136 | 137 | #: src/gqrcode/mainwindow.py:388 138 | msgid "Notes" 139 | msgstr "" 140 | 141 | #: src/gqrcode/mainwindow.py:456 142 | msgid "Open QR Image" 143 | msgstr "" 144 | 145 | #: src/gqrcode/mainwindow.py:461 146 | msgid "Load background" 147 | msgstr "" 148 | 149 | #: src/gqrcode/mainwindow.py:462 150 | msgid "Reset background" 151 | msgstr "" 152 | 153 | #: src/gqrcode/mainwindow.py:467 154 | #, fuzzy 155 | msgid "Save QR Image" 156 | msgstr "Speichern unter" 157 | 158 | #: src/gqrcode/mainwindow.py:472 159 | msgid "Close" 160 | msgstr "" 161 | 162 | #: src/gqrcode/mainwindow.py:483 163 | msgid "Text" 164 | msgstr "" 165 | 166 | #: src/gqrcode/mainwindow.py:484 167 | msgid "Geolocation" 168 | msgstr "" 169 | 170 | #: src/gqrcode/mainwindow.py:485 171 | msgid "Telephone number" 172 | msgstr "" 173 | 174 | #: src/gqrcode/mainwindow.py:486 175 | msgid "Email" 176 | msgstr "" 177 | 178 | #: src/gqrcode/mainwindow.py:487 179 | msgid "Url" 180 | msgstr "" 181 | 182 | #: src/gqrcode/mainwindow.py:488 183 | msgid "Wifi Login" 184 | msgstr "" 185 | 186 | #: src/gqrcode/mainwindow.py:489 187 | msgid "SMS" 188 | msgstr "" 189 | 190 | #: src/gqrcode/mainwindow.py:490 191 | msgid "Email message" 192 | msgstr "" 193 | 194 | #: src/gqrcode/mainwindow.py:491 195 | msgid "vCard" 196 | msgstr "" 197 | 198 | #: src/gqrcode/mainwindow.py:503 199 | msgid "Encode" 200 | msgstr "Encode" 201 | 202 | #: src/gqrcode/mainwindow.py:512 203 | msgid "Homepage" 204 | msgstr "" 205 | 206 | #: src/gqrcode/mainwindow.py:517 207 | msgid "Code" 208 | msgstr "" 209 | 210 | #: src/gqrcode/mainwindow.py:518 211 | msgid "Issues" 212 | msgstr "" 213 | 214 | #: src/gqrcode/mainwindow.py:523 215 | msgid "Twitter" 216 | msgstr "" 217 | 218 | #: src/gqrcode/mainwindow.py:524 219 | msgid "Facebook" 220 | msgstr "" 221 | 222 | #: src/gqrcode/mainwindow.py:525 223 | msgid "Google+" 224 | msgstr "" 225 | 226 | #: src/gqrcode/mainwindow.py:530 227 | msgid "Donations" 228 | msgstr "" 229 | 230 | #: src/gqrcode/mainwindow.py:535 231 | msgid "About" 232 | msgstr "" 233 | 234 | #: src/gqrcode/mainwindow.py:667 235 | msgid "Creating QR Code" 236 | msgstr "" 237 | 238 | #: src/gqrcode/mainwindow.py:697 239 | msgid "File" 240 | msgstr "" 241 | 242 | #: src/gqrcode/mainwindow.py:702 243 | msgid "load file" 244 | msgstr "" 245 | 246 | #: src/gqrcode/mainwindow.py:710 247 | msgid "Save as" 248 | msgstr "Speichern unter" 249 | 250 | #: src/gqrcode/mainwindow.py:726 251 | msgid "Set file to load qrcode" 252 | msgstr "Set Datei qrcode Last" 253 | 254 | #: src/gqrcode/mainwindow.py:732 src/gqrcode/mainwindow.py:767 255 | #: src/gqrcode/mainwindow.py:914 256 | msgid "png files" 257 | msgstr "" 258 | 259 | #: src/gqrcode/mainwindow.py:756 260 | #, fuzzy 261 | msgid "Set file for QR background" 262 | msgstr "Set Datei qrcode Last" 263 | 264 | #: src/gqrcode/mainwindow.py:761 265 | msgid "Image files" 266 | msgstr "" 267 | 268 | #: src/gqrcode/mainwindow.py:771 269 | msgid "jpeg files" 270 | msgstr "" 271 | 272 | #: src/gqrcode/mainwindow.py:775 src/gqrcode/mainwindow.py:934 273 | msgid "gif files" 274 | msgstr "" 275 | 276 | #: src/gqrcode/mainwindow.py:907 src/gqrcode/mainwindow.py:927 277 | msgid "Set file to save encode image" 278 | msgstr "Set Datei zu verschlüsseln Bild speichern" 279 | 280 | #: src/gqrcode/gqrcode.py:202 281 | msgid "QRCode coder and decoder" 282 | msgstr "" 283 | 284 | #, fuzzy 285 | #~ msgid "Encoded text:" 286 | #~ msgstr "Encode" 287 | 288 | #~ msgid "Decode" 289 | #~ msgstr "Decode" 290 | 291 | #~ msgid "Decoded" 292 | #~ msgstr "decodiert" 293 | 294 | #~ msgid "An application to code and decode" 295 | #~ msgstr "Ein Antrag auf kodieren und dekodieren" 296 | 297 | #~ msgid "Load qrcode image" 298 | #~ msgstr "Load qrcode Bild" 299 | -------------------------------------------------------------------------------- /po/tr.po: -------------------------------------------------------------------------------- 1 | # Turkish translations for gqrcode package. 2 | # Copyright (C) 2011 THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the gqrcode package. 4 | # Lorenzo , 2011. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: gqrcode 0.5.2\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2019-10-26 11:09+0200\n" 11 | "PO-Revision-Date: 2011-03-27 10:06+0200\n" 12 | "Last-Translator: Lorenzo \n" 13 | "Language-Team: Turkish\n" 14 | "Language: tr\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 19 | 20 | #: src/gqrcode/mainwindow.py:197 21 | msgid "Set text to encode: " 22 | msgstr "Set metin kodlamak için:" 23 | 24 | #: src/gqrcode/mainwindow.py:237 25 | #, fuzzy 26 | msgid "Set number to encode:" 27 | msgstr "Set metin kodlamak için:" 28 | 29 | #: src/gqrcode/mainwindow.py:249 30 | msgid "Set email:" 31 | msgstr "" 32 | 33 | #: src/gqrcode/mainwindow.py:261 34 | msgid "Set url:" 35 | msgstr "" 36 | 37 | #: src/gqrcode/mainwindow.py:273 38 | msgid "SSID/Network name:" 39 | msgstr "" 40 | 41 | #: src/gqrcode/mainwindow.py:282 42 | msgid "Password:" 43 | msgstr "" 44 | 45 | #: src/gqrcode/mainwindow.py:292 46 | msgid "Network type:" 47 | msgstr "" 48 | 49 | #: src/gqrcode/mainwindow.py:296 50 | msgid "WEP" 51 | msgstr "" 52 | 53 | #: src/gqrcode/mainwindow.py:297 54 | msgid "WPA/WPA2" 55 | msgstr "" 56 | 57 | #: src/gqrcode/mainwindow.py:298 58 | msgid "No encryption" 59 | msgstr "" 60 | 61 | #: src/gqrcode/mainwindow.py:311 62 | msgid "Telephone Number:" 63 | msgstr "" 64 | 65 | #: src/gqrcode/mainwindow.py:320 66 | msgid "SMS Message:" 67 | msgstr "" 68 | 69 | #: src/gqrcode/mainwindow.py:338 70 | msgid "Email:" 71 | msgstr "" 72 | 73 | #: src/gqrcode/mainwindow.py:347 74 | msgid "Subject:" 75 | msgstr "" 76 | 77 | #: src/gqrcode/mainwindow.py:356 78 | msgid "Body:" 79 | msgstr "" 80 | 81 | #: src/gqrcode/mainwindow.py:374 82 | msgid "Fist name" 83 | msgstr "" 84 | 85 | #: src/gqrcode/mainwindow.py:375 86 | msgid "Last name" 87 | msgstr "" 88 | 89 | #: src/gqrcode/mainwindow.py:376 90 | msgid "Job title" 91 | msgstr "" 92 | 93 | #: src/gqrcode/mainwindow.py:377 94 | msgid "Telephone Number (work)" 95 | msgstr "" 96 | 97 | #: src/gqrcode/mainwindow.py:378 98 | msgid "Fax Number (work)" 99 | msgstr "" 100 | 101 | #: src/gqrcode/mainwindow.py:379 102 | msgid "Cell Phone" 103 | msgstr "" 104 | 105 | #: src/gqrcode/mainwindow.py:380 106 | msgid "Email Address (work)" 107 | msgstr "" 108 | 109 | #: src/gqrcode/mainwindow.py:381 110 | msgid "Website Address" 111 | msgstr "" 112 | 113 | #: src/gqrcode/mainwindow.py:382 114 | msgid "Organization" 115 | msgstr "" 116 | 117 | #: src/gqrcode/mainwindow.py:383 118 | msgid "Street Address (work)" 119 | msgstr "" 120 | 121 | #: src/gqrcode/mainwindow.py:384 122 | msgid "City" 123 | msgstr "" 124 | 125 | #: src/gqrcode/mainwindow.py:385 126 | msgid "State" 127 | msgstr "" 128 | 129 | #: src/gqrcode/mainwindow.py:386 130 | msgid "Zip/Postcode" 131 | msgstr "" 132 | 133 | #: src/gqrcode/mainwindow.py:387 134 | msgid "Country" 135 | msgstr "" 136 | 137 | #: src/gqrcode/mainwindow.py:388 138 | msgid "Notes" 139 | msgstr "" 140 | 141 | #: src/gqrcode/mainwindow.py:456 142 | msgid "Open QR Image" 143 | msgstr "" 144 | 145 | #: src/gqrcode/mainwindow.py:461 146 | msgid "Load background" 147 | msgstr "" 148 | 149 | #: src/gqrcode/mainwindow.py:462 150 | msgid "Reset background" 151 | msgstr "" 152 | 153 | #: src/gqrcode/mainwindow.py:467 154 | #, fuzzy 155 | msgid "Save QR Image" 156 | msgstr "Farklı Kaydet" 157 | 158 | #: src/gqrcode/mainwindow.py:472 159 | msgid "Close" 160 | msgstr "" 161 | 162 | #: src/gqrcode/mainwindow.py:483 163 | msgid "Text" 164 | msgstr "" 165 | 166 | #: src/gqrcode/mainwindow.py:484 167 | msgid "Geolocation" 168 | msgstr "" 169 | 170 | #: src/gqrcode/mainwindow.py:485 171 | msgid "Telephone number" 172 | msgstr "" 173 | 174 | #: src/gqrcode/mainwindow.py:486 175 | msgid "Email" 176 | msgstr "" 177 | 178 | #: src/gqrcode/mainwindow.py:487 179 | msgid "Url" 180 | msgstr "" 181 | 182 | #: src/gqrcode/mainwindow.py:488 183 | msgid "Wifi Login" 184 | msgstr "" 185 | 186 | #: src/gqrcode/mainwindow.py:489 187 | msgid "SMS" 188 | msgstr "" 189 | 190 | #: src/gqrcode/mainwindow.py:490 191 | msgid "Email message" 192 | msgstr "" 193 | 194 | #: src/gqrcode/mainwindow.py:491 195 | msgid "vCard" 196 | msgstr "" 197 | 198 | #: src/gqrcode/mainwindow.py:503 199 | msgid "Encode" 200 | msgstr "Kodlama" 201 | 202 | #: src/gqrcode/mainwindow.py:512 203 | msgid "Homepage" 204 | msgstr "" 205 | 206 | #: src/gqrcode/mainwindow.py:517 207 | msgid "Code" 208 | msgstr "" 209 | 210 | #: src/gqrcode/mainwindow.py:518 211 | msgid "Issues" 212 | msgstr "" 213 | 214 | #: src/gqrcode/mainwindow.py:523 215 | msgid "Twitter" 216 | msgstr "" 217 | 218 | #: src/gqrcode/mainwindow.py:524 219 | msgid "Facebook" 220 | msgstr "" 221 | 222 | #: src/gqrcode/mainwindow.py:525 223 | msgid "Google+" 224 | msgstr "" 225 | 226 | #: src/gqrcode/mainwindow.py:530 227 | msgid "Donations" 228 | msgstr "" 229 | 230 | #: src/gqrcode/mainwindow.py:535 231 | msgid "About" 232 | msgstr "" 233 | 234 | #: src/gqrcode/mainwindow.py:667 235 | msgid "Creating QR Code" 236 | msgstr "" 237 | 238 | #: src/gqrcode/mainwindow.py:697 239 | msgid "File" 240 | msgstr "" 241 | 242 | #: src/gqrcode/mainwindow.py:702 243 | msgid "load file" 244 | msgstr "" 245 | 246 | #: src/gqrcode/mainwindow.py:710 247 | msgid "Save as" 248 | msgstr "Farklı Kaydet" 249 | 250 | #: src/gqrcode/mainwindow.py:726 251 | msgid "Set file to load qrcode" 252 | msgstr "Set dosya QRCode yük" 253 | 254 | #: src/gqrcode/mainwindow.py:732 src/gqrcode/mainwindow.py:767 255 | #: src/gqrcode/mainwindow.py:914 256 | msgid "png files" 257 | msgstr "" 258 | 259 | #: src/gqrcode/mainwindow.py:756 260 | #, fuzzy 261 | msgid "Set file for QR background" 262 | msgstr "Set dosya QRCode yük" 263 | 264 | #: src/gqrcode/mainwindow.py:761 265 | msgid "Image files" 266 | msgstr "" 267 | 268 | #: src/gqrcode/mainwindow.py:771 269 | msgid "jpeg files" 270 | msgstr "" 271 | 272 | #: src/gqrcode/mainwindow.py:775 src/gqrcode/mainwindow.py:934 273 | msgid "gif files" 274 | msgstr "" 275 | 276 | #: src/gqrcode/mainwindow.py:907 src/gqrcode/mainwindow.py:927 277 | msgid "Set file to save encode image" 278 | msgstr "Set dosya kodlamak görüntü kaydetmek için" 279 | 280 | #: src/gqrcode/gqrcode.py:202 281 | msgid "QRCode coder and decoder" 282 | msgstr "" 283 | 284 | #, fuzzy 285 | #~ msgid "Encoded text:" 286 | #~ msgstr "Kodlama" 287 | 288 | #~ msgid "Decode" 289 | #~ msgstr "Decode" 290 | 291 | #~ msgid "Decoded" 292 | #~ msgstr "Decoded" 293 | 294 | #~ msgid "An application to code and decode" 295 | #~ msgstr "kodu ve şifresini çözmek için bir uygulama" 296 | 297 | #~ msgid "Load qrcode image" 298 | #~ msgstr "Yük QRCode image" 299 | -------------------------------------------------------------------------------- /po/fr.po: -------------------------------------------------------------------------------- 1 | # French translations for gqrcode package. 2 | # Copyright (C) 2011 THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the gqrcode package. 4 | # Lorenzo , 2011. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: gqrcode 0.5.2\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2019-10-26 11:09+0200\n" 11 | "PO-Revision-Date: 2011-03-27 10:06+0200\n" 12 | "Last-Translator: Lorenzo \n" 13 | "Language-Team: French\n" 14 | "Language: fr\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" 19 | 20 | #: src/gqrcode/mainwindow.py:197 21 | msgid "Set text to encode: " 22 | msgstr "Encode:" 23 | 24 | #: src/gqrcode/mainwindow.py:237 25 | #, fuzzy 26 | msgid "Set number to encode:" 27 | msgstr "Encode:" 28 | 29 | #: src/gqrcode/mainwindow.py:249 30 | msgid "Set email:" 31 | msgstr "" 32 | 33 | #: src/gqrcode/mainwindow.py:261 34 | msgid "Set url:" 35 | msgstr "" 36 | 37 | #: src/gqrcode/mainwindow.py:273 38 | msgid "SSID/Network name:" 39 | msgstr "" 40 | 41 | #: src/gqrcode/mainwindow.py:282 42 | msgid "Password:" 43 | msgstr "" 44 | 45 | #: src/gqrcode/mainwindow.py:292 46 | msgid "Network type:" 47 | msgstr "" 48 | 49 | #: src/gqrcode/mainwindow.py:296 50 | msgid "WEP" 51 | msgstr "" 52 | 53 | #: src/gqrcode/mainwindow.py:297 54 | msgid "WPA/WPA2" 55 | msgstr "" 56 | 57 | #: src/gqrcode/mainwindow.py:298 58 | msgid "No encryption" 59 | msgstr "" 60 | 61 | #: src/gqrcode/mainwindow.py:311 62 | msgid "Telephone Number:" 63 | msgstr "" 64 | 65 | #: src/gqrcode/mainwindow.py:320 66 | msgid "SMS Message:" 67 | msgstr "" 68 | 69 | #: src/gqrcode/mainwindow.py:338 70 | msgid "Email:" 71 | msgstr "" 72 | 73 | #: src/gqrcode/mainwindow.py:347 74 | msgid "Subject:" 75 | msgstr "" 76 | 77 | #: src/gqrcode/mainwindow.py:356 78 | msgid "Body:" 79 | msgstr "" 80 | 81 | #: src/gqrcode/mainwindow.py:374 82 | msgid "Fist name" 83 | msgstr "" 84 | 85 | #: src/gqrcode/mainwindow.py:375 86 | msgid "Last name" 87 | msgstr "" 88 | 89 | #: src/gqrcode/mainwindow.py:376 90 | msgid "Job title" 91 | msgstr "" 92 | 93 | #: src/gqrcode/mainwindow.py:377 94 | msgid "Telephone Number (work)" 95 | msgstr "" 96 | 97 | #: src/gqrcode/mainwindow.py:378 98 | msgid "Fax Number (work)" 99 | msgstr "" 100 | 101 | #: src/gqrcode/mainwindow.py:379 102 | msgid "Cell Phone" 103 | msgstr "" 104 | 105 | #: src/gqrcode/mainwindow.py:380 106 | msgid "Email Address (work)" 107 | msgstr "" 108 | 109 | #: src/gqrcode/mainwindow.py:381 110 | msgid "Website Address" 111 | msgstr "" 112 | 113 | #: src/gqrcode/mainwindow.py:382 114 | msgid "Organization" 115 | msgstr "" 116 | 117 | #: src/gqrcode/mainwindow.py:383 118 | msgid "Street Address (work)" 119 | msgstr "" 120 | 121 | #: src/gqrcode/mainwindow.py:384 122 | msgid "City" 123 | msgstr "" 124 | 125 | #: src/gqrcode/mainwindow.py:385 126 | msgid "State" 127 | msgstr "" 128 | 129 | #: src/gqrcode/mainwindow.py:386 130 | msgid "Zip/Postcode" 131 | msgstr "" 132 | 133 | #: src/gqrcode/mainwindow.py:387 134 | msgid "Country" 135 | msgstr "" 136 | 137 | #: src/gqrcode/mainwindow.py:388 138 | msgid "Notes" 139 | msgstr "" 140 | 141 | #: src/gqrcode/mainwindow.py:456 142 | msgid "Open QR Image" 143 | msgstr "" 144 | 145 | #: src/gqrcode/mainwindow.py:461 146 | msgid "Load background" 147 | msgstr "" 148 | 149 | #: src/gqrcode/mainwindow.py:462 150 | msgid "Reset background" 151 | msgstr "" 152 | 153 | #: src/gqrcode/mainwindow.py:467 154 | #, fuzzy 155 | msgid "Save QR Image" 156 | msgstr "Enregistrer sous" 157 | 158 | #: src/gqrcode/mainwindow.py:472 159 | msgid "Close" 160 | msgstr "" 161 | 162 | #: src/gqrcode/mainwindow.py:483 163 | msgid "Text" 164 | msgstr "" 165 | 166 | #: src/gqrcode/mainwindow.py:484 167 | msgid "Geolocation" 168 | msgstr "" 169 | 170 | #: src/gqrcode/mainwindow.py:485 171 | msgid "Telephone number" 172 | msgstr "" 173 | 174 | #: src/gqrcode/mainwindow.py:486 175 | msgid "Email" 176 | msgstr "" 177 | 178 | #: src/gqrcode/mainwindow.py:487 179 | msgid "Url" 180 | msgstr "" 181 | 182 | #: src/gqrcode/mainwindow.py:488 183 | msgid "Wifi Login" 184 | msgstr "" 185 | 186 | #: src/gqrcode/mainwindow.py:489 187 | msgid "SMS" 188 | msgstr "" 189 | 190 | #: src/gqrcode/mainwindow.py:490 191 | msgid "Email message" 192 | msgstr "" 193 | 194 | #: src/gqrcode/mainwindow.py:491 195 | msgid "vCard" 196 | msgstr "" 197 | 198 | #: src/gqrcode/mainwindow.py:503 199 | msgid "Encode" 200 | msgstr "Du texte à coder" 201 | 202 | #: src/gqrcode/mainwindow.py:512 203 | msgid "Homepage" 204 | msgstr "" 205 | 206 | #: src/gqrcode/mainwindow.py:517 207 | msgid "Code" 208 | msgstr "" 209 | 210 | #: src/gqrcode/mainwindow.py:518 211 | msgid "Issues" 212 | msgstr "" 213 | 214 | #: src/gqrcode/mainwindow.py:523 215 | msgid "Twitter" 216 | msgstr "" 217 | 218 | #: src/gqrcode/mainwindow.py:524 219 | msgid "Facebook" 220 | msgstr "" 221 | 222 | #: src/gqrcode/mainwindow.py:525 223 | msgid "Google+" 224 | msgstr "" 225 | 226 | #: src/gqrcode/mainwindow.py:530 227 | msgid "Donations" 228 | msgstr "" 229 | 230 | #: src/gqrcode/mainwindow.py:535 231 | msgid "About" 232 | msgstr "" 233 | 234 | #: src/gqrcode/mainwindow.py:667 235 | msgid "Creating QR Code" 236 | msgstr "" 237 | 238 | #: src/gqrcode/mainwindow.py:697 239 | msgid "File" 240 | msgstr "" 241 | 242 | #: src/gqrcode/mainwindow.py:702 243 | msgid "load file" 244 | msgstr "" 245 | 246 | #: src/gqrcode/mainwindow.py:710 247 | msgid "Save as" 248 | msgstr "Enregistrer sous" 249 | 250 | #: src/gqrcode/mainwindow.py:726 251 | msgid "Set file to load qrcode" 252 | msgstr "Set de fichier à charger QRCode" 253 | 254 | #: src/gqrcode/mainwindow.py:732 src/gqrcode/mainwindow.py:767 255 | #: src/gqrcode/mainwindow.py:914 256 | msgid "png files" 257 | msgstr "" 258 | 259 | #: src/gqrcode/mainwindow.py:756 260 | #, fuzzy 261 | msgid "Set file for QR background" 262 | msgstr "Set de fichier à charger QRCode" 263 | 264 | #: src/gqrcode/mainwindow.py:761 265 | msgid "Image files" 266 | msgstr "" 267 | 268 | #: src/gqrcode/mainwindow.py:771 269 | msgid "jpeg files" 270 | msgstr "" 271 | 272 | #: src/gqrcode/mainwindow.py:775 src/gqrcode/mainwindow.py:934 273 | msgid "gif files" 274 | msgstr "" 275 | 276 | #: src/gqrcode/mainwindow.py:907 src/gqrcode/mainwindow.py:927 277 | msgid "Set file to save encode image" 278 | msgstr "Définir pour enregistrer le fichier image coder" 279 | 280 | #: src/gqrcode/gqrcode.py:202 281 | msgid "QRCode coder and decoder" 282 | msgstr "" 283 | 284 | #, fuzzy 285 | #~ msgid "Encoded text:" 286 | #~ msgstr "Du texte à coder" 287 | 288 | #~ msgid "Decode" 289 | #~ msgstr "Decode" 290 | 291 | #~ msgid "Decoded" 292 | #~ msgstr "décodé" 293 | 294 | #~ msgid "An application to code and decode" 295 | #~ msgstr "Une demande pour coder et décoder" 296 | 297 | #~ msgid "Load qrcode image" 298 | #~ msgstr "image QRCode charge" 299 | -------------------------------------------------------------------------------- /po/it.po: -------------------------------------------------------------------------------- 1 | # Italian translations for gqrcode package. 2 | # Copyright (C) 2011 THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the gqrcode package. 4 | # Lorenzo , 2011. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: gqrcode 0.5.2\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2019-10-26 11:09+0200\n" 11 | "PO-Revision-Date: 2011-03-27 10:06+0200\n" 12 | "Last-Translator: Lorenzo \n" 13 | "Language-Team: Italian\n" 14 | "Language: it\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 19 | 20 | #: src/gqrcode/mainwindow.py:197 21 | msgid "Set text to encode: " 22 | msgstr "Codifica:" 23 | 24 | #: src/gqrcode/mainwindow.py:237 25 | #, fuzzy 26 | msgid "Set number to encode:" 27 | msgstr "Codifica:" 28 | 29 | #: src/gqrcode/mainwindow.py:249 30 | msgid "Set email:" 31 | msgstr "" 32 | 33 | #: src/gqrcode/mainwindow.py:261 34 | msgid "Set url:" 35 | msgstr "" 36 | 37 | #: src/gqrcode/mainwindow.py:273 38 | msgid "SSID/Network name:" 39 | msgstr "" 40 | 41 | #: src/gqrcode/mainwindow.py:282 42 | msgid "Password:" 43 | msgstr "" 44 | 45 | #: src/gqrcode/mainwindow.py:292 46 | msgid "Network type:" 47 | msgstr "" 48 | 49 | #: src/gqrcode/mainwindow.py:296 50 | msgid "WEP" 51 | msgstr "" 52 | 53 | #: src/gqrcode/mainwindow.py:297 54 | msgid "WPA/WPA2" 55 | msgstr "" 56 | 57 | #: src/gqrcode/mainwindow.py:298 58 | msgid "No encryption" 59 | msgstr "" 60 | 61 | #: src/gqrcode/mainwindow.py:311 62 | msgid "Telephone Number:" 63 | msgstr "" 64 | 65 | #: src/gqrcode/mainwindow.py:320 66 | msgid "SMS Message:" 67 | msgstr "" 68 | 69 | #: src/gqrcode/mainwindow.py:338 70 | msgid "Email:" 71 | msgstr "" 72 | 73 | #: src/gqrcode/mainwindow.py:347 74 | msgid "Subject:" 75 | msgstr "" 76 | 77 | #: src/gqrcode/mainwindow.py:356 78 | msgid "Body:" 79 | msgstr "" 80 | 81 | #: src/gqrcode/mainwindow.py:374 82 | msgid "Fist name" 83 | msgstr "" 84 | 85 | #: src/gqrcode/mainwindow.py:375 86 | msgid "Last name" 87 | msgstr "" 88 | 89 | #: src/gqrcode/mainwindow.py:376 90 | msgid "Job title" 91 | msgstr "" 92 | 93 | #: src/gqrcode/mainwindow.py:377 94 | msgid "Telephone Number (work)" 95 | msgstr "" 96 | 97 | #: src/gqrcode/mainwindow.py:378 98 | msgid "Fax Number (work)" 99 | msgstr "" 100 | 101 | #: src/gqrcode/mainwindow.py:379 102 | msgid "Cell Phone" 103 | msgstr "" 104 | 105 | #: src/gqrcode/mainwindow.py:380 106 | msgid "Email Address (work)" 107 | msgstr "" 108 | 109 | #: src/gqrcode/mainwindow.py:381 110 | msgid "Website Address" 111 | msgstr "" 112 | 113 | #: src/gqrcode/mainwindow.py:382 114 | msgid "Organization" 115 | msgstr "" 116 | 117 | #: src/gqrcode/mainwindow.py:383 118 | msgid "Street Address (work)" 119 | msgstr "" 120 | 121 | #: src/gqrcode/mainwindow.py:384 122 | msgid "City" 123 | msgstr "" 124 | 125 | #: src/gqrcode/mainwindow.py:385 126 | msgid "State" 127 | msgstr "" 128 | 129 | #: src/gqrcode/mainwindow.py:386 130 | msgid "Zip/Postcode" 131 | msgstr "" 132 | 133 | #: src/gqrcode/mainwindow.py:387 134 | msgid "Country" 135 | msgstr "" 136 | 137 | #: src/gqrcode/mainwindow.py:388 138 | msgid "Notes" 139 | msgstr "" 140 | 141 | #: src/gqrcode/mainwindow.py:456 142 | msgid "Open QR Image" 143 | msgstr "" 144 | 145 | #: src/gqrcode/mainwindow.py:461 146 | msgid "Load background" 147 | msgstr "" 148 | 149 | #: src/gqrcode/mainwindow.py:462 150 | msgid "Reset background" 151 | msgstr "" 152 | 153 | #: src/gqrcode/mainwindow.py:467 154 | #, fuzzy 155 | msgid "Save QR Image" 156 | msgstr "Salva come" 157 | 158 | #: src/gqrcode/mainwindow.py:472 159 | msgid "Close" 160 | msgstr "" 161 | 162 | #: src/gqrcode/mainwindow.py:483 163 | msgid "Text" 164 | msgstr "" 165 | 166 | #: src/gqrcode/mainwindow.py:484 167 | msgid "Geolocation" 168 | msgstr "" 169 | 170 | #: src/gqrcode/mainwindow.py:485 171 | msgid "Telephone number" 172 | msgstr "" 173 | 174 | #: src/gqrcode/mainwindow.py:486 175 | msgid "Email" 176 | msgstr "" 177 | 178 | #: src/gqrcode/mainwindow.py:487 179 | msgid "Url" 180 | msgstr "" 181 | 182 | #: src/gqrcode/mainwindow.py:488 183 | msgid "Wifi Login" 184 | msgstr "" 185 | 186 | #: src/gqrcode/mainwindow.py:489 187 | msgid "SMS" 188 | msgstr "" 189 | 190 | #: src/gqrcode/mainwindow.py:490 191 | msgid "Email message" 192 | msgstr "" 193 | 194 | #: src/gqrcode/mainwindow.py:491 195 | msgid "vCard" 196 | msgstr "" 197 | 198 | #: src/gqrcode/mainwindow.py:503 199 | msgid "Encode" 200 | msgstr "Testo Set per la codifica" 201 | 202 | #: src/gqrcode/mainwindow.py:512 203 | msgid "Homepage" 204 | msgstr "" 205 | 206 | #: src/gqrcode/mainwindow.py:517 207 | msgid "Code" 208 | msgstr "" 209 | 210 | #: src/gqrcode/mainwindow.py:518 211 | msgid "Issues" 212 | msgstr "" 213 | 214 | #: src/gqrcode/mainwindow.py:523 215 | msgid "Twitter" 216 | msgstr "" 217 | 218 | #: src/gqrcode/mainwindow.py:524 219 | msgid "Facebook" 220 | msgstr "" 221 | 222 | #: src/gqrcode/mainwindow.py:525 223 | msgid "Google+" 224 | msgstr "" 225 | 226 | #: src/gqrcode/mainwindow.py:530 227 | msgid "Donations" 228 | msgstr "" 229 | 230 | #: src/gqrcode/mainwindow.py:535 231 | msgid "About" 232 | msgstr "" 233 | 234 | #: src/gqrcode/mainwindow.py:667 235 | msgid "Creating QR Code" 236 | msgstr "" 237 | 238 | #: src/gqrcode/mainwindow.py:697 239 | msgid "File" 240 | msgstr "" 241 | 242 | #: src/gqrcode/mainwindow.py:702 243 | msgid "load file" 244 | msgstr "" 245 | 246 | #: src/gqrcode/mainwindow.py:710 247 | msgid "Save as" 248 | msgstr "Salva come" 249 | 250 | #: src/gqrcode/mainwindow.py:726 251 | msgid "Set file to load qrcode" 252 | msgstr "file da caricare QRCode Set" 253 | 254 | #: src/gqrcode/mainwindow.py:732 src/gqrcode/mainwindow.py:767 255 | #: src/gqrcode/mainwindow.py:914 256 | msgid "png files" 257 | msgstr "" 258 | 259 | #: src/gqrcode/mainwindow.py:756 260 | #, fuzzy 261 | msgid "Set file for QR background" 262 | msgstr "file da caricare QRCode Set" 263 | 264 | #: src/gqrcode/mainwindow.py:761 265 | msgid "Image files" 266 | msgstr "" 267 | 268 | #: src/gqrcode/mainwindow.py:771 269 | msgid "jpeg files" 270 | msgstr "" 271 | 272 | #: src/gqrcode/mainwindow.py:775 src/gqrcode/mainwindow.py:934 273 | msgid "gif files" 274 | msgstr "" 275 | 276 | #: src/gqrcode/mainwindow.py:907 src/gqrcode/mainwindow.py:927 277 | msgid "Set file to save encode image" 278 | msgstr "Set per salvare file immagine codificare" 279 | 280 | #: src/gqrcode/gqrcode.py:202 281 | msgid "QRCode coder and decoder" 282 | msgstr "" 283 | 284 | #, fuzzy 285 | #~ msgid "Encoded text:" 286 | #~ msgstr "Testo Set per la codifica" 287 | 288 | #~ msgid "Decode" 289 | #~ msgstr "Decode" 290 | 291 | #~ msgid "Decoded" 292 | #~ msgstr "Decoded" 293 | 294 | #~ msgid "An application to code and decode" 295 | #~ msgstr "Una domanda di codificare e decodificare" 296 | 297 | #~ msgid "Load qrcode image" 298 | #~ msgstr "QRCode immagine del carico" 299 | -------------------------------------------------------------------------------- /po/ro.po: -------------------------------------------------------------------------------- 1 | # Romanian translations for gqrcode package. 2 | # Copyright (C) 2011 THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the gqrcode package. 4 | # Lorenzo , 2011. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: gqrcode 0.5.2\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2019-10-26 11:09+0200\n" 11 | "PO-Revision-Date: 2011-03-27 10:06+0200\n" 12 | "Last-Translator: Lorenzo \n" 13 | "Language-Team: Romanian\n" 14 | "Language: ro\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Plural-Forms: nplurals=3; plural=n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < " 19 | "20)) ? 1 : 2;\n" 20 | 21 | #: src/gqrcode/mainwindow.py:197 22 | msgid "Set text to encode: " 23 | msgstr "Codare:" 24 | 25 | #: src/gqrcode/mainwindow.py:237 26 | #, fuzzy 27 | msgid "Set number to encode:" 28 | msgstr "Codare:" 29 | 30 | #: src/gqrcode/mainwindow.py:249 31 | msgid "Set email:" 32 | msgstr "" 33 | 34 | #: src/gqrcode/mainwindow.py:261 35 | msgid "Set url:" 36 | msgstr "" 37 | 38 | #: src/gqrcode/mainwindow.py:273 39 | msgid "SSID/Network name:" 40 | msgstr "" 41 | 42 | #: src/gqrcode/mainwindow.py:282 43 | msgid "Password:" 44 | msgstr "" 45 | 46 | #: src/gqrcode/mainwindow.py:292 47 | msgid "Network type:" 48 | msgstr "" 49 | 50 | #: src/gqrcode/mainwindow.py:296 51 | msgid "WEP" 52 | msgstr "" 53 | 54 | #: src/gqrcode/mainwindow.py:297 55 | msgid "WPA/WPA2" 56 | msgstr "" 57 | 58 | #: src/gqrcode/mainwindow.py:298 59 | msgid "No encryption" 60 | msgstr "" 61 | 62 | #: src/gqrcode/mainwindow.py:311 63 | msgid "Telephone Number:" 64 | msgstr "" 65 | 66 | #: src/gqrcode/mainwindow.py:320 67 | msgid "SMS Message:" 68 | msgstr "" 69 | 70 | #: src/gqrcode/mainwindow.py:338 71 | msgid "Email:" 72 | msgstr "" 73 | 74 | #: src/gqrcode/mainwindow.py:347 75 | msgid "Subject:" 76 | msgstr "" 77 | 78 | #: src/gqrcode/mainwindow.py:356 79 | msgid "Body:" 80 | msgstr "" 81 | 82 | #: src/gqrcode/mainwindow.py:374 83 | msgid "Fist name" 84 | msgstr "" 85 | 86 | #: src/gqrcode/mainwindow.py:375 87 | msgid "Last name" 88 | msgstr "" 89 | 90 | #: src/gqrcode/mainwindow.py:376 91 | msgid "Job title" 92 | msgstr "" 93 | 94 | #: src/gqrcode/mainwindow.py:377 95 | msgid "Telephone Number (work)" 96 | msgstr "" 97 | 98 | #: src/gqrcode/mainwindow.py:378 99 | msgid "Fax Number (work)" 100 | msgstr "" 101 | 102 | #: src/gqrcode/mainwindow.py:379 103 | msgid "Cell Phone" 104 | msgstr "" 105 | 106 | #: src/gqrcode/mainwindow.py:380 107 | msgid "Email Address (work)" 108 | msgstr "" 109 | 110 | #: src/gqrcode/mainwindow.py:381 111 | msgid "Website Address" 112 | msgstr "" 113 | 114 | #: src/gqrcode/mainwindow.py:382 115 | msgid "Organization" 116 | msgstr "" 117 | 118 | #: src/gqrcode/mainwindow.py:383 119 | msgid "Street Address (work)" 120 | msgstr "" 121 | 122 | #: src/gqrcode/mainwindow.py:384 123 | msgid "City" 124 | msgstr "" 125 | 126 | #: src/gqrcode/mainwindow.py:385 127 | msgid "State" 128 | msgstr "" 129 | 130 | #: src/gqrcode/mainwindow.py:386 131 | msgid "Zip/Postcode" 132 | msgstr "" 133 | 134 | #: src/gqrcode/mainwindow.py:387 135 | msgid "Country" 136 | msgstr "" 137 | 138 | #: src/gqrcode/mainwindow.py:388 139 | msgid "Notes" 140 | msgstr "" 141 | 142 | #: src/gqrcode/mainwindow.py:456 143 | msgid "Open QR Image" 144 | msgstr "" 145 | 146 | #: src/gqrcode/mainwindow.py:461 147 | msgid "Load background" 148 | msgstr "" 149 | 150 | #: src/gqrcode/mainwindow.py:462 151 | msgid "Reset background" 152 | msgstr "" 153 | 154 | #: src/gqrcode/mainwindow.py:467 155 | #, fuzzy 156 | msgid "Save QR Image" 157 | msgstr "Salvare ca" 158 | 159 | #: src/gqrcode/mainwindow.py:472 160 | msgid "Close" 161 | msgstr "" 162 | 163 | #: src/gqrcode/mainwindow.py:483 164 | msgid "Text" 165 | msgstr "" 166 | 167 | #: src/gqrcode/mainwindow.py:484 168 | msgid "Geolocation" 169 | msgstr "" 170 | 171 | #: src/gqrcode/mainwindow.py:485 172 | msgid "Telephone number" 173 | msgstr "" 174 | 175 | #: src/gqrcode/mainwindow.py:486 176 | msgid "Email" 177 | msgstr "" 178 | 179 | #: src/gqrcode/mainwindow.py:487 180 | msgid "Url" 181 | msgstr "" 182 | 183 | #: src/gqrcode/mainwindow.py:488 184 | msgid "Wifi Login" 185 | msgstr "" 186 | 187 | #: src/gqrcode/mainwindow.py:489 188 | msgid "SMS" 189 | msgstr "" 190 | 191 | #: src/gqrcode/mainwindow.py:490 192 | msgid "Email message" 193 | msgstr "" 194 | 195 | #: src/gqrcode/mainwindow.py:491 196 | msgid "vCard" 197 | msgstr "" 198 | 199 | #: src/gqrcode/mainwindow.py:503 200 | msgid "Encode" 201 | msgstr "Set text pentru a codifica" 202 | 203 | #: src/gqrcode/mainwindow.py:512 204 | msgid "Homepage" 205 | msgstr "" 206 | 207 | #: src/gqrcode/mainwindow.py:517 208 | msgid "Code" 209 | msgstr "" 210 | 211 | #: src/gqrcode/mainwindow.py:518 212 | msgid "Issues" 213 | msgstr "" 214 | 215 | #: src/gqrcode/mainwindow.py:523 216 | msgid "Twitter" 217 | msgstr "" 218 | 219 | #: src/gqrcode/mainwindow.py:524 220 | msgid "Facebook" 221 | msgstr "" 222 | 223 | #: src/gqrcode/mainwindow.py:525 224 | msgid "Google+" 225 | msgstr "" 226 | 227 | #: src/gqrcode/mainwindow.py:530 228 | msgid "Donations" 229 | msgstr "" 230 | 231 | #: src/gqrcode/mainwindow.py:535 232 | msgid "About" 233 | msgstr "" 234 | 235 | #: src/gqrcode/mainwindow.py:667 236 | msgid "Creating QR Code" 237 | msgstr "" 238 | 239 | #: src/gqrcode/mainwindow.py:697 240 | msgid "File" 241 | msgstr "" 242 | 243 | #: src/gqrcode/mainwindow.py:702 244 | msgid "load file" 245 | msgstr "" 246 | 247 | #: src/gqrcode/mainwindow.py:710 248 | msgid "Save as" 249 | msgstr "Salvare ca" 250 | 251 | #: src/gqrcode/mainwindow.py:726 252 | msgid "Set file to load qrcode" 253 | msgstr "fişier setate să se încarce qrcode" 254 | 255 | #: src/gqrcode/mainwindow.py:732 src/gqrcode/mainwindow.py:767 256 | #: src/gqrcode/mainwindow.py:914 257 | msgid "png files" 258 | msgstr "" 259 | 260 | #: src/gqrcode/mainwindow.py:756 261 | #, fuzzy 262 | msgid "Set file for QR background" 263 | msgstr "fişier setate să se încarce qrcode" 264 | 265 | #: src/gqrcode/mainwindow.py:761 266 | msgid "Image files" 267 | msgstr "" 268 | 269 | #: src/gqrcode/mainwindow.py:771 270 | msgid "jpeg files" 271 | msgstr "" 272 | 273 | #: src/gqrcode/mainwindow.py:775 src/gqrcode/mainwindow.py:934 274 | msgid "gif files" 275 | msgstr "" 276 | 277 | #: src/gqrcode/mainwindow.py:907 src/gqrcode/mainwindow.py:927 278 | msgid "Set file to save encode image" 279 | msgstr "Set fişier pentru a salva imaginea codifica" 280 | 281 | #: src/gqrcode/gqrcode.py:202 282 | msgid "QRCode coder and decoder" 283 | msgstr "" 284 | 285 | #, fuzzy 286 | #~ msgid "Encoded text:" 287 | #~ msgstr "Set text pentru a codifica" 288 | 289 | #~ msgid "Decode" 290 | #~ msgstr "Decode" 291 | 292 | #~ msgid "Decoded" 293 | #~ msgstr "decodate" 294 | 295 | #~ msgid "An application to code and decode" 296 | #~ msgstr "O cerere de cod şi a decoda" 297 | 298 | #~ msgid "Load qrcode image" 299 | #~ msgstr "qrcode imagine de încărcare" 300 | -------------------------------------------------------------------------------- /po/es.po: -------------------------------------------------------------------------------- 1 | # Spanish translations for gqrcode package. 2 | # Copyright (C) 2011 THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the gqrcode package. 4 | # Lorenzo , 2011. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: gqrcode 0.5.2\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2019-10-26 11:09+0200\n" 11 | "PO-Revision-Date: 2011-03-27 10:06+0200\n" 12 | "Last-Translator: Lorenzo Carbonell\n" 13 | "Language-Team: Spanish\n" 14 | "Language: es\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 19 | 20 | #: src/gqrcode/mainwindow.py:197 21 | msgid "Set text to encode: " 22 | msgstr "Introduce el texto a cifrar:" 23 | 24 | #: src/gqrcode/mainwindow.py:237 25 | #, fuzzy 26 | msgid "Set number to encode:" 27 | msgstr "Introduce el número a cifrar:" 28 | 29 | #: src/gqrcode/mainwindow.py:249 30 | msgid "Set email:" 31 | msgstr "Introduce el correo electrónico:" 32 | 33 | #: src/gqrcode/mainwindow.py:261 34 | msgid "Set url:" 35 | msgstr "Introduce url:" 36 | 37 | #: src/gqrcode/mainwindow.py:273 38 | msgid "SSID/Network name:" 39 | msgstr "Nombre de la red/SSID" 40 | 41 | #: src/gqrcode/mainwindow.py:282 42 | msgid "Password:" 43 | msgstr "Contraseña:" 44 | 45 | #: src/gqrcode/mainwindow.py:292 46 | msgid "Network type:" 47 | msgstr "Tipo de red:" 48 | 49 | #: src/gqrcode/mainwindow.py:296 50 | msgid "WEP" 51 | msgstr "WEP" 52 | 53 | #: src/gqrcode/mainwindow.py:297 54 | msgid "WPA/WPA2" 55 | msgstr "WPA/WPA2" 56 | 57 | #: src/gqrcode/mainwindow.py:298 58 | msgid "No encryption" 59 | msgstr "Sin cifrar" 60 | 61 | #: src/gqrcode/mainwindow.py:311 62 | #, fuzzy 63 | msgid "Telephone Number:" 64 | msgstr "Número de teléfono" 65 | 66 | #: src/gqrcode/mainwindow.py:320 67 | msgid "SMS Message:" 68 | msgstr "Mensaje SMS:" 69 | 70 | #: src/gqrcode/mainwindow.py:338 71 | #, fuzzy 72 | msgid "Email:" 73 | msgstr "Correo electrónico" 74 | 75 | #: src/gqrcode/mainwindow.py:347 76 | msgid "Subject:" 77 | msgstr "Asunto:" 78 | 79 | #: src/gqrcode/mainwindow.py:356 80 | msgid "Body:" 81 | msgstr "Cuerpo:" 82 | 83 | #: src/gqrcode/mainwindow.py:374 84 | msgid "Fist name" 85 | msgstr "Nombre" 86 | 87 | #: src/gqrcode/mainwindow.py:375 88 | msgid "Last name" 89 | msgstr "Apellido" 90 | 91 | #: src/gqrcode/mainwindow.py:376 92 | msgid "Job title" 93 | msgstr "Puesto de trabajo" 94 | 95 | #: src/gqrcode/mainwindow.py:377 96 | #, fuzzy 97 | msgid "Telephone Number (work)" 98 | msgstr "Número de teléfono (trabajo)" 99 | 100 | #: src/gqrcode/mainwindow.py:378 101 | msgid "Fax Number (work)" 102 | msgstr "Número de fax (trabajo)" 103 | 104 | #: src/gqrcode/mainwindow.py:379 105 | msgid "Cell Phone" 106 | msgstr "Número de móvil" 107 | 108 | #: src/gqrcode/mainwindow.py:380 109 | msgid "Email Address (work)" 110 | msgstr "Correo electrónico (trabajo)" 111 | 112 | #: src/gqrcode/mainwindow.py:381 113 | msgid "Website Address" 114 | msgstr "Página web" 115 | 116 | #: src/gqrcode/mainwindow.py:382 117 | msgid "Organization" 118 | msgstr "Organización" 119 | 120 | #: src/gqrcode/mainwindow.py:383 121 | msgid "Street Address (work)" 122 | msgstr "Dirección (trabajo)" 123 | 124 | #: src/gqrcode/mainwindow.py:384 125 | msgid "City" 126 | msgstr "Ciudad" 127 | 128 | #: src/gqrcode/mainwindow.py:385 129 | msgid "State" 130 | msgstr "Estado" 131 | 132 | #: src/gqrcode/mainwindow.py:386 133 | msgid "Zip/Postcode" 134 | msgstr "Código postal" 135 | 136 | #: src/gqrcode/mainwindow.py:387 137 | msgid "Country" 138 | msgstr "País" 139 | 140 | #: src/gqrcode/mainwindow.py:388 141 | msgid "Notes" 142 | msgstr "Notas" 143 | 144 | #: src/gqrcode/mainwindow.py:456 145 | msgid "Open QR Image" 146 | msgstr "Abrir imagen QR" 147 | 148 | #: src/gqrcode/mainwindow.py:461 149 | msgid "Load background" 150 | msgstr "Cargar fondo" 151 | 152 | #: src/gqrcode/mainwindow.py:462 153 | msgid "Reset background" 154 | msgstr "Quitar fondo" 155 | 156 | #: src/gqrcode/mainwindow.py:467 157 | #, fuzzy 158 | msgid "Save QR Image" 159 | msgstr "Guardar imagen QR" 160 | 161 | #: src/gqrcode/mainwindow.py:472 162 | msgid "Close" 163 | msgstr "Cerrar" 164 | 165 | #: src/gqrcode/mainwindow.py:483 166 | msgid "Text" 167 | msgstr "Texto" 168 | 169 | #: src/gqrcode/mainwindow.py:484 170 | msgid "Geolocation" 171 | msgstr "Geolocalización" 172 | 173 | #: src/gqrcode/mainwindow.py:485 174 | msgid "Telephone number" 175 | msgstr "Número de teléfono" 176 | 177 | #: src/gqrcode/mainwindow.py:486 178 | msgid "Email" 179 | msgstr "Correo electrónico" 180 | 181 | #: src/gqrcode/mainwindow.py:487 182 | msgid "Url" 183 | msgstr "Url" 184 | 185 | #: src/gqrcode/mainwindow.py:488 186 | msgid "Wifi Login" 187 | msgstr "Contraseña WiFi" 188 | 189 | #: src/gqrcode/mainwindow.py:489 190 | msgid "SMS" 191 | msgstr "SMS" 192 | 193 | #: src/gqrcode/mainwindow.py:490 194 | msgid "Email message" 195 | msgstr "Mensaje vía correo electrónico" 196 | 197 | #: src/gqrcode/mainwindow.py:491 198 | msgid "vCard" 199 | msgstr "Tarjeta electrónica" 200 | 201 | #: src/gqrcode/mainwindow.py:503 202 | msgid "Encode" 203 | msgstr "Cifrar" 204 | 205 | #: src/gqrcode/mainwindow.py:512 206 | msgid "Homepage" 207 | msgstr "Página principal" 208 | 209 | #: src/gqrcode/mainwindow.py:517 210 | msgid "Code" 211 | msgstr "Código" 212 | 213 | #: src/gqrcode/mainwindow.py:518 214 | msgid "Issues" 215 | msgstr "Errores" 216 | 217 | #: src/gqrcode/mainwindow.py:523 218 | msgid "Twitter" 219 | msgstr "Twitter" 220 | 221 | #: src/gqrcode/mainwindow.py:524 222 | msgid "Facebook" 223 | msgstr "Facebook" 224 | 225 | #: src/gqrcode/mainwindow.py:525 226 | msgid "Google+" 227 | msgstr "Google+" 228 | 229 | #: src/gqrcode/mainwindow.py:530 230 | #, fuzzy 231 | msgid "Donations" 232 | msgstr "Donaciones" 233 | 234 | #: src/gqrcode/mainwindow.py:535 235 | msgid "About" 236 | msgstr "Acerca de..." 237 | 238 | #: src/gqrcode/mainwindow.py:667 239 | msgid "Creating QR Code" 240 | msgstr "Crear código QR" 241 | 242 | #: src/gqrcode/mainwindow.py:697 243 | msgid "File" 244 | msgstr "Archivo" 245 | 246 | #: src/gqrcode/mainwindow.py:702 247 | msgid "load file" 248 | msgstr "cargar archivo" 249 | 250 | #: src/gqrcode/mainwindow.py:710 251 | msgid "Save as" 252 | msgstr "Guardar como" 253 | 254 | #: src/gqrcode/mainwindow.py:726 255 | msgid "Set file to load qrcode" 256 | msgstr "Establecer el archivo para cargar qrcode" 257 | 258 | #: src/gqrcode/mainwindow.py:732 src/gqrcode/mainwindow.py:767 259 | #: src/gqrcode/mainwindow.py:914 260 | msgid "png files" 261 | msgstr "Imágenes PNG" 262 | 263 | #: src/gqrcode/mainwindow.py:756 264 | #, fuzzy 265 | msgid "Set file for QR background" 266 | msgstr "Establecer el archivo para cargar qrcode" 267 | 268 | #: src/gqrcode/mainwindow.py:761 269 | #, fuzzy 270 | msgid "Image files" 271 | msgstr "Imágenes PNG" 272 | 273 | #: src/gqrcode/mainwindow.py:771 274 | #, fuzzy 275 | msgid "jpeg files" 276 | msgstr "Imágenes PNG" 277 | 278 | #: src/gqrcode/mainwindow.py:775 src/gqrcode/mainwindow.py:934 279 | #, fuzzy 280 | msgid "gif files" 281 | msgstr "Imágenes GIF" 282 | 283 | #: src/gqrcode/mainwindow.py:907 src/gqrcode/mainwindow.py:927 284 | msgid "Set file to save encode image" 285 | msgstr "Establecer el archivo para guardar la imagen cifrada" 286 | 287 | #: src/gqrcode/gqrcode.py:202 288 | msgid "QRCode coder and decoder" 289 | msgstr "QRCode cifra y descifra" 290 | -------------------------------------------------------------------------------- /po/gl.po: -------------------------------------------------------------------------------- 1 | # Galician translations for gqrcode package. 2 | # Copyright (C) 2011 THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the gqrcode package. 4 | # Lorenzo , 2011. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: gqrcode 0.5.2\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2019-10-26 11:09+0200\n" 11 | "PO-Revision-Date: 2016-05-30 17:25+0100\n" 12 | "Last-Translator: Manuel X. Lemos \n" 13 | "Language-Team: Galician\n" 14 | "Language: gl\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "X-Generator: Poedit 1.5.4\n" 19 | 20 | #: src/gqrcode/mainwindow.py:197 21 | msgid "Set text to encode: " 22 | msgstr "Texto para codificar:" 23 | 24 | #: src/gqrcode/mainwindow.py:237 25 | msgid "Set number to encode:" 26 | msgstr "Número para codificar:" 27 | 28 | #: src/gqrcode/mainwindow.py:249 29 | msgid "Set email:" 30 | msgstr "Correo-e para codificar:" 31 | 32 | #: src/gqrcode/mainwindow.py:261 33 | msgid "Set url:" 34 | msgstr "Enderezo web:" 35 | 36 | #: src/gqrcode/mainwindow.py:273 37 | msgid "SSID/Network name:" 38 | msgstr "SSID/Nome de rede:" 39 | 40 | #: src/gqrcode/mainwindow.py:282 41 | msgid "Password:" 42 | msgstr "Contrasinal:" 43 | 44 | #: src/gqrcode/mainwindow.py:292 45 | msgid "Network type:" 46 | msgstr "Tipo de rede:" 47 | 48 | #: src/gqrcode/mainwindow.py:296 49 | msgid "WEP" 50 | msgstr "WEP" 51 | 52 | #: src/gqrcode/mainwindow.py:297 53 | msgid "WPA/WPA2" 54 | msgstr "WPA/WPA2" 55 | 56 | #: src/gqrcode/mainwindow.py:298 57 | msgid "No encryption" 58 | msgstr "Aberta" 59 | 60 | #: src/gqrcode/mainwindow.py:311 61 | #, fuzzy 62 | msgid "Telephone Number:" 63 | msgstr "Teléfono" 64 | 65 | #: src/gqrcode/mainwindow.py:320 66 | msgid "SMS Message:" 67 | msgstr "" 68 | 69 | #: src/gqrcode/mainwindow.py:338 70 | #, fuzzy 71 | msgid "Email:" 72 | msgstr "Correo-e" 73 | 74 | #: src/gqrcode/mainwindow.py:347 75 | msgid "Subject:" 76 | msgstr "" 77 | 78 | #: src/gqrcode/mainwindow.py:356 79 | msgid "Body:" 80 | msgstr "" 81 | 82 | #: src/gqrcode/mainwindow.py:374 83 | msgid "Fist name" 84 | msgstr "" 85 | 86 | #: src/gqrcode/mainwindow.py:375 87 | msgid "Last name" 88 | msgstr "" 89 | 90 | #: src/gqrcode/mainwindow.py:376 91 | msgid "Job title" 92 | msgstr "" 93 | 94 | #: src/gqrcode/mainwindow.py:377 95 | #, fuzzy 96 | msgid "Telephone Number (work)" 97 | msgstr "Teléfono" 98 | 99 | #: src/gqrcode/mainwindow.py:378 100 | msgid "Fax Number (work)" 101 | msgstr "" 102 | 103 | #: src/gqrcode/mainwindow.py:379 104 | msgid "Cell Phone" 105 | msgstr "" 106 | 107 | #: src/gqrcode/mainwindow.py:380 108 | msgid "Email Address (work)" 109 | msgstr "" 110 | 111 | #: src/gqrcode/mainwindow.py:381 112 | msgid "Website Address" 113 | msgstr "" 114 | 115 | #: src/gqrcode/mainwindow.py:382 116 | msgid "Organization" 117 | msgstr "" 118 | 119 | #: src/gqrcode/mainwindow.py:383 120 | msgid "Street Address (work)" 121 | msgstr "" 122 | 123 | #: src/gqrcode/mainwindow.py:384 124 | msgid "City" 125 | msgstr "" 126 | 127 | #: src/gqrcode/mainwindow.py:385 128 | msgid "State" 129 | msgstr "" 130 | 131 | #: src/gqrcode/mainwindow.py:386 132 | msgid "Zip/Postcode" 133 | msgstr "" 134 | 135 | #: src/gqrcode/mainwindow.py:387 136 | msgid "Country" 137 | msgstr "" 138 | 139 | #: src/gqrcode/mainwindow.py:388 140 | msgid "Notes" 141 | msgstr "" 142 | 143 | #: src/gqrcode/mainwindow.py:456 144 | msgid "Open QR Image" 145 | msgstr "" 146 | 147 | #: src/gqrcode/mainwindow.py:461 148 | msgid "Load background" 149 | msgstr "" 150 | 151 | #: src/gqrcode/mainwindow.py:462 152 | msgid "Reset background" 153 | msgstr "" 154 | 155 | #: src/gqrcode/mainwindow.py:467 156 | #, fuzzy 157 | msgid "Save QR Image" 158 | msgstr "Gardar como" 159 | 160 | #: src/gqrcode/mainwindow.py:472 161 | msgid "Close" 162 | msgstr "" 163 | 164 | #: src/gqrcode/mainwindow.py:483 165 | msgid "Text" 166 | msgstr "Texto" 167 | 168 | #: src/gqrcode/mainwindow.py:484 169 | msgid "Geolocation" 170 | msgstr "Xeolocalización" 171 | 172 | #: src/gqrcode/mainwindow.py:485 173 | msgid "Telephone number" 174 | msgstr "Teléfono" 175 | 176 | #: src/gqrcode/mainwindow.py:486 177 | msgid "Email" 178 | msgstr "Correo-e" 179 | 180 | #: src/gqrcode/mainwindow.py:487 181 | msgid "Url" 182 | msgstr "Web" 183 | 184 | #: src/gqrcode/mainwindow.py:488 185 | msgid "Wifi Login" 186 | msgstr "WiFi" 187 | 188 | #: src/gqrcode/mainwindow.py:489 189 | msgid "SMS" 190 | msgstr "" 191 | 192 | #: src/gqrcode/mainwindow.py:490 193 | msgid "Email message" 194 | msgstr "" 195 | 196 | #: src/gqrcode/mainwindow.py:491 197 | msgid "vCard" 198 | msgstr "" 199 | 200 | #: src/gqrcode/mainwindow.py:503 201 | msgid "Encode" 202 | msgstr "Codificar" 203 | 204 | #: src/gqrcode/mainwindow.py:512 205 | msgid "Homepage" 206 | msgstr "Páxina web" 207 | 208 | #: src/gqrcode/mainwindow.py:517 209 | msgid "Code" 210 | msgstr "" 211 | 212 | #: src/gqrcode/mainwindow.py:518 213 | msgid "Issues" 214 | msgstr "" 215 | 216 | #: src/gqrcode/mainwindow.py:523 217 | msgid "Twitter" 218 | msgstr "" 219 | 220 | #: src/gqrcode/mainwindow.py:524 221 | msgid "Facebook" 222 | msgstr "" 223 | 224 | #: src/gqrcode/mainwindow.py:525 225 | msgid "Google+" 226 | msgstr "" 227 | 228 | #: src/gqrcode/mainwindow.py:530 229 | #, fuzzy 230 | msgid "Donations" 231 | msgstr "Xeolocalización" 232 | 233 | #: src/gqrcode/mainwindow.py:535 234 | msgid "About" 235 | msgstr "Sobre" 236 | 237 | #: src/gqrcode/mainwindow.py:667 238 | msgid "Creating QR Code" 239 | msgstr "" 240 | 241 | #: src/gqrcode/mainwindow.py:697 242 | msgid "File" 243 | msgstr "Ficheiro" 244 | 245 | #: src/gqrcode/mainwindow.py:702 246 | msgid "load file" 247 | msgstr "Cargar ficheiro" 248 | 249 | #: src/gqrcode/mainwindow.py:710 250 | msgid "Save as" 251 | msgstr "Gardar como" 252 | 253 | #: src/gqrcode/mainwindow.py:726 254 | msgid "Set file to load qrcode" 255 | msgstr "conxunto de arquivos para cargar o QRCode" 256 | 257 | #: src/gqrcode/mainwindow.py:732 src/gqrcode/mainwindow.py:767 258 | #: src/gqrcode/mainwindow.py:914 259 | msgid "png files" 260 | msgstr "ficheiros png" 261 | 262 | #: src/gqrcode/mainwindow.py:756 263 | #, fuzzy 264 | msgid "Set file for QR background" 265 | msgstr "conxunto de arquivos para cargar o QRCode" 266 | 267 | #: src/gqrcode/mainwindow.py:761 268 | #, fuzzy 269 | msgid "Image files" 270 | msgstr "ficheiros png" 271 | 272 | #: src/gqrcode/mainwindow.py:771 273 | #, fuzzy 274 | msgid "jpeg files" 275 | msgstr "ficheiros png" 276 | 277 | #: src/gqrcode/mainwindow.py:775 src/gqrcode/mainwindow.py:934 278 | #, fuzzy 279 | msgid "gif files" 280 | msgstr "ficheiros png" 281 | 282 | #: src/gqrcode/mainwindow.py:907 src/gqrcode/mainwindow.py:927 283 | msgid "Set file to save encode image" 284 | msgstr "conxunto de arquivos para gardar a imaxe codificar" 285 | 286 | #: src/gqrcode/gqrcode.py:202 287 | msgid "QRCode coder and decoder" 288 | msgstr "" 289 | 290 | #~ msgid "Encoded text:" 291 | #~ msgstr "Texto codificado:" 292 | 293 | #~ msgid "Decode" 294 | #~ msgstr "Decodificar" 295 | 296 | #~ msgid "Decoded" 297 | #~ msgstr "Decodificado" 298 | 299 | #~ msgid "Help" 300 | #~ msgstr "Axuda" 301 | 302 | #~ msgid "Get help online..." 303 | #~ msgstr "Axuda en liña..." 304 | 305 | #~ msgid "Translate this application..." 306 | #~ msgstr "Traduce este aplicativo..." 307 | 308 | #~ msgid "Report a bug..." 309 | #~ msgstr "Informa dun erro..." 310 | 311 | #~ msgid "Follow me in Twitter" 312 | #~ msgstr "Ségueme en Twitter" 313 | 314 | #~ msgid "Follow me in Google+" 315 | #~ msgstr "Ségueme en Google+" 316 | 317 | #~ msgid "Follow me in Facebook" 318 | #~ msgstr "Ségueme en Facebook" 319 | 320 | #~ msgid "An application to code and decode" 321 | #~ msgstr "Unha aplicación para codificar e decodificar" 322 | 323 | #~ msgid "Load qrcode image" 324 | #~ msgstr "imaxe qrcode Carga" 325 | -------------------------------------------------------------------------------- /src/gqrcode/myqr.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # This file is part of GQRCode 5 | # 6 | # Copyright (c) 2012-2019 Lorenzo Carbonell Cerezo 7 | # 8 | # Permission is hereby granted, free of charge, to any person obtaining a copy 9 | # of this software and associated documentation files (the "Software"), to deal 10 | # in the Software without restriction, including without limitation the rights 11 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | # copies of the Software, and to permit persons to whom the Software is 13 | # furnished to do so, subject to the following conditions: 14 | # 15 | # The above copyright notice and this permission notice shall be included in all 16 | # copies or substantial portions of the Software. 17 | # 18 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | # SOFTWARE. 25 | 26 | import gi 27 | try: 28 | gi.require_version('GdkPixbuf', '2.0') 29 | gi.require_version('GLib', '2.0') 30 | except Exception as e: 31 | print(e) 32 | exit(1) 33 | from gi.repository import GdkPixbuf 34 | from gi.repository import GLib 35 | import os 36 | from .mylibs import theqrmodule 37 | from .mylibs.draw import image2pixbuf, pixbuf2image 38 | from .gif import get_frames 39 | from PIL import Image 40 | from PIL import ImageSequence 41 | from PIL import ImageEnhance 42 | 43 | # Positional parameters 44 | # words: str 45 | # 46 | # Optional parameters 47 | # version: int, from 1 to 40 48 | # level: str, just one of ('L','M','Q','H') 49 | # picutre: str, a filename of a image 50 | # colorized: bool 51 | # constrast: float 52 | # brightness: float 53 | # save_name: str, the output filename like 'example.png' 54 | # save_dir: str, the output directory 55 | # 56 | # See [https://github.com/sylnsfar/qrcode] for more details! 57 | 58 | 59 | def convert_w2t(image): 60 | image = image.convert('RGBA') 61 | newData = [] 62 | for item in image.getdata(): 63 | if item[0] == 255 and item[1] == 255 and item[2] == 255: 64 | newData.append((255, 255, 255, 0)) 65 | else: 66 | newData.append(item) 67 | image.putdata(newData) 68 | return image 69 | 70 | 71 | def paste(background, qr): 72 | newData = [] 73 | for index, item in enumerate(qr.getdata()): 74 | if item[0] == 0 and item[1] == 0 and item[2] == 0: 75 | newData.append((0, 0, 0, 0)) 76 | else: 77 | item = background.getdata()[index] 78 | newData.append(item) 79 | background.putdata(newData) 80 | return background 81 | 82 | 83 | def get_gif_rate(filename): 84 | image = Image.open(filename) 85 | frames = 0 86 | durations = [] 87 | for frame in ImageSequence.Iterator(image): 88 | try: 89 | frames += 1 90 | durations.append(frame.info['duration']/1000.0) 91 | except Exception as e: 92 | print(e) 93 | if len(durations) == 0: 94 | return None 95 | return float(frames)/sum(durations) 96 | 97 | 98 | def combine_pilimage(ver, qr, filename, colorized, contrast, brightness): 99 | width, height = qr.size 100 | layer0 = Image.new('RGBA', qr.size, (0, 0, 0, 0)) 101 | print(filename, type(filename)) 102 | print(Image, type(Image)) 103 | if isinstance(filename, GdkPixbuf.Pixbuf): 104 | layer1 = pixbuf2image(filename) 105 | elif isinstance(filename, Image.Image): 106 | layer1 = filename.convert('RGBA') 107 | else: 108 | layer1 = Image.open(filename) 109 | layer1 = layer1.convert('RGBA') 110 | layer1 = ImageEnhance.Contrast(layer1).enhance(contrast) 111 | layer1 = ImageEnhance.Brightness(layer1).enhance(brightness) 112 | layer1 = layer1.resize((int(width * 0.8), int(height * 0.8)), 113 | Image.BICUBIC) 114 | layer0.paste(layer1, (int(width * 0.1), int(height * 0.1))) 115 | background = Image.blend( 116 | layer0, Image.new('RGBA', qr.size, (255, 255, 255, 255)), 0.3) 117 | background = Image.alpha_composite(background, convert_w2t(qr)) 118 | 119 | return background 120 | 121 | 122 | def create_qr(words, version=1, level='H', picture=None, colorized=False, 123 | contrast=1.0, brightness=1.0, progreso=None): 124 | print('----', picture, '----') 125 | supported_chars = r"0123456789ABCDEFGHIJKLMNÑOPQRSTUVWXYZabcdefghijklmnñop\ 126 | qrstuvwxyz ··,.:;+-*/\~!@#$%^&`'=<>[]()?_{}|" 127 | 128 | # check every parameter 129 | if not isinstance(words, str) or\ 130 | any(i not in supported_chars for i in words): 131 | raise ValueError( 132 | 'Wrong words! Make sure the characters are supported!') 133 | if not isinstance(version, int) or version not in range(1, 41): 134 | raise ValueError( 135 | 'Wrong version! Please choose a int-type value from 1 to 40!') 136 | if not isinstance(level, str) or len(level) > 1 or level not in 'LMQH': 137 | raise ValueError( 138 | "Wrong level! Please choose a level from {'L','M','Q','H'}!") 139 | if picture: 140 | if not isinstance(picture, str) or not os.path.isfile(picture) or\ 141 | picture[-4:] not in ('.jpg', '.png', '.bmp', '.gif'): 142 | raise ValueError( 143 | "Wrong picture! Input a filename that exists and be tailed\ 144 | with one of {'.jpg', '.png', '.bmp', '.gif'}!") 145 | if not isinstance(colorized, bool): 146 | raise ValueError('Wrong colorized! Input a bool-type value!') 147 | if not isinstance(contrast, float): 148 | raise ValueError('Wrong contrast! Input a float-type value!') 149 | if not isinstance(brightness, float): 150 | raise ValueError('Wrong brightness! Input a float-type value!') 151 | try: 152 | ver, pilimage = theqrmodule.get_qrcode_pilimage(version, level, words) 153 | if picture and picture[-4:] == '.gif': 154 | rate = get_gif_rate(picture) 155 | if rate is None: 156 | if progreso is not None: 157 | GLib.idle_add(progreso.set_max_value, 1) 158 | qr = combine_pilimage(ver, pilimage, picture, colorized, 159 | contrast, brightness) 160 | if progreso is not None: 161 | GLib.idle_add(progreso.increase) 162 | GLib.idle_add(progreso.close) 163 | return image2pixbuf(qr), None 164 | frames = get_frames(picture) 165 | width, height = Image.open(picture).size 166 | simpleanim = GdkPixbuf.PixbufSimpleAnim.new(width, 167 | height, 168 | rate) 169 | image_frames = [] 170 | if progreso is not None: 171 | GLib.idle_add(progreso.set_max_value, len(frames)) 172 | for index, frame in enumerate(frames): 173 | print('Adding frame number: {0}'.format(index)) 174 | image_frame = combine_pilimage(ver, pilimage, frame, 175 | colorized, contrast, 176 | brightness) 177 | image_frames.append(image_frame) 178 | simpleanim.add_frame(image2pixbuf(image_frame)) 179 | if progreso is not None: 180 | GLib.idle_add(progreso.increase) 181 | if progreso is not None: 182 | GLib.idle_add(progreso.close) 183 | return simpleanim, image_frames 184 | elif picture: 185 | if progreso is not None: 186 | GLib.idle_add(progreso.set_max_value, 1) 187 | qr = combine_pilimage(ver, pilimage, picture, colorized, contrast, 188 | brightness) 189 | if progreso is not None: 190 | GLib.idle_add(progreso.increase) 191 | GLib.idle_add(progreso.close) 192 | return image2pixbuf(qr), None 193 | if progreso is not None: 194 | GLib.idle_add(progreso.set_max_value, 1) 195 | GLib.idle_add(progreso.increase) 196 | GLib.idle_add(progreso.close) 197 | return image2pixbuf(pilimage), None 198 | except Exception as e: 199 | print(e) 200 | -------------------------------------------------------------------------------- /src/gqrcode/gqrcode.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # This file is part of GQRCode 5 | # 6 | # Copyright (c) 2012-2019 Lorenzo Carbonell Cerezo 7 | # 8 | # Permission is hereby granted, free of charge, to any person obtaining a copy 9 | # of this software and associated documentation files (the "Software"), to deal 10 | # in the Software without restriction, including without limitation the rights 11 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | # copies of the Software, and to permit persons to whom the Software is 13 | # furnished to do so, subject to the following conditions: 14 | # 15 | # The above copyright notice and this permission notice shall be included in all 16 | # copies or substantial portions of the Software. 17 | # 18 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | # SOFTWARE. 25 | 26 | import gi 27 | try: 28 | gi.require_version('Gtk', '3.0') 29 | gi.require_version('Gdk', '3.0') 30 | gi.require_version('Gio', '2.0') 31 | gi.require_version('GLib', '2.0') 32 | gi.require_version('GObject', '2.0') 33 | gi.require_version('GdkPixbuf', '2.0') 34 | except Exception as e: 35 | print(e) 36 | exit(1) 37 | from gi.repository import Gtk 38 | from gi.repository import Gio 39 | from gi.repository import GLib 40 | from gi.repository import GdkPixbuf 41 | import webbrowser 42 | from .mainwindow import MainWindow 43 | from . import comun 44 | from .comun import _ 45 | 46 | 47 | class MainApplication(Gtk.Application): 48 | def __init__(self): 49 | Gtk.Application.__init__( 50 | self, 51 | application_id='es.atareao.gqrcode', 52 | flags=Gio.ApplicationFlags.FLAGS_NONE 53 | ) 54 | self.license_type = Gtk.License.GPL_3_0 55 | 56 | def do_shutdown(self): 57 | Gtk.Application.do_shutdown(self) 58 | 59 | def on_quit(self, widget, data): 60 | self.quit() 61 | 62 | def do_startup(self): 63 | Gtk.Application.do_startup(self) 64 | 65 | def create_action(name, 66 | callback=self.action_clicked, 67 | var_type=None, 68 | value=None): 69 | if var_type is None: 70 | action = Gio.SimpleAction.new(name, None) 71 | else: 72 | action = Gio.SimpleAction.new_stateful( 73 | name, 74 | GLib.VariantType.new(var_type), 75 | GLib.Variant(var_type, value) 76 | ) 77 | action.connect('activate', callback) 78 | return action 79 | 80 | self.add_action(create_action("quit", callback=lambda *_: self.quit())) 81 | 82 | self.set_accels_for_action('app.add', ['A']) 83 | self.set_accels_for_action('app.open', ['O']) 84 | self.set_accels_for_action('app.quit', ['Q']) 85 | self.set_accels_for_action('app.about', ['F']) 86 | 87 | self.add_action(create_action( 88 | 'open', 89 | callback=self.on_headbar_clicked)) 90 | self.add_action(create_action( 91 | 'load', 92 | callback=self.on_headbar_clicked)) 93 | self.add_action(create_action( 94 | 'reset', 95 | callback=self.on_headbar_clicked)) 96 | self.add_action(create_action( 97 | 'close', 98 | callback=self.on_headbar_clicked)) 99 | self.add_action(create_action( 100 | 'save', 101 | callback=self.on_headbar_clicked)) 102 | self.add_action(create_action( 103 | 'save_as', 104 | callback=self.on_headbar_clicked)) 105 | 106 | self.add_action(create_action( 107 | 'goto_homepage', 108 | callback=lambda x, y: webbrowser.open( 109 | 'https://www.atareao.es/'))) 110 | self.add_action(create_action( 111 | 'goto_code', 112 | callback=lambda x, y: webbrowser.open( 113 | 'https://github.com/atareao/gqrcode'))) 114 | self.add_action(create_action( 115 | 'goto_bug', 116 | callback=lambda x, y: webbrowser.open( 117 | 'https://github.com/atareao/gqrcode/issues'))) 118 | self.add_action(create_action( 119 | 'goto_sugestion', 120 | callback=lambda x, y: webbrowser.open( 121 | 'https://blueprints.launchpad.net/gqrcode'))) 122 | self.add_action(create_action( 123 | 'goto_translation', 124 | callback=lambda x, y: webbrowser.open( 125 | 'https://translations.launchpad.net/gqrcode'))) 126 | self.add_action(create_action( 127 | 'goto_questions', 128 | callback=lambda x, y: webbrowser.open( 129 | 'https://answers.launchpad.net/gqrcode'))) 130 | self.add_action(create_action( 131 | 'goto_twitter', 132 | callback=lambda x, y: webbrowser.open( 133 | 'https://twitter.com/atareao'))) 134 | self.add_action(create_action( 135 | 'goto_google_plus', 136 | callback=lambda x, y: webbrowser.open( 137 | 'https://plus.google.com/\ 138 | 118214486317320563625/posts'))) 139 | self.add_action(create_action( 140 | 'goto_facebook', 141 | callback=lambda x, y: webbrowser.open( 142 | 'http://www.facebook.com/elatareao'))) 143 | self.add_action(create_action( 144 | 'goto_donate', 145 | callback=lambda x, y: webbrowser.open( 146 | 'https://www.atareao.es/donar/'))) 147 | self.add_action(create_action( 148 | 'about', 149 | callback=self.on_about_activate)) 150 | self.add_action(create_action( 151 | 'none', 152 | callback=self.do_none)) 153 | action_toggle = Gio.SimpleAction.new_stateful( 154 | "toggle", None, GLib.Variant.new_boolean(False)) 155 | action_toggle.connect("change-state", self.toggle_toggled) 156 | self.add_action(action_toggle) 157 | 158 | lbl_variant = GLib.Variant.new_string("h3") 159 | new_action = Gio.SimpleAction.new_stateful("new", 160 | lbl_variant.get_type(), 161 | lbl_variant) 162 | new_action.connect("activate", self.activate_radio) 163 | new_action.connect("change-state", self.toggle_heading) 164 | self.add_action(new_action) 165 | 166 | action_heading = Gio.SimpleAction.new_stateful( 167 | "heading", 168 | GLib.VariantType.new("s"), 169 | GLib.Variant("s", "h1")) 170 | action_heading.connect("activate", self.activate_radio) 171 | action_heading.connect("change-state", self.toggle_heading) 172 | self.add_action(action_heading) 173 | 174 | def activate_radio(self, widget, action, parameter=None): 175 | self.win.menu['lists'].set_label(action.get_string()) 176 | widget.set_state(action) 177 | 178 | def heading(self, action): 179 | print(action) 180 | 181 | def toggle_heading(self, action, state): 182 | print(action, state) 183 | 184 | def do_activate(self): 185 | self.win = MainWindow(self) 186 | self.add_window(self.win) 187 | self.win.show() 188 | 189 | def action_clicked(self, action, variant): 190 | print(action, variant) 191 | if variant: 192 | action.set_state(variant) 193 | 194 | def on_headbar_clicked(self, action, optional): 195 | self.win.on_toolbar_clicked(action, action.get_name()) 196 | 197 | def on_about_activate(self, widget, optional): 198 | ad = Gtk.AboutDialog(comun.APPNAME, self.win) 199 | ad.set_name(comun.APPNAME) 200 | ad.set_version(comun.VERSION) 201 | ad.set_copyright('Copyrignt (c) 2019\nLorenzo Carbonell') 202 | ad.set_comments(_('QRCode coder and decoder')) 203 | ad.set_license(''' 204 | Permission is hereby granted, free of charge, to any person obtaining a copy 205 | of this software and associated documentation files (the "Software"), to deal 206 | in the Software without restriction, including without limitation the rights 207 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 208 | copies of the Software, and to permit persons to whom the Software is 209 | furnished to do so, subject to the following conditions: 210 | 211 | The above copyright notice and this permission notice shall be included in all 212 | copies or substantial portions of the Software. 213 | 214 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 215 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 216 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 217 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 218 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 219 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 220 | SOFTWARE. 221 | ''') 222 | ad.set_website('https://www.atareao.es') 223 | ad.set_website_label('atareao.es') 224 | ad.set_authors([ 225 | 'Lorenzo Carbonell ']) 226 | ad.set_documenters([ 227 | 'Lorenzo Carbonell ']) 228 | ad.set_translator_credits('\ 229 | Lorenzo Carbonell \n') 230 | ad.set_program_name(comun.APPNAME) 231 | ad.set_logo(GdkPixbuf.Pixbuf.new_from_file(comun.ICON)) 232 | ad.run() 233 | ad.destroy() 234 | 235 | def do_none(self, *args): 236 | pass 237 | 238 | def toggle_toggled(self, action, state): 239 | action.set_state(state) 240 | Gtk.Settings.get_default().set_property( 241 | "gtk-application-prefer-dark-theme", state) 242 | 243 | 244 | def main(): 245 | app = MainApplication() 246 | app.run('') 247 | 248 | 249 | if __name__ == "__main__": 250 | main() 251 | -------------------------------------------------------------------------------- /src/gqrcode/mylibs/constant.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | ***** for data.py ******* 4 | """ 5 | # character capacities 6 | # {level1: [version1(mode1,mode2,mode3,mode4), version2(..,..,..,..), ...], 7 | # level2: [version1(mode1,mode2,mode3,mode4), version2(..,..,..,..),...], 8 | # ...} 9 | char_cap = { 10 | 'L': [(41, 25, 17, 10), (77, 47, 32, 20), (127, 77, 53, 32), (187, 114, 78, 48), (255, 154, 106, 65), (322, 195, 134, 82), (370, 224, 154, 95), (461, 279, 192, 118), (552, 335, 230, 141), (652, 395, 271, 167), (772, 468, 321, 198), (883, 535, 367, 226), (1022, 619, 425, 262), (1101, 667, 458, 282), (1250, 758, 520, 320), (1408, 854, 586, 361), (1548, 938, 644, 397), (1725, 1046, 718, 442), (1903, 1153, 792, 488), (2061, 1249, 858, 528), (2232, 1352, 929, 572), (2409, 1460, 1003, 618), (2620, 1588, 1091, 672), (2812, 1704, 1171, 721), (3057, 1853, 1273, 784), (3283, 1990, 1367, 842), (3517, 2132, 1465, 902), (3669, 2223, 1528, 940), (3909, 2369, 1628, 1002), (4158, 2520, 1732, 1066), (4417, 2677, 1840, 1132), (4686, 2840, 1952, 1201), (4965, 3009, 2068, 1273), (5253, 3183, 2188, 1347), (5529, 3351, 2303, 1417), (5836, 3537, 2431, 1496), (6153, 3729, 2563, 1577), (6479, 3927, 2699, 1661), (6743, 4087, 2809, 1729), (7089, 4296, 2953, 1817)], 11 | 'M': [(34, 20, 14, 8), (63, 38, 26, 16), (101, 61, 42, 26), (149, 90, 62, 38), (202, 122, 84, 52), (255, 154, 106, 65), (293, 178, 122, 75), (365, 221, 152, 93), (432, 262, 180, 111), (513, 311, 213, 131), (604, 366, 251, 155), (691, 419, 287, 177), (796, 483, 331, 204), (871, 528, 362, 223), (991, 600, 412, 254), (1082, 656, 450, 277), (1212, 734, 504, 310), (1346, 816, 560, 345), (1500, 909, 624, 384), (1600, 970, 666, 410), (1708, 1035, 711, 438), (1872, 1134, 779, 480), (2059, 1248, 857, 528), (2188, 1326, 911, 561), (2395, 1451, 997, 614), (2544, 1542, 1059, 652), (2701, 1637, 1125, 692), (2857, 1732, 1190, 732), (3035, 1839, 1264, 778), (3289, 1994, 1370, 843), (3486, 2113, 1452, 894), (3693, 2238, 1538, 947), (3909, 2369, 1628, 1002), (4134, 2506, 1722, 1060), (4343, 2632, 1809, 1113), (4588, 2780, 1911, 1176), (4775, 2894, 1989, 1224), (5039, 3054, 2099, 1292), (5313, 3220, 2213, 1362), (5596, 3391, 2331, 1435)], 12 | 'Q': [(27, 16, 11, 7), (48, 29, 20, 12), (77, 47, 32, 20), (111, 67, 46, 28), (144, 87, 60, 37), (178, 108, 74, 45), (207, 125, 86, 53), (259, 157, 108, 66), (312, 189, 130, 80), (364, 221, 151, 93), (427, 259, 177, 109), (489, 296, 203, 125), (580, 352, 241, 149), (621, 376, 258, 159), (703, 426, 292, 180), (775, 470, 322, 198), (876, 531, 364, 224), (948, 574, 394, 243), (1063, 644, 442, 272), (1159, 702, 482, 297), (1224, 742, 509, 314), (1358, 823, 565, 348), (1468, 890, 611, 376), (1588, 963, 661, 407), (1718, 1041, 715, 440), (1804, 1094, 751, 462), (1933, 1172, 805, 496), (2085, 1263, 868, 534), (2181, 1322, 908, 559), (2358, 1429, 982, 604), (2473, 1499, 1030, 634), (2670, 1618, 1112, 684), (2805, 1700, 1168, 719), (2949, 1787, 1228, 756), (3081, 1867, 1283, 790), (3244, 1966, 1351, 832), (3417, 2071, 1423, 876), (3599, 2181, 1499, 923), (3791, 2298, 1579, 972), (3993, 2420, 1663, 1024)], 13 | 'H': [(17, 10, 7, 4), (34, 20, 14, 8), (58, 35, 24, 15), (82, 50, 34, 21), (106, 64, 44, 27), (139, 84, 58, 36), (154, 93, 64, 39), (202, 122, 84, 52), (235, 143, 98, 60), (288, 174, 119, 74), (331, 200, 137, 85), (374, 227, 155, 96), (427, 259, 177, 109), (468, 283, 194, 120), (530, 321, 220, 136), (602, 365, 250, 154), (674, 408, 280, 173), (746, 452, 310, 191), (813, 493, 338, 208), (919, 557, 382, 235), (969, 587, 403, 248), (1056, 640, 439, 270), (1108, 672, 461, 284), (1228, 744, 511, 315), (1286, 779, 535, 330), (1425, 864, 593, 365), (1501, 910, 625, 385), (1581, 958, 658, 405), (1677, 1016, 698, 430), (1782, 1080, 742, 457), (1897, 1150, 790, 486), (2022, 1226, 842, 518), (2157, 1307, 898, 553), (2301, 1394, 958, 590), (2361, 1431, 983, 605), (2524, 1530, 1051, 647), (2625, 1591, 1093, 673), (2735, 1658, 1139, 701), (2927, 1774, 1219, 750), (3057, 1852, 1273, 784)] 14 | } 15 | 16 | mindex = {'numeric':0, 'alphanumeric':1, 'byte':2, 'kanji':3} 17 | 18 | # [ 19 | # version1[level1,level2,level3,level4], 20 | # version2[..,..,..,..], 21 | # ... 22 | # ] 23 | required_bytes = [ 24 | [19, 16, 13, 9], [34, 28, 22, 16], [55, 44, 34, 26], [80, 64, 48, 36], [108, 86, 62, 46], [136, 108, 76, 60], [156, 124, 88, 66], [194, 154, 110, 86], [232, 182, 132, 100], [274, 216, 154, 122], [324, 254, 180, 140], [370, 290, 206, 158], [428, 334, 244, 180], [461, 365, 261, 197], [523, 415, 295, 223], [589, 453, 325, 253], [647, 507, 367, 283], [721, 563, 397, 313], [795, 627, 445, 341], [861, 669, 485, 385], [932, 714, 512, 406], [1006, 782, 568, 442], [1094, 860, 614, 464], [1174, 914, 664, 514], [1276, 1000, 718, 538], [1370, 1062, 754, 596], [1468, 1128, 808, 628], [1531, 1193, 871, 661], [1631, 1267, 911, 701], [1735, 1373, 985, 745], [1843, 1455, 1033, 793], [1955, 1541, 1115, 845], [2071, 1631, 1171, 901], [2191, 1725, 1231, 961], [2306, 1812, 1286, 986], [2434, 1914, 1354, 1054], [2566, 1992, 1426, 1096], [2702, 2102, 1502, 1142], [2812, 2216, 1582, 1222], [2956, 2334, 1666, 1276] 25 | ] 26 | 27 | num_list = '0123456789' 28 | alphanum_list = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:' 29 | 30 | # [ 31 | # version1[ 32 | # level1(num_of_group_1_blocks, DC_per_group_1_block, num_of_group_2_blocks, DC_per_group_2_block), 33 | # level2(..,..,..,..), 34 | # level3(..,..,..,..), 35 | # level4(..,..,..,..) 36 | # ], 37 | # version2[level1(..), level2(..), level3(..), level4(..)], 38 | # ... 39 | # ] 40 | grouping_list = [ 41 | [(1, 19, 0, 0), (1, 16, 0, 0), (1, 13, 0, 0), (1, 9, 0, 0)], [(1, 34, 0, 0), (1, 28, 0, 0), (1, 22, 0, 0), (1, 16, 0, 0)], [(1, 55, 0, 0), (1, 44, 0, 0), (2, 17, 0, 0), (2, 13, 0, 0)], [(1, 80, 0, 0), (2, 32, 0, 0), (2, 24, 0, 0), (4, 9, 0, 0)], [(1, 108, 0, 0), (2, 43, 0, 0), (2, 15, 2, 16), (2, 11, 2, 12)], [(2, 68, 0, 0), (4, 27, 0, 0), (4, 19, 0, 0), (4, 15, 0, 0)], [(2, 78, 0, 0), (4, 31, 0, 0), (2, 14, 4, 15), (4, 13, 1, 14)], [(2, 97, 0, 0), (2, 38, 2, 39), (4, 18, 2, 19), (4, 14, 2, 15)], [(2, 116, 0, 0), (3, 36, 2, 37), (4, 16, 4, 17), (4, 12, 4, 13)], [(2, 68, 2, 69), (4, 43, 1, 44), (6, 19, 2, 20), (6, 15, 2, 16)], [(4, 81, 0, 0), (1, 50, 4, 51), (4, 22, 4, 23), (3, 12, 8, 13)], [(2, 92, 2, 93), (6, 36, 2, 37), (4, 20, 6, 21), (7, 14, 4, 15)], [(4, 107, 0, 0), (8, 37, 1, 38), (8, 20, 4, 21), (12, 11, 4, 12)], [(3, 115, 1, 116), (4, 40, 5, 41), (11, 16, 5, 17), (11, 12, 5, 13)], [(5, 87, 1, 88), (5, 41, 5, 42), (5, 24, 7, 25), (11, 12, 7, 13)], [(5, 98, 1, 99), (7, 45, 3, 46), (15, 19, 2, 20), (3, 15, 13, 16)], [(1, 107, 5, 108), (10, 46, 1, 47), (1, 22, 15, 23), (2, 14, 17, 15)], [(5, 120, 1, 121), (9, 43, 4, 44), (17, 22, 1, 23), (2, 14, 19, 15)], [(3, 113, 4, 114), (3, 44, 11, 45), (17, 21, 4, 22), (9, 13, 16, 14)], [(3, 107, 5, 108), (3, 41, 13, 42), (15, 24, 5, 25), (15, 15, 10, 16)], [(4, 116, 4, 117), (17, 42, 0, 0), (17, 22, 6, 23), (19, 16, 6, 17)], [(2, 111, 7, 112), (17, 46, 0, 0), (7, 24, 16, 25), (34, 13, 0, 0)], [(4, 121, 5, 122), (4, 47, 14, 48), (11, 24, 14, 25), (16, 15, 14, 16)], [(6, 117, 4, 118), (6, 45, 14, 46), (11, 24, 16, 25), (30, 16, 2, 17)], [(8, 106, 4, 107), (8, 47, 13, 48), (7, 24, 22, 25), (22, 15, 13, 16)], [(10, 114, 2, 115), (19, 46, 4, 47), (28, 22, 6, 23), (33, 16, 4, 17)], [(8, 122, 4, 123), (22, 45, 3, 46), (8, 23, 26, 24), (12, 15, 28, 16)], [(3, 117, 10, 118), (3, 45, 23, 46), (4, 24, 31, 25), (11, 15, 31, 16)], [(7, 116, 7, 117), (21, 45, 7, 46), (1, 23, 37, 24), (19, 15, 26, 16)], [(5, 115, 10, 116), (19, 47, 10, 48), (15, 24, 25, 25), (23, 15, 25, 16)], [(13, 115, 3, 116), (2, 46, 29, 47), (42, 24, 1, 25), (23, 15, 28, 16)], [(17, 115, 0, 0), (10, 46, 23, 47), (10, 24, 35, 25), (19, 15, 35, 16)], [(17, 115, 1, 116), (14, 46, 21, 47), (29, 24, 19, 25), (11, 15, 46, 16)], [(13, 115, 6, 116), (14, 46, 23, 47), (44, 24, 7, 25), (59, 16, 1, 17)], [(12, 121, 7, 122), (12, 47, 26, 48), (39, 24, 14, 25), (22, 15, 41, 16)], [(6, 121, 14, 122), (6, 47, 34, 48), (46, 24, 10, 25), (2, 15, 64, 16)], [(17, 122, 4, 123), (29, 46, 14, 47), (49, 24, 10, 25), (24, 15, 46, 16)], [(4, 122, 18, 123), (13, 46, 32, 47), (48, 24, 14, 25), (42, 15, 32, 16)], [(20, 117, 4, 118), (40, 47, 7, 48), (43, 24, 22, 25), (10, 15, 67, 16)], [(19, 118, 6, 119), (18, 47, 31, 48), (34, 24, 34, 25), (20, 15, 61, 16)] 42 | ] 43 | 44 | mode_indicator = {'numeric': '0001', 'alphanumeric': '0010', 'byte': '0100', 'kanji': '1000'} 45 | 46 | 47 | 48 | """ 49 | ****** for ECC.py ******* 50 | """ 51 | #GP: Generator Polynomial, MP: Message Polynomial 52 | GP_list = { 53 | 7: [0, 87, 229, 146, 149, 238, 102, 21], 54 | 10: [0, 251, 67, 46, 61, 118, 70, 64, 94, 32, 45], 55 | 13: [0, 74, 152, 176, 100, 86, 100, 106, 104, 130, 218, 206, 140, 78], 56 | 15: [0, 8, 183, 61, 91, 202, 37, 51, 58, 58, 237, 140, 124, 5, 99, 105], 57 | 16: [0, 120, 104, 107, 109, 102, 161, 76, 3, 91, 191, 147, 169, 182, 194, 225, 120], 58 | 17: [0, 43, 139, 206, 78, 43, 239, 123, 206, 214, 147, 24, 99, 150, 39, 243, 163, 136], 59 | 18: [0, 215, 234, 158, 94, 184, 97, 118, 170, 79, 187, 152, 148, 252, 179, 5, 98, 96, 153], 60 | 20: [0, 17, 60, 79, 50, 61, 163, 26, 187, 202, 180, 221, 225, 83, 239, 156, 164, 212, 212, 188, 190], 61 | 22: [0, 210, 171, 247, 242, 93, 230, 14, 109, 221, 53, 200, 74, 8, 172, 98, 80, 219, 134, 160, 105, 165, 231], 62 | 24: [0, 229, 121, 135, 48, 211, 117, 251, 126, 159, 180, 169, 152, 192, 226, 228, 218, 111, 0, 117, 232, 87, 96, 227, 21], 63 | 26: [0, 173, 125, 158, 2, 103, 182, 118, 17, 145, 201, 111, 28, 165, 53, 161, 21, 245, 142, 13, 102, 48, 227, 153, 145, 218, 70], 64 | 28: [0, 168, 223, 200, 104, 224, 234, 108, 180, 110, 190, 195, 147, 205, 27, 232, 201, 21, 43, 245, 87, 42, 195, 212, 119, 242, 37, 9, 123], 65 | 30: [0, 41, 173, 145, 152, 216, 31, 179, 182, 50, 48, 110, 86, 239, 96, 222, 125, 42, 173, 226, 193, 224, 130, 156, 37, 251, 216, 238, 40, 192, 180] 66 | } 67 | 68 | # Error Correction Codewords per block 69 | # [version1(level1,level2,level3,level4), 70 | # version2(..,..,..,..), 71 | # ....] 72 | ecc_num_per_block = [ 73 | (7, 10, 13, 17), (10, 16, 22, 28), (15, 26, 18, 22), (20, 18, 26, 16), (26, 24, 18, 22), (18, 16, 24, 28), (20, 18, 18, 26), (24, 22, 22, 26), (30, 22, 20, 24), (18, 26, 24, 28), (20, 30, 28, 24), (24, 22, 26, 28), (26, 22, 24, 22), (30, 24, 20, 24), (22, 24, 30, 24), (24, 28, 24, 30), (28, 28, 28, 28), (30, 26, 28, 28), (28, 26, 26, 26), (28, 26, 30, 28), (28, 26, 28, 30), (28, 28, 30, 24), (30, 28, 30, 30), (30, 28, 30, 30), (26, 28, 30, 30), (28, 28, 28, 30), (30, 28, 30, 30), (30, 28, 30, 30), (30, 28, 30, 30), (30, 28, 30, 30), (30, 28, 30, 30), (30, 28, 30, 30), (30, 28, 30, 30), (30, 28, 30, 30), (30, 28, 30, 30), (30, 28, 30, 30), (30, 28, 30, 30), (30, 28, 30, 30), (30, 28, 30, 30), (30, 28, 30, 30) 74 | ] 75 | 76 | 77 | # powers of 2 list 78 | po2 = [ 79 | 1, 2, 4, 8, 16, 32, 64, 128, 29, 58, 116, 232, 205, 135, 19, 38, 76, 152, 45, 90, 180, 117, 234, 201, 143, 3, 6, 12, 24, 48, 96, 192, 157, 39, 78, 156, 37, 74, 148, 53, 106, 212, 181, 119, 238, 193, 159, 35, 70, 140, 5, 10, 20, 40, 80, 160, 93, 186, 105, 210, 185, 111, 222, 161, 95, 190, 97, 194, 153, 47, 94, 188, 101, 202, 137, 15, 30, 60, 120, 240, 253, 231, 211, 187, 107, 214, 177, 127, 254, 225, 223, 163, 91, 182, 113, 226, 217, 175, 67, 134, 17, 34, 68, 136, 13, 26, 52, 104, 208, 189, 103, 206, 129, 31, 62, 124, 248, 237, 199, 147, 59, 118, 236, 197, 151, 51, 102, 204, 133, 23, 46, 92, 184, 109, 218, 169, 79, 158, 33, 66, 132, 21, 42, 84, 168, 77, 154, 41, 82, 164, 85, 170, 73, 146, 57, 114, 228, 213, 183, 115, 230, 209, 191, 99, 198, 145, 63, 126, 252, 229, 215, 179, 123, 246, 241, 255, 227, 219, 171, 75, 150, 49, 98, 196, 149, 55, 110, 220, 165, 87, 174, 65, 130, 25, 50, 100, 200, 141, 7, 14, 28, 56, 112, 224, 221, 167, 83, 166, 81, 162, 89, 178, 121, 242, 249, 239, 195, 155, 43, 86, 172, 69, 138, 9, 18, 36, 72, 144, 61, 122, 244, 245, 247, 243, 251, 235, 203, 139, 11, 22, 44, 88, 176, 125, 250, 233, 207, 131, 27, 54, 108, 216, 173, 71, 142, 1 80 | ] 81 | 82 | # log list 83 | log = [ 84 | None, 0, 1, 25, 2, 50, 26, 198, 3, 223, 51, 238, 27, 104, 199, 75, 4, 100, 224, 14, 52, 141, 239, 129, 28, 193, 105, 248, 200, 8, 76, 113, 5, 138, 101, 47, 225, 36, 15, 33, 53, 147, 142, 218, 240, 18, 130, 69, 29, 181, 194, 125, 106, 39, 249, 185, 201, 154, 9, 120, 77, 228, 114, 166, 6, 191, 139, 98, 102, 221, 48, 253, 226, 152, 37, 179, 16, 145, 34, 136, 54, 208, 148, 206, 143, 150, 219, 189, 241, 210, 19, 92, 131, 56, 70, 64, 30, 66, 182, 163, 195, 72, 126, 110, 107, 58, 40, 84, 250, 133, 186, 61, 202, 94, 155, 159, 10, 21, 121, 43, 78, 212, 229, 172, 115, 243, 167, 87, 7, 112, 192, 247, 140, 128, 99, 13, 103, 74, 222, 237, 49, 197, 254, 24, 227, 165, 153, 119, 38, 184, 180, 124, 17, 68, 146, 217, 35, 32, 137, 46, 55, 63, 209, 91, 149, 188, 207, 205, 144, 135, 151, 178, 220, 252, 190, 97, 242, 86, 211, 171, 20, 42, 93, 158, 132, 60, 57, 83, 71, 109, 65, 162, 31, 45, 67, 216, 183, 123, 164, 118, 196, 23, 73, 236, 127, 12, 111, 246, 108, 161, 59, 82, 41, 157, 85, 170, 251, 96, 134, 177, 187, 204, 62, 90, 203, 89, 95, 176, 156, 169, 160, 81, 11, 245, 22, 235, 122, 117, 44, 215, 79, 174, 213, 233, 230, 231, 173, 232, 116, 214, 244, 234, 168, 80, 88, 175 85 | ] 86 | 87 | """ 88 | ****** for data.py + ECC.py + structure.py + matrix.py ******* 89 | """ 90 | lindex = {'L':0, 'M':1, 'Q':2, 'H':3} 91 | 92 | """ 93 | ****** for structure.py ******* 94 | """ 95 | required_remainder_bits = (0,7,7,7,7,7,0,0,0,0,0,0,0,3,3,3,3,3,3,3,4,4,4,4,4,4,4,3,3,3,3,3,3,3,0,0,0,0,0,0) 96 | 97 | # [ 98 | # version1[ 99 | # level1(num_of_group_1_blocks, DC_per_group_1_block, num_of_group_2_blocks, DC_per_group_2_block), 100 | # level2(..,..,..,..), 101 | # level3(..,..,..,..), 102 | # level4(..,..,..,..) 103 | # ], 104 | # version2[level1(..), level2(..), level3(..), level4(..)], 105 | # ... 106 | # ] 107 | grouping_list = [ 108 | [(1, 19, 0, 0), (1, 16, 0, 0), (1, 13, 0, 0), (1, 9, 0, 0)], [(1, 34, 0, 0), (1, 28, 0, 0), (1, 22, 0, 0), (1, 16, 0, 0)], [(1, 55, 0, 0), (1, 44, 0, 0), (2, 17, 0, 0), (2, 13, 0, 0)], [(1, 80, 0, 0), (2, 32, 0, 0), (2, 24, 0, 0), (4, 9, 0, 0)], [(1, 108, 0, 0), (2, 43, 0, 0), (2, 15, 2, 16), (2, 11, 2, 12)], [(2, 68, 0, 0), (4, 27, 0, 0), (4, 19, 0, 0), (4, 15, 0, 0)], [(2, 78, 0, 0), (4, 31, 0, 0), (2, 14, 4, 15), (4, 13, 1, 14)], [(2, 97, 0, 0), (2, 38, 2, 39), (4, 18, 2, 19), (4, 14, 2, 15)], [(2, 116, 0, 0), (3, 36, 2, 37), (4, 16, 4, 17), (4, 12, 4, 13)], [(2, 68, 2, 69), (4, 43, 1, 44), (6, 19, 2, 20), (6, 15, 2, 16)], [(4, 81, 0, 0), (1, 50, 4, 51), (4, 22, 4, 23), (3, 12, 8, 13)], [(2, 92, 2, 93), (6, 36, 2, 37), (4, 20, 6, 21), (7, 14, 4, 15)], [(4, 107, 0, 0), (8, 37, 1, 38), (8, 20, 4, 21), (12, 11, 4, 12)], [(3, 115, 1, 116), (4, 40, 5, 41), (11, 16, 5, 17), (11, 12, 5, 13)], [(5, 87, 1, 88), (5, 41, 5, 42), (5, 24, 7, 25), (11, 12, 7, 13)], [(5, 98, 1, 99), (7, 45, 3, 46), (15, 19, 2, 20), (3, 15, 13, 16)], [(1, 107, 5, 108), (10, 46, 1, 47), (1, 22, 15, 23), (2, 14, 17, 15)], [(5, 120, 1, 121), (9, 43, 4, 44), (17, 22, 1, 23), (2, 14, 19, 15)], [(3, 113, 4, 114), (3, 44, 11, 45), (17, 21, 4, 22), (9, 13, 16, 14)], [(3, 107, 5, 108), (3, 41, 13, 42), (15, 24, 5, 25), (15, 15, 10, 16)], [(4, 116, 4, 117), (17, 42, 0, 0), (17, 22, 6, 23), (19, 16, 6, 17)], [(2, 111, 7, 112), (17, 46, 0, 0), (7, 24, 16, 25), (34, 13, 0, 0)], [(4, 121, 5, 122), (4, 47, 14, 48), (11, 24, 14, 25), (16, 15, 14, 16)], [(6, 117, 4, 118), (6, 45, 14, 46), (11, 24, 16, 25), (30, 16, 2, 17)], [(8, 106, 4, 107), (8, 47, 13, 48), (7, 24, 22, 25), (22, 15, 13, 16)], [(10, 114, 2, 115), (19, 46, 4, 47), (28, 22, 6, 23), (33, 16, 4, 17)], [(8, 122, 4, 123), (22, 45, 3, 46), (8, 23, 26, 24), (12, 15, 28, 16)], [(3, 117, 10, 118), (3, 45, 23, 46), (4, 24, 31, 25), (11, 15, 31, 16)], [(7, 116, 7, 117), (21, 45, 7, 46), (1, 23, 37, 24), (19, 15, 26, 16)], [(5, 115, 10, 116), (19, 47, 10, 48), (15, 24, 25, 25), (23, 15, 25, 16)], [(13, 115, 3, 116), (2, 46, 29, 47), (42, 24, 1, 25), (23, 15, 28, 16)], [(17, 115, 0, 0), (10, 46, 23, 47), (10, 24, 35, 25), (19, 15, 35, 16)], [(17, 115, 1, 116), (14, 46, 21, 47), (29, 24, 19, 25), (11, 15, 46, 16)], [(13, 115, 6, 116), (14, 46, 23, 47), (44, 24, 7, 25), (59, 16, 1, 17)], [(12, 121, 7, 122), (12, 47, 26, 48), (39, 24, 14, 25), (22, 15, 41, 16)], [(6, 121, 14, 122), (6, 47, 34, 48), (46, 24, 10, 25), (2, 15, 64, 16)], [(17, 122, 4, 123), (29, 46, 14, 47), (49, 24, 10, 25), (24, 15, 46, 16)], [(4, 122, 18, 123), (13, 46, 32, 47), (48, 24, 14, 25), (42, 15, 32, 16)], [(20, 117, 4, 118), (40, 47, 7, 48), (43, 24, 22, 25), (10, 15, 67, 16)], [(19, 118, 6, 119), (18, 47, 31, 48), (34, 24, 34, 25), (20, 15, 61, 16)] 109 | ] 110 | 111 | 112 | 113 | """ 114 | ****** for matrix.py ******* 115 | """ 116 | # Alignment Pattern Locations 117 | alig_location = [ 118 | (6, 18), (6, 22), (6, 26), (6, 30), (6, 34), (6, 22, 38), (6, 24, 42), (6, 26, 46), (6, 28, 50), (6, 30, 54), (6, 32, 58), (6, 34, 62), (6, 26, 46, 66), (6, 26, 48, 70), (6, 26, 50, 74), (6, 30, 54, 78), (6, 30, 56, 82), (6, 30, 58, 86), (6, 34, 62, 90), (6, 28, 50, 72, 94), (6, 26, 50, 74, 98), (6, 30, 54, 78, 102), (6, 28, 54, 80, 106), (6, 32, 58, 84, 110), (6, 30, 58, 86, 114), (6, 34, 62, 90, 118), (6, 26, 50, 74, 98, 122), (6, 30, 54, 78, 102, 126), (6, 26, 52, 78, 104, 130), (6, 30, 56, 82, 108, 134), (6, 34, 60, 86, 112, 138), (6, 30, 58, 86, 114, 142), (6, 34, 62, 90, 118, 146), (6, 30, 54, 78, 102, 126, 150), (6, 24, 50, 76, 102, 128, 154), (6, 28, 54, 80, 106, 132, 158), (6, 32, 58, 84, 110, 136, 162), (6, 26, 54, 82, 110, 138, 166), (6, 30, 58, 86, 114, 142, 170) 119 | ] 120 | 121 | # List of all Format Information Strings 122 | # [ 123 | # level1[mask_pattern0, mask_pattern1, mask_...3,...], 124 | # level2[...], 125 | # level3[...], 126 | # level4[...] 127 | # ] 128 | format_info_str = [ 129 | ['111011111000100', '111001011110011', '111110110101010', '111100010011101', '110011000101111', '110001100011000', '110110001000001', '110100101110110'], ['101010000010010', '101000100100101', '101111001111100', '101101101001011', '100010111111001', '100000011001110', '100111110010111', '100101010100000'], ['011010101011111', '011000001101000', '011111100110001', '011101000000110', '010010010110100', '010000110000011', '010111011011010', '010101111101101'], ['001011010001001', '001001110111110', '001110011100111', '001100111010000', '000011101100010', '000001001010101', '000110100001100', '000100000111011'] 130 | ] 131 | 132 | # Version Information Strings 133 | version_info_str = [ 134 | '000111110010010100', '001000010110111100', '001001101010011001', '001010010011010011', '001011101111110110', '001100011101100010', '001101100001000111', '001110011000001101', '001111100100101000', '010000101101111000', '010001010001011101', '010010101000010111', '010011010100110010', '010100100110100110', '010101011010000011', '010110100011001001', '010111011111101100', '011000111011000100', '011001000111100001', '011010111110101011', '011011000010001110', '011100110000011010', '011101001100111111', '011110110101110101', '011111001001010000', '100000100111010101', '100001011011110000', '100010100010111010', '100011011110011111', '100100101100001011', '100101010000101110', '100110101001100100', '100111010101000001', '101000110001101001' 135 | ] 136 | -------------------------------------------------------------------------------- /src/gqrcode/mainwindow.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # This file is part of GQRCode 5 | # 6 | # Copyright (c) 2012-2019 Lorenzo Carbonell Cerezo 7 | # 8 | # Permission is hereby granted, free of charge, to any person obtaining a copy 9 | # of this software and associated documentation files (the "Software"), to deal 10 | # in the Software without restriction, including without limitation the rights 11 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | # copies of the Software, and to permit persons to whom the Software is 13 | # furnished to do so, subject to the following conditions: 14 | # 15 | # The above copyright notice and this permission notice shall be included in all 16 | # copies or substantial portions of the Software. 17 | # 18 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | # SOFTWARE. 25 | 26 | import gi 27 | try: 28 | gi.require_version('Gtk', '3.0') 29 | gi.require_version('Gdk', '3.0') 30 | gi.require_version('Gio', '2.0') 31 | gi.require_version('GdkPixbuf', '2.0') 32 | gi.require_version('OsmGpsMap', '1.0') 33 | except Exception as e: 34 | print(e) 35 | exit(1) 36 | from gi.repository import Gtk 37 | from gi.repository import Gdk 38 | from gi.repository import Gio 39 | from gi.repository import GdkPixbuf 40 | from gi.repository import OsmGpsMap 41 | from enum import Enum 42 | import os 43 | import shlex 44 | import subprocess 45 | import tempfile 46 | from . import comun 47 | from .myqr import create_qr 48 | from .util import get_latitude_longitude, update_preview_cb 49 | # from .mylibs.draw import pixbuf2image 50 | # import qreader 51 | from .dasync import async_function 52 | from .progreso import Progreso 53 | from .parse import parse 54 | from .comun import _ 55 | 56 | ST_GEO = 'GEO:{0},{1}' 57 | ST_TEL = 'TEL:{0}' 58 | ST_MAIL = 'MAILTO:{0}' 59 | ST_WIFI = 'WIFI:T:{0};S:{1};P:{2};;' 60 | ST_SMS = 'SMSTO:{0}:{1}' 61 | ST_EMAIL_MSG = 'MATMSG:TO:{0};SUB:{1};BODY:{2};;' 62 | ST_VCARD = '''BEGIN:VCARD 63 | N;CHARSET=utf-8:{0};{1};;; 64 | FN;CHARSET=utf-8:{2} {3} 65 | ORG;CHARSET=utf-8:{4} 66 | TITLE;CHARSET=utf-8:{5} 67 | TEL;WORK:{6} 68 | TEL;CELL:{7} 69 | TEL;WORK;FAX:{8} 70 | EMAIL;INTERNET;WORK;CHARSET=utf-8:{9} 71 | ADR;WORK;CHARSET=utf-8:;;{10};{11};{12};{13};{14} 72 | URL;WORK;CHARSET=utf-8:{15} 73 | NOTE;CHARSET=utf-8:{16} 74 | VERSION:2.1 75 | END:VCARD 76 | ''' 77 | ST_VEVENT = ''' 78 | BEGIN:VEVENT 79 | SUMMARY:{0} 80 | LOCATION:{1} 81 | DESCRIPTION:{2} 82 | DTSTART:{3} 83 | DTEND:{4} 84 | END:VEVENT 85 | ''' 86 | 87 | 88 | def set_margins(widget, margin): 89 | widget.set_margin_left(margin) 90 | widget.set_margin_right(margin) 91 | widget.set_margin_top(margin) 92 | widget.set_margin_bottom(margin) 93 | if isinstance(widget, Gtk.Grid): 94 | widget.set_column_spacing(10) 95 | widget.set_row_spacing(10) 96 | 97 | 98 | def select_value_in_combo(combo, value): 99 | model = combo.get_model() 100 | for i, item in enumerate(model): 101 | if value == item[1]: 102 | combo.set_active(i) 103 | return 104 | combo.set_active(0) 105 | 106 | 107 | def get_selected_value_in_combo(combo): 108 | model = combo.get_model() 109 | return model.get_value(combo.get_active_iter(), 1) 110 | 111 | 112 | def get_temporary_name(): 113 | return tempfile.NamedTemporaryFile(mode='w+b', 114 | prefix='gqrcode', 115 | delete=True).name 116 | 117 | 118 | def ejecuta(comando): 119 | args = shlex.split(comando) 120 | p = subprocess.Popen(args, bufsize=10000, stdout=subprocess.PIPE) 121 | valor = p.communicate()[0] 122 | return valor 123 | 124 | 125 | class QRType(Enum): 126 | TEXT = 0 127 | GEOLOCATION = 1 128 | TELEPHONE_NUMBER = 2 129 | EMAIL = 3 130 | URL = 4 131 | WIFI_LOGIN = 5 132 | SMS = 6 133 | EMAIL_MESSAGE = 7 134 | VCARD = 8 135 | VEVENT = 9 136 | 137 | def get_type(decoded_string): 138 | if decoded_string.lower().startswith('geo:'): 139 | return QRType.GEOLOCATION 140 | if decoded_string.lower().startswith('tel:'): 141 | return QRType.TELEPHONE_NUMBER 142 | if decoded_string.lower().startswith('mailto:'): 143 | return QRType.EMAIL 144 | if decoded_string.lower().startswith('http://') or\ 145 | decoded_string.lower().startswith('https://'): 146 | return QRType.URL 147 | if decoded_string.lower().startswith('wifi:'): 148 | return QRType.WIFI_LOGIN 149 | if decoded_string.lower().startswith('smsto:'): 150 | return QRType.SMS 151 | if decoded_string.lower().startswith('matmsg:'): 152 | return QRType.EMAIL_MESSAGE 153 | if decoded_string.lower().startswith('begin:vcard'): 154 | return QRType.VCARD 155 | if decoded_string.lower().startswith('begin:vevent'): 156 | return QRType.VEVENT 157 | return QRType.TEXT 158 | 159 | 160 | class MainWindow(Gtk.ApplicationWindow): 161 | def __init__(self, app, afile=None): 162 | Gtk.ApplicationWindow.__init__(self, application=app) 163 | 164 | self.qrcode_file = None 165 | self.frames = None 166 | self.background = None 167 | self.scale = 100 168 | self.pbuf = None 169 | 170 | self.set_position(Gtk.WindowPosition.CENTER_ALWAYS) 171 | self.set_title(comun.APP) 172 | self.set_icon_from_file(comun.ICON) 173 | self.set_resizable(False) 174 | self.set_default_size(600, 600) 175 | 176 | self.connect('destroy', self.close_application) 177 | hbox = Gtk.HBox(spacing=5) 178 | hbox.set_border_width(5) 179 | frame = Gtk.Frame() 180 | set_margins(frame, 5) 181 | self.add(frame) 182 | 183 | self.main_stack = Gtk.Stack.new() 184 | self.main_stack.set_transition_type( 185 | Gtk.StackTransitionType.UNDER_RIGHT) 186 | frame.add(self.main_stack) 187 | 188 | self.stack = Gtk.Stack.new() 189 | self.stack.set_transition_type( 190 | Gtk.StackTransitionType.UNDER_DOWN) 191 | self.main_stack.add_named(self.stack, 'Data') 192 | 193 | grid1 = Gtk.Grid() 194 | set_margins(grid1, 10) 195 | grid1.set_margin_right(10) 196 | self.stack.add_named(grid1, QRType.TEXT.name) 197 | label1 = Gtk.Label(_('Set text to encode: ')) 198 | label1.set_alignment(0, .5) 199 | grid1.attach(label1, 0, 0, 1, 1) 200 | self.entry12 = Gtk.Entry() 201 | self.entry12.set_alignment(0) 202 | self.entry12.set_width_chars(40) 203 | grid1.attach(self.entry12, 1, 0, 1, 1) 204 | 205 | grid2 = Gtk.Grid() 206 | set_margins(grid2, 10) 207 | self.stack.add_named(grid2, QRType.GEOLOCATION.name) 208 | scrolledwindow0 = Gtk.ScrolledWindow() 209 | scrolledwindow0.set_policy(Gtk.PolicyType.AUTOMATIC, 210 | Gtk.PolicyType.AUTOMATIC) 211 | scrolledwindow0.set_shadow_type(Gtk.ShadowType.ETCHED_OUT) 212 | scrolledwindow0.set_size_request(550, 550) 213 | grid2.attach(scrolledwindow0, 0, 0, 1, 1,) 214 | 215 | self.viewer = OsmGpsMap.Map() 216 | self.viewer.layer_add(OsmGpsMap.MapOsd(show_dpad=True, 217 | show_zoom=True, 218 | show_crosshair=True)) 219 | 220 | # connect keyboard shortcuts 221 | self.viewer.set_keyboard_shortcut(OsmGpsMap.MapKey_t.FULLSCREEN, 222 | Gdk.keyval_from_name("F11")) 223 | self.viewer.set_keyboard_shortcut(OsmGpsMap.MapKey_t.UP, 224 | Gdk.keyval_from_name("Up")) 225 | self.viewer.set_keyboard_shortcut(OsmGpsMap.MapKey_t.DOWN, 226 | Gdk.keyval_from_name("Down")) 227 | self.viewer.set_keyboard_shortcut(OsmGpsMap.MapKey_t.LEFT, 228 | Gdk.keyval_from_name("Left")) 229 | self.viewer.set_keyboard_shortcut(OsmGpsMap.MapKey_t.RIGHT, 230 | Gdk.keyval_from_name("Right")) 231 | scrolledwindow0.add(self.viewer) 232 | scrolledwindow0.set_size_request(550, 550) 233 | 234 | grid3 = Gtk.Grid() 235 | set_margins(grid3, 10) 236 | self.stack.add_named(grid3, QRType.TELEPHONE_NUMBER.name) 237 | label1 = Gtk.Label(_('Set number to encode:')) 238 | label1.set_alignment(0, .5) 239 | grid3.attach(label1, 0, 0, 1, 1) 240 | # 241 | self.entry13 = Gtk.Entry() 242 | self.entry13.set_alignment(0) 243 | self.entry13.set_width_chars(40) 244 | grid3.attach(self.entry13, 1, 0, 1, 1) 245 | 246 | grid4 = Gtk.Grid() 247 | set_margins(grid4, 10) 248 | self.stack.add_named(grid4, QRType.EMAIL.name) 249 | label1 = Gtk.Label(_('Set email:')) 250 | label1.set_alignment(0, .5) 251 | grid4.attach(label1, 0, 0, 1, 1) 252 | 253 | self.entry14 = Gtk.Entry() 254 | self.entry14.set_alignment(0) 255 | self.entry14.set_width_chars(40) 256 | grid4.attach(self.entry14, 1, 0, 1, 1) 257 | 258 | grid5 = Gtk.Grid() 259 | set_margins(grid5, 10) 260 | self.stack.add_named(grid5, QRType.URL.name) 261 | label1 = Gtk.Label(_('Set url:')) 262 | label1.set_alignment(0, .5) 263 | grid5.attach(label1, 0, 0, 1, 1) 264 | 265 | self.entry15 = Gtk.Entry() 266 | self.entry15.set_alignment(0) 267 | self.entry15.set_width_chars(40) 268 | grid5.attach(self.entry15, 1, 0, 1, 1) 269 | 270 | grid6 = Gtk.Grid() 271 | set_margins(grid6, 10) 272 | self.stack.add_named(grid6, QRType.WIFI_LOGIN.name) 273 | label1 = Gtk.Label(_('SSID/Network name:')) 274 | label1.set_alignment(0, .5) 275 | grid6.attach(label1, 0, 0, 1, 1) 276 | 277 | self.entry161 = Gtk.Entry() 278 | self.entry161.set_alignment(0) 279 | self.entry161.set_width_chars(40) 280 | grid6.attach(self.entry161, 1, 0, 1, 1) 281 | 282 | label1 = Gtk.Label(_('Password:')) 283 | label1.set_alignment(0, .5) 284 | grid6.attach(label1, 0, 1, 1, 1) 285 | 286 | self.entry162 = Gtk.Entry() 287 | self.entry162.set_visibility(False) 288 | self.entry162.set_alignment(0) 289 | self.entry162.set_width_chars(40) 290 | grid6.attach(self.entry162, 1, 1, 1, 1,) 291 | 292 | label1 = Gtk.Label(_('Network type:')) 293 | label1.set_alignment(0, .5) 294 | grid6.attach(label1, 0, 2, 1, 1) 295 | self.liststore163 = Gtk.ListStore(str, str) 296 | self.liststore163.append([_('WEP'), 'WEP']) 297 | self.liststore163.append([_('WPA/WPA2'), 'WPA']) 298 | self.liststore163.append([_('No encryption'), 'nopass']) 299 | self.combobox163 = Gtk.ComboBox.new() 300 | self.combobox163.set_model(self.liststore163) 301 | cell163 = Gtk.CellRendererText() 302 | self.combobox163.pack_start(cell163, True) 303 | self.combobox163.add_attribute(cell163, 'text', 0) 304 | select_value_in_combo(self.combobox163, 'wpa') 305 | grid6.attach(self.combobox163, 1, 2, 1, 1) 306 | 307 | grid7 = Gtk.Grid() 308 | set_margins(grid7, 10) 309 | self.stack.add_named(grid7, QRType.SMS.name) 310 | 311 | label1 = Gtk.Label(_('Telephone Number:')) 312 | label1.set_alignment(0, .5) 313 | grid7.attach(label1, 0, 0, 1, 1) 314 | # 315 | self.entry171 = Gtk.Entry() 316 | self.entry171.set_alignment(0) 317 | self.entry171.set_width_chars(40) 318 | grid7.attach(self.entry171, 1, 0, 1, 1) 319 | # 320 | label1 = Gtk.Label(_('SMS Message:')) 321 | label1.set_alignment(0, .5) 322 | grid7.attach(label1, 0, 1, 1, 1) 323 | # 324 | scrolledwindow_sms = Gtk.ScrolledWindow() 325 | scrolledwindow_sms.set_hexpand(True) 326 | scrolledwindow_sms.set_vexpand(True) 327 | scrolledwindow_sms.set_shadow_type(type=Gtk.ShadowType.ETCHED_IN) 328 | scrolledwindow_sms.set_size_request(550, 550) 329 | grid7.attach( 330 | scrolledwindow_sms, 0, 2, 2, 2,) 331 | self.entry172 = Gtk.TextView() 332 | scrolledwindow_sms.add(self.entry172) 333 | 334 | grid8 = Gtk.Grid() 335 | set_margins(grid8, 10) 336 | self.stack.add_named(grid8, QRType.EMAIL_MESSAGE.name) 337 | 338 | label1 = Gtk.Label(_('Email:')) 339 | label1.set_alignment(0, .5) 340 | grid8.attach(label1, 0, 0, 1, 1) 341 | # 342 | self.entry181 = Gtk.Entry() 343 | self.entry181.set_alignment(0) 344 | self.entry181.set_width_chars(40) 345 | grid8.attach(self.entry181, 1, 0, 1, 1) 346 | # 347 | label1 = Gtk.Label(_('Subject:')) 348 | label1.set_alignment(0, .5) 349 | grid8.attach(label1, 0, 1, 1, 1) 350 | # 351 | self.entry182 = Gtk.Entry() 352 | self.entry182.set_alignment(0) 353 | self.entry182.set_width_chars(40) 354 | grid8.attach(self.entry182, 1, 1, 1, 1) 355 | # 356 | label1 = Gtk.Label(_('Body:')) 357 | label1.set_alignment(0, .5) 358 | grid8.attach( 359 | label1, 0, 2, 1, 1) 360 | # 361 | scrolledwindow_email = Gtk.ScrolledWindow() 362 | scrolledwindow_email.set_hexpand(True) 363 | scrolledwindow_email.set_vexpand(True) 364 | scrolledwindow_email.set_shadow_type(type=Gtk.ShadowType.ETCHED_IN) 365 | scrolledwindow_email.set_size_request(550, 300) 366 | grid8.attach(scrolledwindow_email, 0, 3, 2, 2) 367 | self.entry183 = Gtk.TextView() 368 | scrolledwindow_email.add(self.entry183) 369 | 370 | grid9 = Gtk.Grid() 371 | set_margins(grid9, 10) 372 | self.stack.add_named(grid9, QRType.VCARD.name) 373 | 374 | labels_card = {'01': _('Fist name'), 375 | '02': _('Last name'), 376 | '03': _('Job title'), 377 | '04': _('Telephone Number (work)'), 378 | '05': _('Fax Number (work)'), 379 | '06': _('Cell Phone'), 380 | '07': _('Email Address (work)'), 381 | '08': _('Website Address'), 382 | '09': _('Organization'), 383 | '10': _('Street Address (work)'), 384 | '11': _('City'), 385 | '12': _('State'), 386 | '13': _('Zip/Postcode'), 387 | '14': _('Country'), 388 | '15': _('Notes')} 389 | self.entries_vcard = {} 390 | for i, key in enumerate(sorted(labels_card.keys())): 391 | label1 = Gtk.Label(labels_card[key] + ':') 392 | label1.set_alignment(0, .5) 393 | grid9.attach(label1, 0, i, 1, 1) 394 | # 395 | self.entries_vcard[key] = Gtk.Entry() 396 | self.entries_vcard[key].set_alignment(0) 397 | self.entries_vcard[key].set_width_chars(40) 398 | grid9.attach(self.entries_vcard[key], 1, i, 1, 1) 399 | 400 | self.scrolled_code = Gtk.ScrolledWindow.new() 401 | self.scrolled_code.set_size_request(550, 550) 402 | self.main_stack.add_named(self.scrolled_code, 'Code') 403 | self.image = Gtk.Image() 404 | self.connect('key-release-event', self.on_key_release_event) 405 | self.scrolled_code.add_with_viewport(self.image) 406 | 407 | self.init_menu(hbox) 408 | self.init_headerbar() 409 | 410 | self.show_all() 411 | self.do_center() 412 | 413 | def on_key_release_event(self, widget, event): 414 | if event.keyval == 65451 or event.keyval == 43: 415 | self.scale = self.scale * 1.1 416 | elif event.keyval == 65453 or event.keyval == 45: 417 | self.scale = self.scale * 0.9 418 | elif event.keyval == 65456 or event.keyval == 48: 419 | self.scale = 100 420 | self.draw_code() 421 | 422 | def draw_code(self, first=False): 423 | if first is True: 424 | rectangle = self.scrolled_code.get_allocation() 425 | if rectangle.width == 1 or rectangle.height == 1: 426 | width = 400 427 | height = 400 428 | else: 429 | width = rectangle.width 430 | height = rectangle.height 431 | scale_w = width / self.pbuf.get_width() * 100 432 | scale_h = height / self.pbuf.get_height() * 100 433 | if scale_w > scale_h: 434 | self.scale = scale_h 435 | else: 436 | self.scale = scale_w 437 | 438 | if self.pbuf is not None: 439 | w = int(self.pbuf.get_width() * self.scale / 100) 440 | h = int(self.pbuf.get_height() * self.scale / 100) 441 | pixbuf = self.pbuf.scale_simple(w, h, 442 | GdkPixbuf.InterpType.BILINEAR) 443 | self.image.set_from_pixbuf(pixbuf) 444 | 445 | def init_headerbar(self): 446 | self.control = {} 447 | 448 | hb = Gtk.HeaderBar() 449 | hb.set_show_close_button(True) 450 | hb.props.title = comun.APPNAME 451 | self.set_titlebar(hb) 452 | 453 | file_model = Gio.Menu() 454 | 455 | file_section1_model = Gio.Menu() 456 | file_section1_model.append(_('Open QR Image'), 'app.open') 457 | file_section1 = Gio.MenuItem.new_section(None, file_section1_model) 458 | file_model.append_item(file_section1) 459 | 460 | file_section2_model = Gio.Menu() 461 | file_section2_model.append(_('Load background'), 'app.load') 462 | file_section2_model.append(_('Reset background'), 'app.reset') 463 | file_section2 = Gio.MenuItem.new_section(None, file_section2_model) 464 | file_model.append_item(file_section2) 465 | 466 | file_section3_model = Gio.Menu() 467 | file_section3_model.append(_('Save QR Image'), 'app.save') 468 | file_section3 = Gio.MenuItem.new_section(None, file_section3_model) 469 | file_model.append_item(file_section3) 470 | 471 | file_section4_model = Gio.Menu() 472 | file_section4_model.append(_('Close'), 'app.close') 473 | file_section4 = Gio.MenuItem.new_section(None, file_section4_model) 474 | file_model.append_item(file_section4) 475 | 476 | self.control['file'] = Gtk.MenuButton() 477 | self.control['file'].set_menu_model(file_model) 478 | self.control['file'].add(Gtk.Image.new_from_gicon(Gio.ThemedIcon( 479 | name='folder-open-symbolic'), Gtk.IconSize.BUTTON)) 480 | hb.pack_start(self.control['file']) 481 | 482 | model = Gtk.ListStore(str, object) 483 | model.append([_('Text'), QRType.TEXT]) 484 | model.append([_('Geolocation'), QRType.GEOLOCATION]) 485 | model.append([_('Telephone number'), QRType.TELEPHONE_NUMBER]) 486 | model.append([_('Email'), QRType.EMAIL]) 487 | model.append([_('Url'), QRType.URL]) 488 | model.append([_('Wifi Login'), QRType.WIFI_LOGIN]) 489 | model.append([_('SMS'), QRType.SMS]) 490 | model.append([_('Email message'), QRType.EMAIL_MESSAGE]) 491 | model.append([_('vCard'), QRType.VCARD]) 492 | 493 | self.control['encoder'] = Gtk.ComboBox.new() 494 | self.control['encoder'].set_model(model) 495 | cell = Gtk.CellRendererText() 496 | self.control['encoder'].pack_start(cell, True) 497 | self.control['encoder'].add_attribute(cell, 'text', 0) 498 | select_value_in_combo(self.control['encoder'], 'Text') 499 | self.control['encoder'].connect('changed', self.on_encoder_changed) 500 | hb.pack_start(self.control['encoder']) 501 | 502 | self.control['run'] = Gtk.Button() 503 | self.control['run'].set_tooltip_text(_('Encode')) 504 | self.control['run'].add(Gtk.Image.new_from_gicon(Gio.ThemedIcon( 505 | name='go-next-symbolic'), Gtk.IconSize.BUTTON)) 506 | self.control['run'].connect('clicked', self.on_run) 507 | hb.pack_start(self.control['run']) 508 | 509 | help_model = Gio.Menu() 510 | 511 | help_section1_model = Gio.Menu() 512 | help_section1_model.append(_('Homepage'), 'app.goto_homepage') 513 | help_section1 = Gio.MenuItem.new_section(None, help_section1_model) 514 | help_model.append_item(help_section1) 515 | 516 | help_section2_model = Gio.Menu() 517 | help_section2_model.append(_('Code'), 'app.goto_code') 518 | help_section2_model.append(_('Issues'), 'app.goto_bug') 519 | help_section2 = Gio.MenuItem.new_section(None, help_section2_model) 520 | help_model.append_item(help_section2) 521 | 522 | help_section3_model = Gio.Menu() 523 | help_section3_model.append(_('Twitter'), 'app.goto_twitter') 524 | help_section3_model.append(_('Facebook'), 'app.goto_facebook') 525 | help_section3_model.append(_('Google+'), 'app.goto_google_plus') 526 | help_section3 = Gio.MenuItem.new_section(None, help_section3_model) 527 | help_model.append_item(help_section3) 528 | 529 | help_section4_model = Gio.Menu() 530 | help_section4_model.append(_('Donations'), 'app.goto_donate') 531 | help_section4 = Gio.MenuItem.new_section(None, help_section4_model) 532 | help_model.append_item(help_section4) 533 | 534 | help_section5_model = Gio.Menu() 535 | help_section5_model.append(_('About'), 'app.about') 536 | help_section5 = Gio.MenuItem.new_section(None, help_section5_model) 537 | help_model.append_item(help_section5) 538 | 539 | self.control['help'] = Gtk.MenuButton() 540 | self.control['help'].set_menu_model(help_model) 541 | self.control['help'].add(Gtk.Image.new_from_gicon(Gio.ThemedIcon( 542 | name='open-menu-symbolic'), Gtk.IconSize.BUTTON)) 543 | hb.pack_end(self.control['help']) 544 | 545 | def on_run(self, widget): 546 | if self.main_stack.get_visible_child_name() == 'Data': 547 | selected = get_selected_value_in_combo(self.control['encoder']) 548 | if selected == QRType.GEOLOCATION: 549 | to_encode = ST_GEO.format( 550 | '{:10.4f}'.format(self.viewer.props.latitude), 551 | '{:10.4f}'.format(self.viewer.props.longitude)) 552 | elif selected == QRType.TEXT: 553 | to_encode = self.entry12.get_text() 554 | elif selected == QRType.TELEPHONE_NUMBER: 555 | to_encode = ST_TEL.format(self.entry13.get_text()) 556 | elif selected == QRType.EMAIL: 557 | to_encode = ST_MAIL.format(self.entry14.get_text()) 558 | elif selected == QRType.URL: 559 | to_encode = self.entry15.get_text() 560 | if not to_encode.startswith('http://') and\ 561 | not to_encode.startswith('https://'): 562 | if to_encode.startswith('//'): 563 | to_encode = 'http:' + to_encode 564 | elif to_encode.startswith('/'): 565 | to_encode = 'http:/' + to_encode 566 | else: 567 | to_encode = 'http://' + to_encode 568 | elif selected == QRType.WIFI_LOGIN: 569 | ssid = self.entry161.get_text() 570 | password = self.entry162.get_text() 571 | network_type = get_selected_value_in_combo(self.combobox163) 572 | to_encode = ST_WIFI.format( 573 | network_type, ssid, password) 574 | elif selected == QRType.SMS: 575 | number = self.entry171.get_text() 576 | textbuffer = self.entry172.get_buffer() 577 | start_iter, end_iter = textbuffer.get_bounds() 578 | message = textbuffer.get_text(start_iter, end_iter, True) 579 | to_encode = ST_SMS.format(number, message) 580 | elif selected == QRType.EMAIL_MESSAGE: 581 | email = self.entry181.get_text() 582 | subject = self.entry182.get_text() 583 | textbuffer = self.entry183.get_buffer() 584 | start_iter, end_iter = textbuffer.get_bounds() 585 | message = textbuffer.get_text(start_iter, end_iter, True) 586 | to_encode = ST_EMAIL_MSG.format(email, subject, message) 587 | elif selected == QRType.VCARD: 588 | first_name = self.entries_vcard['01'].get_text() 589 | last_name = self.entries_vcard['02'].get_text() 590 | job_title = self.entries_vcard['03'].get_text() 591 | telephone_number = self.entries_vcard['04'].get_text() 592 | cell_phone = self.entries_vcard['05'].get_text() 593 | fax = self.entries_vcard['06'].get_text() 594 | email = self.entries_vcard['07'].get_text() 595 | web = self.entries_vcard['08'].get_text() 596 | organization = self.entries_vcard['09'].get_text() 597 | street = self.entries_vcard['10'].get_text() 598 | city = self.entries_vcard['11'].get_text() 599 | state = self.entries_vcard['12'].get_text() 600 | postcode = self.entries_vcard['13'].get_text() 601 | country = self.entries_vcard['14'].get_text() 602 | notes = self.entries_vcard['15'].get_text() 603 | if not web.startswith('http') and\ 604 | not web.startswith('https'): 605 | web = 'http:\\' + web 606 | to_encode = ST_VCARD.format(last_name, first_name, first_name, 607 | last_name, organization, job_title, 608 | telephone_number, cell_phone, fax, 609 | email, street, city, state, 610 | postcode, country, web, notes) 611 | elif selected == 'vCal': 612 | to_encode = ''' 613 | BEGIN:VEVENT 614 | SUMMARY:{0} 615 | LOCATION:{1} 616 | DESCRIPTION:{2} 617 | DTSTART:{3} 618 | DTEND:{4} 619 | END:VEVENT 620 | ''' 621 | else: 622 | return 623 | self.do_encode(to_encode) 624 | elif self.main_stack.get_visible_child_name() == 'Code': 625 | self.do_decode(self.image.get_pixbuf()) 626 | 627 | def do_encode(self, to_encode): 628 | # self.entry21.set_text(to_encode) 629 | 630 | def on_encode_done(result, error): 631 | if self.main_stack.get_visible_child_name() == 'Data': 632 | if isinstance(result, GdkPixbuf.Pixbuf): 633 | self.pbuf = result 634 | self.draw_code(first=True) 635 | elif isinstance(result, GdkPixbuf.PixbufSimpleAnim): 636 | self.pbuf = result 637 | self.draw_code(first=True) 638 | else: 639 | print(type(result)) 640 | 641 | self.main_stack.set_visible_child_name('Code') 642 | self.main_stack.set_transition_type( 643 | Gtk.StackTransitionType.UNDER_LEFT) 644 | self.control['run'].get_child().set_from_gicon( 645 | Gio.ThemedIcon(name='go-previous-symbolic'), 646 | Gtk.IconSize.BUTTON) 647 | 648 | elif self.main_stack.get_visible_child_name() == 'Code': 649 | self.main_stack.set_visible_child_name('Data') 650 | self.main_stack.set_transition_type( 651 | Gtk.StackTransitionType.UNDER_RIGHT) 652 | self.control['run'].get_child().set_from_gicon( 653 | Gio.ThemedIcon(name='go-next-symbolic'), 654 | Gtk.IconSize.BUTTON) 655 | 656 | self.main_stack.get_visible_child().show_all() 657 | self.get_window().set_cursor(None) 658 | 659 | @async_function(on_done=on_encode_done) 660 | def do_encode_in_thread(to_encode, picture, progreso): 661 | qr, frames = create_qr(to_encode, picture=picture, 662 | progreso=progreso) 663 | self.frames = frames 664 | return qr 665 | self.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH)) 666 | p = Progreso(_('Creating QR Code'), self) 667 | do_encode_in_thread(to_encode, self.background, progreso=p) 668 | p.run() 669 | 670 | def on_encoder_changed(self, widget): 671 | if self.main_stack.get_visible_child_name() != 'Data': 672 | self.main_stack.set_visible_child_name('Data') 673 | selected = get_selected_value_in_combo(self.control['encoder']) 674 | self.stack.set_visible_child_name(selected.name) 675 | self.stack.get_visible_child().show_all() 676 | 677 | def do_center(self): 678 | def on_center_done(result, error): 679 | # Do stuff with the result and handle errors in the main thread. 680 | if result is not None: 681 | latitude, longitude = result 682 | self.viewer.set_center_and_zoom(latitude, longitude, 14) 683 | 684 | @async_function(on_done=on_center_done) 685 | def do_center_in_thread(): 686 | return get_latitude_longitude() 687 | 688 | do_center_in_thread() 689 | 690 | def init_menu(self, vbox): 691 | menubar = Gtk.MenuBar() 692 | vbox.pack_start(menubar, False, False, 0) 693 | accel_group = Gtk.AccelGroup() 694 | self.add_accel_group(accel_group) 695 | 696 | ################################################################ 697 | self.filemenu = Gtk.Menu.new() 698 | self.filem = Gtk.MenuItem.new_with_label(_('File')) 699 | self.filem.set_submenu(self.filemenu) 700 | # 701 | self.menus = {} 702 | # 703 | self.menus['load'] = Gtk.ImageMenuItem.new_with_label(_('load file')) 704 | self.menus['load'].connect('activate', 705 | self.on_menu_clicked, 'load') 706 | self.menus['load'].add_accelerator( 707 | 'activate', accel_group, ord('L'), Gdk.ModifierType.CONTROL_MASK, 708 | Gtk.AccelFlags.VISIBLE) 709 | self.filemenu.append(self.menus['load']) 710 | self.filemenu.append(Gtk.SeparatorMenuItem()) 711 | self.menus['save-as'] = Gtk.ImageMenuItem.new_with_label(_('Save as')) 712 | self.menus['save-as'].connect('activate', 713 | self.on_menu_clicked, 'save-as') 714 | self.menus['save-as'].add_accelerator( 715 | 'activate', accel_group, ord('S'), Gdk.ModifierType.CONTROL_MASK, 716 | Gtk.AccelFlags.VISIBLE) 717 | self.filemenu.append(self.menus['save-as']) 718 | 719 | def on_menu_clicked(self, widget, option): 720 | if option == 'save-as': 721 | self.save_encoded() 722 | elif option == 'load': 723 | self.load_qrcode() 724 | 725 | def load_qrcode(self): 726 | fcd = Gtk.FileChooserDialog( 727 | _('Set file to load qrcode'), 728 | self, Gtk.FileChooserAction.OPEN, 729 | buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT, 730 | Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT)) 731 | 732 | afilter = Gtk.FileFilter() 733 | afilter.set_name(_('png files')) 734 | afilter.add_mime_type('image/png') 735 | afilter.add_pattern('*.png') 736 | fcd.add_filter(afilter) 737 | fcd.set_current_folder(os.getenv('HOME')) 738 | preview = Gtk.Image() 739 | fcd.set_preview_widget(preview) 740 | fcd.connect('update-preview', update_preview_cb, preview) 741 | res = fcd.run() 742 | if res == Gtk.ResponseType.ACCEPT: 743 | filename = fcd.get_filename() 744 | if os.path.exists(filename): 745 | pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(filename, 746 | 400, 400) 747 | self.image.set_from_pixbuf(pixbuf) 748 | self.qrcode_file = filename 749 | self.do_decode(filename) 750 | fcd.destroy() 751 | 752 | 753 | 754 | def load_background(self): 755 | self.background = None 756 | fcd = Gtk.FileChooserDialog( 757 | _('Set file for QR background'), 758 | self, Gtk.FileChooserAction.OPEN, 759 | buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT, 760 | Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT)) 761 | afilter = Gtk.FileFilter() 762 | afilter.set_name(_('Image files')) 763 | afilter.add_mime_type('image/png') 764 | afilter.add_mime_type('image/jpeg') 765 | afilter.add_mime_type('image/gif') 766 | fcd.add_filter(afilter) 767 | afilter = Gtk.FileFilter() 768 | afilter.set_name(_('png files')) 769 | afilter.add_mime_type('image/png') 770 | fcd.add_filter(afilter) 771 | afilter = Gtk.FileFilter() 772 | afilter.set_name(_('jpeg files')) 773 | afilter.add_mime_type('image/jpeg') 774 | fcd.add_filter(afilter) 775 | afilter = Gtk.FileFilter() 776 | afilter.set_name(_('gif files')) 777 | afilter.add_mime_type('image/gif') 778 | fcd.add_filter(afilter) 779 | fcd.set_current_folder(os.getenv('HOME')) 780 | preview = Gtk.Image() 781 | fcd.set_preview_widget(preview) 782 | fcd.connect('update-preview', update_preview_cb, preview) 783 | res = fcd.run() 784 | if res == Gtk.ResponseType.ACCEPT: 785 | filename = fcd.get_filename() 786 | if os.path.exists(filename): 787 | self.background = filename 788 | fcd.destroy() 789 | 790 | def clean(self): 791 | self.entry12.set_text('') 792 | self.entry13.set_text('') 793 | self.entry14.set_text('') 794 | self.entry15.set_text('') 795 | self.entry161.set_text('') 796 | self.entry162.set_text('') 797 | self.entry171.set_text('') 798 | self.entry172.get_buffer().set_text('') 799 | select_value_in_combo(self.combobox163, 'WEP') 800 | self.entry181.set_text('') 801 | self.entry182.set_text('') 802 | self.entry183.get_buffer().set_text('') 803 | 804 | def do_decode(self, to_decode): 805 | 806 | def on_decode_done(result, error): 807 | self.clean() 808 | if result is not None: 809 | if QRType.get_type(result) == QRType.TEXT: 810 | self.entry12.set_text(result) 811 | elif QRType.get_type(result) == QRType.GEOLOCATION: 812 | r = parse(ST_GEO, result) 813 | if r is not None: 814 | self.viewer.set_center_and_zoom(float(r[0]), 815 | float(r[1]), 816 | 14) 817 | elif QRType.get_type(result) == QRType.TELEPHONE_NUMBER: 818 | r = parse(ST_TEL, result) 819 | if r is not None: 820 | self.entry13.set_text(r[0]) 821 | elif QRType.get_type(result) == QRType.EMAIL: 822 | r = parse(ST_MAIL, result) 823 | if r is not None: 824 | self.entry14.set_text(r[0]) 825 | elif QRType.get_type(result) == QRType.URL: 826 | self.entry15.set_text(result) 827 | elif QRType.get_type(result) == QRType.WIFI_LOGIN: 828 | r = parse(ST_WIFI, result) 829 | if r is not None: 830 | self.entry161.set_text(r[1]) 831 | self.entry162.set_text(r[2]) 832 | select_value_in_combo(self.combobox163, r[0]) 833 | elif QRType.get_type(result) == QRType.SMS: 834 | r = parse(ST_SMS, result) 835 | if r is not None: 836 | self.entry171.set_text(r[0]) 837 | self.entry172.get_buffer().set_text(r[1]) 838 | elif QRType.get_type(result) == QRType.EMAIL_MESSAGE: 839 | r = parse(ST_EMAIL_MSG, result) 840 | if r is not None: 841 | self.entry181.set_text(r[0]) 842 | self.entry182.set_text(r[1]) 843 | self.entry183.get_buffer().set_text(r[2]) 844 | elif QRType.get_type(result) == QRType.VCARD: 845 | r = parse(ST_VCARD, result) 846 | if r is not None: 847 | self.entries_vcard['01'].set_text(r[0]) 848 | self.entries_vcard['02'].set_text(r[1]) 849 | self.entries_vcard['03'].set_text(r[2]) 850 | self.entries_vcard['04'].set_text(r[3]) 851 | self.entries_vcard['05'].set_text(r[4]) 852 | self.entries_vcard['06'].set_text(r[5]) 853 | self.entries_vcard['07'].set_text(r[6]) 854 | self.entries_vcard['08'].set_text(r[7]) 855 | self.entries_vcard['09'].set_text(r[8]) 856 | self.entries_vcard['10'].set_text(r[9]) 857 | self.entries_vcard['11'].set_text(r[10]) 858 | self.entries_vcard['12'].set_text(r[11]) 859 | self.entries_vcard['13'].set_text(r[12]) 860 | self.entries_vcard['14'].set_text(r[13]) 861 | self.entries_vcard['15'].set_text(r[14]) 862 | 863 | select_value_in_combo(self.control['encoder'], 864 | QRType.get_type(result)) 865 | 866 | self.main_stack.set_visible_child_name('Data') 867 | self.main_stack.set_transition_type( 868 | Gtk.StackTransitionType.UNDER_RIGHT) 869 | self.control['run'].get_child().set_from_gicon( 870 | Gio.ThemedIcon(name='go-next-symbolic'), 871 | Gtk.IconSize.BUTTON) 872 | self.main_stack.get_visible_child().show_all() 873 | 874 | @async_function(on_done=on_decode_done) 875 | def do_decode_in_thread(to_decode): 876 | if to_decode is not None: 877 | if isinstance(to_decode, str) and os.path.exists(to_decode): 878 | command = 'zbarimg %s' % (to_decode) 879 | elif isinstance(to_decode, GdkPixbuf.Pixbuf): 880 | mtempfile = tempfile.NamedTemporaryFile(mode='w+b', 881 | prefix='gqrcode', 882 | delete=True).name 883 | to_decode.savev(mtempfile, 'png', [], []) 884 | command = 'zbarimg %s' % (mtempfile) 885 | else: 886 | return None 887 | salida = ejecuta(command) 888 | try: 889 | utf8Data = salida.decode() 890 | salida = utf8Data.split('QR-Code:')[1] 891 | except UnicodeDecodeError as e: 892 | print('UnicodeDecodeError', e) 893 | utf8Data = salida.decode("utf-8").encode("sjis") 894 | salida = utf8Data.decode("utf-8").split('QR-Code:')[1] 895 | if salida.endswith('\n'): 896 | salida = salida[:-1] 897 | return salida 898 | do_decode_in_thread(to_decode) 899 | 900 | def save_encoded(self): 901 | animation = self.image.get_animation() 902 | if animation is None: 903 | pixbuf = self.image.get_pixbuf() 904 | if pixbuf is not None: 905 | fcd = Gtk.FileChooserDialog( 906 | _('Set file to save encode image'), 907 | self, Gtk.FileChooserAction.SAVE, 908 | buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT, 909 | Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT)) 910 | fcd.set_current_folder(os.getenv('HOME')) 911 | fcd.set_default_response(Gtk.ResponseType.OK) 912 | afilter = Gtk.FileFilter() 913 | afilter.set_name(_('png files')) 914 | afilter.add_mime_type('image/png') 915 | afilter.add_pattern('*.png') 916 | fcd.add_filter(afilter) 917 | res = fcd.run() 918 | if res == Gtk.ResponseType.ACCEPT: 919 | filename = fcd.get_filename() 920 | if not filename.endswith('.png'): 921 | filename += '.png' 922 | pixbuf.savev(filename, 'png', [], []) 923 | fcd.destroy() 924 | elif self.frames is not None and len(self.frames) > 0: 925 | fcd = Gtk.FileChooserDialog( 926 | _('Set file to save encode image'), 927 | self, Gtk.FileChooserAction.SAVE, 928 | buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT, 929 | Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT)) 930 | fcd.set_current_folder(os.getenv('HOME')) 931 | fcd.set_default_response(Gtk.ResponseType.OK) 932 | afilter = Gtk.FileFilter() 933 | afilter.set_name(_('gif files')) 934 | afilter.add_mime_type('image/gif') 935 | fcd.add_filter(afilter) 936 | res = fcd.run() 937 | if res == Gtk.ResponseType.ACCEPT: 938 | filename = fcd.get_filename() 939 | if not filename.endswith('.gif'): 940 | filename += '.gif' 941 | self.frames[0].save(filename, 942 | save_all=True, 943 | append_images=self.frames[1:], 944 | loop=0) 945 | fcd.destroy() 946 | 947 | def close_application(self, widget): 948 | self.destroy() 949 | 950 | def on_toolbar_clicked(self, action, name): 951 | if name == 'open': 952 | self.load_qrcode() 953 | elif name == 'load': 954 | self.load_background() 955 | elif name == 'reset': 956 | self.background = None 957 | elif name == 'save': 958 | self.save_encoded() 959 | elif name == 'close': 960 | self.destroy() 961 | 962 | 963 | def main(): 964 | MainWindow() 965 | Gtk.main() 966 | 967 | 968 | if __name__ == '__main__': 969 | main() 970 | exit(0) 971 | --------------------------------------------------------------------------------