Esempio n. 1
0
    def __init__(self):
        super(_HelpWindow, self).__init__()

        self.set_size_request(640, 480)
        self.set_position(Gtk.WindowPosition.CENTER_ON_PARENT)
        self.set_modal(True)

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.add(vbox)

        self._help_widget = HelpWidget(self._icon_file)
        vbox.pack_start(self._help_widget, True, True, 0)

        self._help_nav_bar = _HelpNavBar()
        vbox.pack_end(self._help_nav_bar, False, False, _DEFAULT_SPACING)

        for (signal_name,
             callback) in [('forward-clicked', self._forward_clicked_cb),
                           ('reload-clicked', self._reload_clicked_cb),
                           ('back-clicked', self._back_clicked_cb)]:
            self._help_nav_bar.connect(signal_name, callback)

        self._update_prev_next()
    def __init__(self):
        super(_HelpWindow, self).__init__('toolbar-help', _("Help"))

        offset = style.GRID_CELL_SIZE
        width = Gdk.Screen.width() - offset * 2
        height = Gdk.Screen.height() - offset * 2
        self.set_size_request(width, height)

        self._help_widget = HelpWidget(self._icon_file)
        self.content_vbox.pack_start(self._help_widget, True, True, 0)

        self._help_nav_bar = _HelpNavBar()
        self.content_vbox.pack_end(self._help_nav_bar,
                                   expand=False,
                                   fill=False,
                                   padding=style.DEFAULT_SPACING)

        for (signal_name,
             callback) in [('forward-clicked', self._forward_clicked_cb),
                           ('reload-clicked', self._reload_clicked_cb),
                           ('back-clicked', self._back_clicked_cb)]:
            self._help_nav_bar.connect(signal_name, callback)

        self._update_prev_next()
class _HelpWindow(_DialogWindow):
    # A dialog window to display the game instructions.
    def __init__(self):
        super(_HelpWindow, self).__init__('toolbar-help', _("Help"))

        offset = style.GRID_CELL_SIZE
        width = Gdk.Screen.width() - offset * 2
        height = Gdk.Screen.height() - offset * 2
        self.set_size_request(width, height)

        self._help_widget = HelpWidget(self._icon_file)
        self.content_vbox.pack_start(self._help_widget, True, True, 0)

        self._help_nav_bar = _HelpNavBar()
        self.content_vbox.pack_end(self._help_nav_bar,
                                   expand=False,
                                   fill=False,
                                   padding=style.DEFAULT_SPACING)

        for (signal_name,
             callback) in [('forward-clicked', self._forward_clicked_cb),
                           ('reload-clicked', self._reload_clicked_cb),
                           ('back-clicked', self._back_clicked_cb)]:
            self._help_nav_bar.connect(signal_name, callback)

        self._update_prev_next()

    def _forward_clicked_cb(self, source):
        self._help_widget.next_stage()
        self._update_prev_next()

    def _back_clicked_cb(self, source):
        self._help_widget.prev_stage()
        self._update_prev_next()

    def _reload_clicked_cb(self, source):
        self._help_widget.replay_stage()

    def _icon_file(self, icon_name):
        theme = Gtk.IconTheme.get_default()
        info = theme.lookup_icon(icon_name, 0, 0)
        return info.get_filename()

    def _update_prev_next(self):
        hw = self._help_widget
        self._help_nav_bar.set_can_prev_stage(hw.can_prev_stage())
        self._help_nav_bar.set_can_next_stage(hw.can_next_stage())
