~dpm/qreator/snap

75 by David Planella
Decoupled QR code types from the QR window and from a particular GUI toolkit (right now only GTK is supported)
1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2
### BEGIN LICENSE
3
# Copyright (C) 2012 David Planella <david.planella@ubuntu.com>
86.1.9 by David Planella
Checkpoint commit for testing purposes
4
# This program is free software: you can redistribute it and/or modify it 
5
# under the terms of the GNU General Public License version 3, as published 
75 by David Planella
Decoupled QR code types from the QR window and from a particular GUI toolkit (right now only GTK is supported)
6
# by the Free Software Foundation.
86.1.9 by David Planella
Checkpoint commit for testing purposes
7
# 
8
# This program is distributed in the hope that it will be useful, but 
9
# WITHOUT ANY WARRANTY; without even the implied warranties of 
10
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 
75 by David Planella
Decoupled QR code types from the QR window and from a particular GUI toolkit (right now only GTK is supported)
11
# PURPOSE.  See the GNU General Public License for more details.
86.1.9 by David Planella
Checkpoint commit for testing purposes
12
# 
13
# You should have received a copy of the GNU General Public License along 
75 by David Planella
Decoupled QR code types from the QR window and from a particular GUI toolkit (right now only GTK is supported)
14
# with this program.  If not, see <http://www.gnu.org/licenses/>.
15
### END LICENSE
16
89.8.2 by Stefan Schwarzburg
Continued on porting the main window to the new QR code dataformts "plugin" structure.
17
from qreator_lib.i18n import _
18
from . QRCodeType import QRCodeType
75 by David Planella
Decoupled QR code types from the QR window and from a particular GUI toolkit (right now only GTK is supported)
19
from QRCodeTextGtk import QRCodeTextGtk
20
89.8.1 by Stefan Schwarzburg
Added a plugin-style class of type "type" which is used by the QRCode class as a metaclass, registering all classes implementing a QRCode.
21
class QRCodeText(QRCodeType):
22
    description =  _('Text')
23
    icon_name = 'text.png'
89.8.4 by Stefan Schwarzburg
The refactoring seems to work now. Commandline options are now also created dynamically.
24
    cmdline_option_long = "--text"
25
    cmdline_option_short = "-t"
26
    message = _("Create a QR code from text")
89.8.1 by Stefan Schwarzburg
Added a plugin-style class of type "type" which is used by the QRCode class as a metaclass, registering all classes implementing a QRCode.
27
28
    def create_widget(self):
75 by David Planella
Decoupled QR code types from the QR window and from a particular GUI toolkit (right now only GTK is supported)
29
        self.widget = QRCodeTextGtk(self.qr_code_update_func)