root/trunk/libffado/support/mixer-qt4/ffado/regdialog.py

Revision 1640, 3.7 kB (checked in by arnonym, 15 years ago)

Make it more pythonic.

All ffado stuff is now in packages getting installed to the official python dirs. Ideally this would allow other apps to use the stuff from us.

Maybe the generic widgets (that are used by multiple mixers) should go into ffado/widgets...

  • Property svn:mergeinfo set to
Line 
1 #
2 # Copyright (C) 2005-2008 by Pieter Palmers
3 #
4 # This file is part of FFADO
5 # FFADO = Free Firewire (pro-)audio drivers for linux
6 #
7 # FFADO is based upon FreeBoB.
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 2 of the License, or
12 # (at your option) version 3 of the License.
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 <http://www.gnu.org/licenses/>.
21 #
22
23 from PyQt4.QtCore import SIGNAL, SLOT, QObject
24 from PyQt4.QtGui import QDialog
25 from ffado.config import *
26
27 import logging
28 log = logging.getLogger('registration')
29
30 REGISTRATION_MESSAGE = """
31 <html><head><meta name="qrichtext" content="1" />
32 <style type="text/css">\np, li { white-space: pre-wrap; }\n</style></head>
33 <body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">\n
34 <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
35 You are running this version of FFADO for the first time with this device. </p>
36 <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
37 In order to collect usage statistics we would like to send some information about your system to ffado.org.
38 It is very important for us to have good usage statistics. This is to convince vendors that Linux users
39 do exist and is where you as a user can help the project. </p>
40 <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
41 The information collected is intended only for usage monitoring. The email address is optional, and will
42 be used for FFADO related announcements only. If you provide one, please provide a valid one. </p>
43 <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
44 Note: This registration can also be performed on-line at
45 <a href="http://www.ffado.org/?q=usage">http://www.ffado.org/?q=usage</a>.</p></body></html>
46 """
47
48 class ffadoRegDialog(QDialog):
49     def __init__(self, vendor_name, vendor_id, model_name, model_id,
50                  guid, version, email="(optional)",
51                  parent = None):
52         QDialog.__init__(self,parent)
53         uicLoad("ffado_regdialog", self)
54         self.txtVendorName.setText(vendor_name)
55         self.txtVendorId.setText(vendor_id)
56         self.txtModelName.setText(model_name)
57         self.txtModelId.setText(model_id)
58         self.txtGUID.setText(guid)
59         self.txtVersion.setText(version)
60         self.txtEmail.setText(email)
61         self.txtMessage.setHtml(REGISTRATION_MESSAGE)
62
63         self.choice = "nosend"
64         QObject.connect(self.btnSend,SIGNAL('clicked()'),self.buttonPressed)
65         QObject.connect(self.btnNoSend,SIGNAL('clicked()'),self.buttonPressed)
66         QObject.connect(self.btnNeverSend,SIGNAL('clicked()'),self.buttonPressed)
67
68     def buttonPressed(self):
69         sender = self.sender()
70         if sender == self.btnSend:
71             log.debug("user chose to send")
72             self.choice = "send"
73         elif sender ==  self.btnNoSend:
74             log.debug("user chose not to send")
75             self.choice = "nosend"
76         elif sender ==  self.btnNeverSend:
77             log.debug("user chose to never send")
78             self.choice = "neversend"
79         self.close()
80
81     def getEmail(self):
82         return self.txtEmail.text()
83
84 # vim: et
Note: See TracBrowser for help on using the browser.