예제 #1
0
 def close_showuser_tab(self, id_):
     log.debug('Closing show tab %s' % id_)
     if id_ not in self._tabs['showuser']: # Already removed
         return
     index = self.centralWidget().indexOf(self._tabs['showuser'][id_][0])
     self.centralWidget().removeTab(index)
     del self._tabs['showuser'][id_]
예제 #2
0
 def closemaintab(self, id_):
     log.debug('Closing main tab %s.' % id_)
     if id_ not in self._tabs['main']: # Already removed:
         return
     index = self.centralWidget().indexOf(self._tabs['main'][id_][0])
     self.centralWidget().removeTab(index)
     del self._tabs['main'][id_]
예제 #3
0
 def new_openclose_maintab_slot(checked):
     log.debug('Called new_openclose_maintab_slot for %s with %r.' %
             (id_, checked))
     if checked:
         self.openmaintab(id_)
     else:
         self.closemaintab(id_)
예제 #4
0
    def __init__(self, parent, people, with_entries=False):
        super(PeopleWidget, self).__init__(parent)

        log.debug('Showing user %s.' % people.userid)

        self.setWidgetResizable(True)

        self._widget = QtGui.QWidget()
        self.setWidget(self._widget)
        self._widget.setLayout(PeopleLayout(people, self._widget,
            with_entries))
예제 #5
0
    def __init__(self, people, parent=None, with_entries=False):
        super(PeopleLayout, self).__init__(parent)

        self._profile = ProfileWidget(parent, people)
        self.addWidget(self._profile)

        if with_entries:
            log.debug('Showing entries for user %s' % people.userid)
            entries = Entry.Query(login.get_server(),
                    mode=Entry.Query.MODE_ALL).filterAuthor(people).fetch()
            self._entries = EntryListWidget(parent, entries)
            self.addWidget(self._entries)
예제 #6
0
    def __init__(self, application):
        super(MainWindow, self).__init__()
        self._application = application

        log.debug('Spawning main window.')

        # Title of main window.
        self.setWindowTitle(_('Wididit'))
        self.setWindowIcon(get_qicon())

        self.setCentralWidget(QtGui.QTabWidget(self))
        self.centralWidget().setTabsClosable(True)
        self.centralWidget().setMovable(True)

        self._init_geometry()
        self._init_tabs()
        self._init_toolbar()
예제 #7
0
    def __init__(self, callback):
        super(LoginWindow, self).__init__()
        self._callback = callback

        log.debug("Spawning login window.")

        # Title of login window.
        self.setWindowTitle(_("Connect to Wididit"))
        self.setWindowIcon(get_qicon())

        self.setCentralWidget(QtGui.QWidget())

        self._init_geometry()
        self._init_widgets()

        self.show()

        log.debug("Login window displayed.")
예제 #8
0
    def __init__(self, callback):
        super(LoginWindow, self).__init__()
        self._callback = callback

        log.debug('Spawning login window.')

        # Title of login window.
        self.setWindowTitle(_('Connect to Wididit'))
        self.setWindowIcon(get_qicon())

        self.setCentralWidget(QtGui.QWidget())

        self._init_geometry()
        self._init_widgets()

        self.show()

        log.debug('Login window displayed.')
예제 #9
0
    def on_connect(self, event=None):
        log.debug('User clicked the authentication button. Validating '
                'creditentials...')
        userid = self._userid.text()
        password = self._password.text()
        valid = self._callback(userid, password)
        conf.set(['accounts', 'default', 'userid'], str(userid))
        conf.set(['accounts', 'default', 'pass'], str(password))
        if valid:
            log.info('Valid userid and password. Connected.')
            self._save_geometry()
            self.hide()
        else:
            log.info('Invalid userid or password. Asking authentication again.')

            dialog = QtGui.QMessageBox.critical(self,
                    # 'Login failed' dialog title.
                    _('Connot connect.'),
                    # 'Login failed' dialog content.
                    _('Invalid userid or password. Try again.'))
예제 #10
0
    def on_connect(self, event=None):
        log.debug("User clicked the authentication button. Validating " "creditentials...")
        userid = self._userid.text()
        password = self._password.text()
        valid = self._callback(userid, password)
        conf.set(["accounts", "default", "userid"], str(userid))
        conf.set(["accounts", "default", "pass"], str(password))
        if valid:
            log.info("Valid userid and password. Connected.")
            self._save_geometry()
            self.hide()
        else:
            log.info("Invalid userid or password. Asking authentication again.")

            dialog = QtGui.QMessageBox.critical(
                self,
                # 'Login failed' dialog title.
                _("Connot connect."),
                # 'Login failed' dialog content.
                _("Invalid userid or password. Try again."),
            )
예제 #11
0
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

import os
import sys
import gettext

from wididitclient.utils import log

if 'unittest' in sys.modules:
    _ = lambda x: x
else:
    try:
        log.debug('Trying default gettext path.')
        _trans = gettext.translation('wididitclient')
        _ = _trans.ugettext
        log.debug('Using default gettext path.')
    except:
        try:
            path = os.path.join(sys.prefix, 'local', 'share', 'locale')
            log.debug('Trying forced local path for gettext: %s' % path)
            _trans = gettext.translation('wididitclient', localedir=path)
            _ = _trans.ugettext
            log.debug('Using forced local path for gettext.')
        except:

            def _(string, *args, **kwargs):
                return string
예제 #12
0
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

import os
import sys
import gettext

from wididitclient.utils import log

if 'unittest' in sys.modules:
    _ = lambda x:x
else:
    try:
        log.debug('Trying default gettext path.')
        _trans = gettext.translation('wididitclient')
        _ = _trans.ugettext
        log.debug('Using default gettext path.')
    except:
        try:
            path = os.path.join(sys.prefix, 'local', 'share', 'locale')
            log.debug('Trying forced local path for gettext: %s' % path)
            _trans = gettext.translation('wididitclient', localedir=path)
            _ = _trans.ugettext
            log.debug('Using forced local path for gettext.')
        except:
            def _(string, *args, **kwargs):
                return string
            log.debug('Using gettext fallback.')