Esempio n. 4
0
class _HelpWindow(gtk.Window):
    def __init__(self):
        super(_HelpWindow, self).__init__()

        self.set_size_request(640, 480)
        self.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
        self.set_modal(True)

        vbox = gtk.VBox()
        self.add(vbox)

        self._help_widget = HelpWidget(self._icon_file)
        vbox.pack_start(self._help_widget)

        self._help_nav_bar = _HelpNavBar()
        vbox.pack_end(self._help_nav_bar, expand=False)

        for (signal_name, callback) in [
            ("forward-clicked", self._forward_clicked_cb),
            ("reload-clicked", self._reload_clicked_cb),
            ("back-clicked", self._back_clicked_cb),
        ]:
            self._help_nav_bar.connect(signal_name, callback)

        self._update_prev_next()

    def _stop_clicked_cb(self, source):
        self.destroy()

    def _forward_clicked_cb(self, source):
        self._help_widget.next_stage()
        self._update_prev_next()

    def _back_clicked_cb(self, source):
        self._help_widget.prev_stage()
        self._update_prev_next()

    def _reload_clicked_cb(self, source):
        self._help_widget.replay_stage()

    def _icon_file(self, icon_name):
        return os.path.join("icons", icon_name + ".svg")

    def _update_prev_next(self):
        hw = self._help_widget
        self._help_nav_bar.set_can_prev_stage(hw.can_prev_stage())
        self._help_nav_bar.set_can_next_stage(hw.can_next_stage())
Esempio n. 5
0
    def __init__(self):
        super(_HelpWindow, self).__init__('help-icon', _("Help"))

        offset = style.GRID_CELL_SIZE
        width = Gdk.Screen.width() - offset * 2
        height = Gdk.Screen.height() - offset * 2
        self.set_size_request(width, height)

        self._help_widget = HelpWidget(self._icon_file)
        self.content_vbox.pack_start(self._help_widget, True, True, 0)

        self._help_nav_bar = _HelpNavBar()
        self.content_vbox.pack_end(self._help_nav_bar, expand=False,
                                   fill=False, padding=style.DEFAULT_SPACING)

        for (signal_name, callback) in [
                ('forward-clicked', self._forward_clicked_cb),
                ('reload-clicked', self._reload_clicked_cb),
                ('back-clicked', self._back_clicked_cb)]:
            self._help_nav_bar.connect(signal_name, callback)

        self._update_prev_next()
Esempio n. 6
0
class _HelpWindow(Gtk.Window):
    def __init__(self):
        super(_HelpWindow, self).__init__()

        self.set_size_request(640, 480)
        self.set_position(Gtk.WindowPosition.CENTER_ON_PARENT)
        self.set_modal(True)

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.add(vbox)

        self._help_widget = HelpWidget(self._icon_file)
        vbox.pack_start(self._help_widget, True, True, 0)

        self._help_nav_bar = _HelpNavBar()
        vbox.pack_end(self._help_nav_bar, False, False, _DEFAULT_SPACING)

        for (signal_name,
             callback) in [('forward-clicked', self._forward_clicked_cb),
                           ('reload-clicked', self._reload_clicked_cb),
                           ('back-clicked', self._back_clicked_cb)]:
            self._help_nav_bar.connect(signal_name, callback)

        self._update_prev_next()

    def _stop_clicked_cb(self, source):
        self.destroy()

    def _forward_clicked_cb(self, source):
        self._help_widget.next_stage()
        self._update_prev_next()

    def _back_clicked_cb(self, source):
        self._help_widget.prev_stage()
        self._update_prev_next()

    def _reload_clicked_cb(self, source):
        self._help_widget.replay_stage()

    def _icon_file(self, icon_name):
        return os.path.join('icons', icon_name + '.svg')

    def _update_prev_next(self):
        hw = self._help_widget
        self._help_nav_bar.set_can_prev_stage(hw.can_prev_stage())
        self._help_nav_bar.set_can_next_stage(hw.can_next_stage())
