示例#1
0
    def __init__(self):
        if MainWindow._main_created:
            logging.error('Error: Main window already created!')
            return
        MainWindow._main_created = True

        qtwindow.QTWindow.__init__(self, 'main', 'QT Lab', add_to_main=False)
        self.connect("delete-event", self._delete_event_cb)
        self.connect("destroy", self._destroy_cb)

        self.vbox = gtk.VBox()

        menu = [{
            'name':
            _L('File'),
            'icon':
            '',
            'submenu': [{
                'name': _L('Save'),
                'icon': '',
                'action': self._save_cb
            }, {
                'name': _L('Exit'),
                'icon': '',
                'action': self._exit_cb
            }]
        }, {
            'name': _L('Help'),
            'icon': '',
            'submenu': [{
                'name': _L('About'),
                'icon': ''
            }]
        }]
        #        self.menu = gui.build_menu(menu)

        self._userlist = gtk.ListStore(str)
        self._populate_user_cb()
        self._userfield = gtk.ComboBoxEntry(self._userlist, 0)
        prevuser = get_shared_config().get('user')
        if prevuser == None:
            prevuser = '******'
        self._userfield.child.set_text(prevuser)
        if not self._user_in_cb(prevuser):
            self._add_user_cb_row(prevuser)
        self._userfield.connect('changed', self._user_changed)
        self._userfield.child.connect('activate', self._save_user)

        self._userlbl = gtk.Label('{:s}:'.format(_L('user')))
        self._userbtn = gtk.Button(_L('OK'))
        self._userbtn.set_sensitive(False)
        self._userbtn.connect('clicked', self._save_user)
        self._userhbox = gtk.HBox(spacing=2)
        self._userhbox.pack_start(self._userlbl, expand=False)
        self._userhbox.pack_start(self._userfield)
        self._userhbox.pack_start(self._userbtn, expand=False)

        self._liveplot_but = gtk.ToggleButton(_L('Live Plotting'))
        self._liveplot_but.set_active(qt.flow.get_live_plot())
        self._liveplot_but.connect('clicked', self._toggle_liveplot_cb)
        self._replot_but = gtk.Button(_L('Replot'))
        self._replot_but.connect('clicked', self._toggle_replot_cb)
        self._stop_but = stopbutton.StopButton()
        self._pause_but = stopbutton.PauseButton()

        vbox = gui.orderedbox.OrderedVBox()
        vbox.add(self._userhbox, 1, False)
        vbox.add(self._liveplot_but, 10, False)
        vbox.add(self._replot_but, 11, False)
        vbox.add(self._stop_but, 12, False)
        vbox.add(self._pause_but, 13, True)
        self._vbox = vbox
        self.add(self._vbox)

        self.show_all()
示例#2
0
文件: data.py 项目: Sam-MSU/neqstlab
import os.path
import time
import numpy
import types
import re
import logging
import copy
import shutil

from gettext import gettext as _L

from lib import namedlist, temp
from lib.misc import dict_to_ordered_tuples, get_arg_type
from lib.config import get_config, get_shared_config
config = get_config()
shared_config = get_shared_config()
in_qtlab = config.get('qtlab', False)
from lib.network.object_sharer import SharedGObject, cache_result

if in_qtlab:
    import qt

# Filename generator classes

class DateTimeGenerator:
    '''
    Class to generate filenames / directories based on the date and time.
    '''

    def __init__(self):
        pass
示例#3
0
 def _save_user(self, widget):
     user = self._userfield.get_active_text()
     get_shared_config().set('user', user)
     self._userbtn.set_sensitive(False)
     if not self._user_in_cb(user):
         self._add_user_cb_row(user)
示例#4
0
import time
import numpy
import types
import re
import logging
import copy
import shutil

from gettext import gettext as _L

from lib import namedlist, temp
from lib.misc import dict_to_ordered_tuples, get_arg_type
from lib.config import get_config, get_shared_config

config = get_config()
shared_config = get_shared_config()
in_qtlab = config.get('qtlab', False)
from lib.network.object_sharer import SharedGObject, cache_result

if in_qtlab:
    import qt

# Filename generator classes


class DateTimeGenerator:
    '''
    Class to generate filenames / directories based on the date and time.
    '''
    def __init__(self):
        pass