Esempio n. 7
0
class _HelpWindow(Gtk.Window):
    def __init__(self):
        super(_HelpWindow, self).__init__()

        self.set_size_request(640, 480)
        self.set_position(Gtk.WindowPosition.CENTER_ON_PARENT)
        self.set_modal(True)

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.add(vbox)

        self._help_widget = HelpWidget(self._icon_file)
        vbox.pack_start(self._help_widget, True, True, 0)

        self._help_nav_bar = _HelpNavBar()
        vbox.pack_end(self._help_nav_bar, False, False, _DEFAULT_SPACING)

        for (signal_name, callback) in [
                ('forward-clicked', self._forward_clicked_cb),
                ('reload-clicked', self._reload_clicked_cb),
                ('back-clicked', self._back_clicked_cb)]:
            self._help_nav_bar.connect(signal_name, callback)

        self._update_prev_next()

    def _stop_clicked_cb(self, source):
        self.destroy()

    def _forward_clicked_cb(self, source):
        self._help_widget.next_stage()
        self._update_prev_next()

    def _back_clicked_cb(self, source):
        self._help_widget.prev_stage()
        self._update_prev_next()

    def _reload_clicked_cb(self, source):
        self._help_widget.replay_stage()

    def _icon_file(self, icon_name):
        return os.path.join('icons', icon_name + '.svg')

    def _update_prev_next(self):
        hw = self._help_widget
        self._help_nav_bar.set_can_prev_stage(hw.can_prev_stage())
        self._help_nav_bar.set_can_next_stage(hw.can_next_stage())
Esempio n. 8
0
class _HelpWindow(_DialogWindow):
    # A dialog window to display the game instructions.
    def __init__(self):
        super(_HelpWindow, self).__init__('help-icon', _("Help"))

        offset = style.GRID_CELL_SIZE
        width = Gdk.Screen.width() - offset * 2
        height = Gdk.Screen.height() - offset * 2
        self.set_size_request(width, height)

        self._help_widget = HelpWidget(self._icon_file)
        self.content_vbox.pack_start(self._help_widget, True, True, 0)

        self._help_nav_bar = _HelpNavBar()
        self.content_vbox.pack_end(self._help_nav_bar, expand=False,
                                   fill=False, padding=style.DEFAULT_SPACING)

        for (signal_name, callback) in [
                ('forward-clicked', self._forward_clicked_cb),
                ('reload-clicked', self._reload_clicked_cb),
                ('back-clicked', self._back_clicked_cb)]:
            self._help_nav_bar.connect(signal_name, callback)

        self._update_prev_next()

    def _forward_clicked_cb(self, source):
        self._help_widget.next_stage()
        self._update_prev_next()

    def _back_clicked_cb(self, source):
        self._help_widget.prev_stage()
        self._update_prev_next()

    def _reload_clicked_cb(self, source):
        self._help_widget.replay_stage()

    def _icon_file(self, icon_name):
        theme = Gtk.IconTheme.get_default()
        info = theme.lookup_icon(icon_name, 0, 0)
        return info.get_filename()

    def _update_prev_next(self):
        hw = self._help_widget
        self._help_nav_bar.set_can_prev_stage(hw.can_prev_stage())
        self._help_nav_bar.set_can_next_stage(hw.can_next_stage())
Esempio n. 9
0
    def __init__(self):
        super(_HelpWindow, self).__init__()

        self.set_size_request(640, 480)
        self.set_position(Gtk.WindowPosition.CENTER_ON_PARENT)
        self.set_modal(True)

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.add(vbox)

        self._help_widget = HelpWidget(self._icon_file)
        vbox.pack_start(self._help_widget, True, True, 0)

        self._help_nav_bar = _HelpNavBar()
        vbox.pack_end(self._help_nav_bar, False, False, _DEFAULT_SPACING)

        for (signal_name, callback) in [
                ('forward-clicked', self._forward_clicked_cb),
                ('reload-clicked', self._reload_clicked_cb),
                ('back-clicked', self._back_clicked_cb)]:
            self._help_nav_bar.connect(signal_name, callback)

        self._update_prev_next()
Esempio n. 10
0
    def __init__(self):
        super(_HelpWindow, self).__init__()

        self.set_size_request(640, 480)
        self.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
        self.set_modal(True)

        vbox = gtk.VBox()
        self.add(vbox)

        self._help_widget = HelpWidget(self._icon_file)
        vbox.pack_start(self._help_widget)

        self._help_nav_bar = _HelpNavBar()
        vbox.pack_end(self._help_nav_bar, expand=False)

        for (signal_name, callback) in [
            ("forward-clicked", self._forward_clicked_cb),
            ("reload-clicked", self._reload_clicked_cb),
            ("back-clicked", self._back_clicked_cb),
        ]:
            self._help_nav_bar.connect(signal_name, callback)

        self._update_prev_next()
Esempio n. 11
0
    def __init__(self, data_source, data_proc_X, data_proc_Z, settings_control,
                 bpm_name):
        super(MainWindow, self).__init__()

        ui_path = os.path.dirname(os.path.abspath(__file__))
        self.ui = uic.loadUi(os.path.join(ui_path, 'MainWindow.ui'), self)

        self.window_str = "None"
        self.bpm = bpm_name

        if self.bpm == "all":
            """ Replace one widget with another """
            old_statusWidget = self.statusWidget
            new_statusWidget = data_source.get_status_widget()
            new_statusWidget.setParent(self.centralwidget)

            self.ui.verticalLayout.replaceWidget(old_statusWidget,
                                                 new_statusWidget)
            old_statusWidget.deleteLater()
            self.statusWidget = new_statusWidget

        else:
            """ Creating phase button """
            old_Widget = self.statusWidget
            self.phasebtn = QPushButton('Phase', self)
            self.phase_widget = PhaseWidget(os.path.join(ui_path))
            self.phasebtn.clicked.connect(self.phase_widget.show)

            self.ui.verticalLayout.replaceWidget(old_Widget, self.phasebtn)
            old_Widget.deleteLater()

        self.images_list = []
        self.x_rect = None
        self.fx_rect = None
        self.z_rect = None
        self.fz_rect = None

        self.data_source = data_source
        self.data_proc_X = data_proc_X
        self.data_proc_Z = data_proc_Z
        self.settingsControl = settings_control

        self.data_proc_X.data_processed.connect(self.on_data2_ready)
        self.data_proc_Z.data_processed.connect(self.on_data4_ready)

        self.controlWidgetX.window_changed_str.connect(
            self.data_proc_X.on_wind_changed)
        self.controlWidgetX.groupBox.setTitle("X Controller")
        self.controlWidgetX.set_str_id("Data_X")
        self.controlWidgetX.scale_changed_obj.connect(self.on_scale_changing)

        self.controlWidgetZ.window_changed_str.connect(
            self.data_proc_Z.on_wind_changed)
        self.controlWidgetZ.groupBox.setTitle("Z Controller")
        self.controlWidgetZ.set_str_id("Data_Z")
        self.controlWidgetZ.scale_changed_obj.connect(self.on_scale_changing)

        self.controlWidgetX.method_changed_str.connect(
            self.data_proc_X.on_method_changed)
        self.controlWidgetX.boards_changed.connect(
            self.data_proc_X.on_boards_changed)

        self.controlWidgetZ.method_changed_str.connect(
            self.data_proc_Z.on_method_changed)
        self.controlWidgetZ.boards_changed.connect(
            self.data_proc_Z.on_boards_changed)

        self.actionSave.triggered.connect(self.on_save_button)
        self.actionRead.triggered.connect(self.on_read_button)

        self.actionExit.triggered.connect(self.on_exit_button)
        self.actionExit.triggered.connect(QApplication.instance().quit)

        self.help_widget = HelpWidget(
            os.path.join(ui_path, 'etc/icons/Help_1.png'))
        self.actionHelp.triggered.connect(self.help_widget.show)

        self.controlWidgetX.boards_changed.connect(self.boards_X_changed)
        self.controlWidgetZ.boards_changed.connect(self.boards_Z_changed)

        self.ui.nu_x_label.setText('\u03BD<sub>x</sub> = ')
        self.ui.nu_z_label.setText('\u03BD<sub>z</sub> = ')

        self.plots_customization()

        self.data_curve1 = self.ui.plotX.plot(pen='r', title='X_plot')
        self.data_curve2 = self.ui.plotFX.plot(
            pen='r', title='Fourier Transform X_plot')
        self.data_curve3 = self.ui.plotZ.plot(pen='b', title='Z_plot')
        self.data_curve4 = self.ui.plotFZ.plot(
            pen='b', title='Fourier Transform Z_plot')