示例#1
0
    def on_apply_clicked(self, widget):
        ConfigManager.set_conf('seperator-size', int(self.adj_seperator.get_value()))

        ConfigManager.set_conf('transparency', int(self.adj_transparency.get_value()))

        ConfigManager.set_conf('skip-taskbar', self.chk_hide_from_taskbar.get_active())

        ConfigManager.set_conf('use-border', self.chk_use_border.get_active())

        ConfigManager.set_conf('color-text', self.color_text.get_color().to_string())

        ConfigManager.set_conf('color-background', self.color_background.get_color().to_string())

        ConfigManager.set_conf('shell', self.entry_shell.get_text())

        ConfigManager.set_conf('select-by-word', self.entry_select_by_word.get_text())

        if self.radio_home.get_active():
            ConfigManager.set_conf('dir', '$home$')
        elif self.radio_pwd.get_active():
            ConfigManager.set_conf('dir', '$pwd$')
        else:
            ConfigManager.set_conf('dir', self.dir_custom.get_text())

        ConfigManager.set_conf('background-image', self.background_image.get_filename())

        ConfigManager.set_conf('use-default-font', self.chk_use_system_font.get_active())

        ConfigManager.set_conf('font-name', self.font_name.get_font_name())

        ConfigManager.set_conf('show-scrollbar', self.chk_show_scrollbar.get_active())

        ConfigManager.set_conf('always-on-top', self.chk_always_on_top.get_active())

        ConfigManager.set_conf('losefocus-hiding', self.chk_losefocus.get_active())

        ConfigManager.set_conf('hide-on-start', self.chk_hide_on_start.get_active())

        ConfigManager.set_conf('fullscreen-key', self.fullscreen_key.get_text())

        ConfigManager.set_conf('quit-key', self.quit_key.get_text())

        ConfigManager.set_conf('new-page-key', self.new_page_key.get_text())

        ConfigManager.set_conf('close-page-key', self.close_page_key.get_text())

        ConfigManager.set_conf('rename-page-key', self.rename_page_key.get_text())

        ConfigManager.set_conf('next-page-key', self.next_page_key.get_text())

        ConfigManager.set_conf('prev-page-key', self.prev_page_key.get_text())

        ConfigManager.set_conf('global-key', self.global_key.get_text())

        ConfigManager.set_conf('select-all-key', self.select_all_key.get_text())

        ConfigManager.set_conf('copy-key', self.copy_key.get_text())

        ConfigManager.set_conf('paste-key', self.paste_key.get_text())

        ConfigManager.set_conf('split-h-key', self.split_h_key.get_text())

        ConfigManager.set_conf('split-v-key', self.split_v_key.get_text())

        ConfigManager.set_conf('close-node-key', self.close_node_key.get_text())
    
        ConfigManager.set_conf('move-up-key', self.move_up_key.get_text())

        ConfigManager.set_conf('move-down-key', self.move_down_key.get_text())

        ConfigManager.set_conf('move-left-key', self.move_left_key.get_text())

        ConfigManager.set_conf('move-right-key', self.move_right_key.get_text())

        ConfigManager.set_conf('toggle-scrollbars-key', self.toggle_scrollbars_key.get_text())

        try:
            scrollback_line = int(self.entry_scrollback_lines.get_text())
        except ValueError:
            scrollback_line = 1024

        ConfigManager.set_conf('scrollback-lines', str(scrollback_line))

        ConfigManager.set_conf('scroll-on-output', self.chk_scroll_on_output.get_active())

        ConfigManager.set_conf('scroll-on-keystroke', self.chk_scroll_on_keystroke.get_active())

        ConfigManager.set_conf('infinite-scrollback', self.chk_scrollback_unlimited.get_active())

        ConfigManager.set_conf('hide-tab-bar', self.chk_hide_tab_bar.get_active())

        ConfigManager.set_conf('hide-tab-bar-fullscreen', self.chk_hide_tab_bar_fullscreen.get_active())
        
        ConfigManager.set_conf('prompt-on-quit', self.chk_prompt_on_quit.get_active())

        ConfigManager.set_conf('spawn-term-on-last-close', self.spawn_term_on_last_close.get_active())

        try:
            step_time = int(self.entry_step_time.get_text())
            if not step_time > 0:
                step_time = 20
        except ValueError:
            step_time = 20

        try:
            step_count = int(self.entry_step_count.get_text())
            if not step_count > 0:
                step_count = 20
        except ValueError:
            step_count = 20

        ConfigManager.set_conf('use-animation', self.chk_use_animation.get_active())

        ConfigManager.set_conf('step-count', step_count)
        ConfigManager.set_conf('step-time', step_time)



        if (self.chk_run_on_startup.get_active() and not os.path.exists(os.environ['HOME'] + '/.config/autostart/terra.desktop')):
            os.system('cp /usr/share/applications/terra.desktop ' + os.environ['HOME'] + '/.config/autostart/terra.desktop')

        if (not self.chk_run_on_startup.get_active() and os.path.exists(os.environ['HOME'] + '/.config/autostart/terra.desktop')):
            os.system('rm -f ' + os.environ['HOME'] + '/.config/autostart/terra.desktop')

        ConfigManager.save_config()
        ConfigManager.callback()
示例#2
0
    def on_apply_clicked(self, widget):
        ConfigManager.set_conf('seperator-size', int(self.adj_seperator.get_value()))

        ConfigManager.set_conf('width', int(self.adj_width.get_value()))

        ConfigManager.set_conf('height', int(self.adj_height.get_value()))

        ConfigManager.set_conf('transparency', int(self.adj_transparency.get_value()))

        ConfigManager.set_conf('vertical-position', self.v_alig.get_active() * 50)

        ConfigManager.set_conf('horizontal-position', self.h_alig.get_active() * 50)

        ConfigManager.set_conf('skip-taskbar', self.chk_hide_from_taskbar.get_active())

        ConfigManager.set_conf('use-border', self.chk_use_border.get_active())

        ConfigManager.set_conf('color-text', self.color_text.get_color().to_string())

        ConfigManager.set_conf('color-background', self.color_background.get_color().to_string())

        ConfigManager.set_conf('shell', self.entry_shell.get_text())

        if self.radio_home.get_active():
            ConfigManager.set_conf('dir', '$home$')
        elif self.radio_pwd.get_active():
            ConfigManager.set_conf('dir', '$pwd$')
        else:
            ConfigManager.set_conf('dir', self.dir_custom.get_text())

        ConfigManager.set_conf('background-image', self.background_image.get_filename())

        ConfigManager.set_conf('use-default-font', self.chk_use_system_font.get_active())

        ConfigManager.set_conf('font-name', self.font_name.get_font_name())

        ConfigManager.set_conf('show-scrollbar', self.chk_show_scrollbar.get_active())

        ConfigManager.set_conf('always-on-top', self.chk_always_on_top.get_active())

        ConfigManager.set_conf('losefocus-hiding', self.chk_losefocus.get_active())

        ConfigManager.set_conf('hide-on-start', self.chk_hide_on_start.get_active())

        ConfigManager.set_conf('fullscreen-key', self.fullscreen_key.get_text())

        ConfigManager.set_conf('quit-key', self.quit_key.get_text())

        ConfigManager.set_conf('new-page-key', self.new_page_key.get_text())

        ConfigManager.set_conf('close-page-key', self.close_page_key.get_text())

        ConfigManager.set_conf('rename-page-key', self.rename_page_key.get_text())

        ConfigManager.set_conf('next-page-key', self.next_page_key.get_text())

        ConfigManager.set_conf('prev-page-key', self.prev_page_key.get_text())

        ConfigManager.set_conf('global-key', self.global_key.get_text())

        ConfigManager.set_conf('select-all-key', self.select_all_key.get_text())

        ConfigManager.set_conf('copy-key', self.copy_key.get_text())

        ConfigManager.set_conf('paste-key', self.paste_key.get_text())

        ConfigManager.set_conf('split-h-key', self.split_h_key.get_text())

        ConfigManager.set_conf('split-v-key', self.split_v_key.get_text())

        ConfigManager.set_conf('close-node-key', self.close_node_key.get_text())

        if (self.chk_run_on_startup.get_active() and not os.path.exists(os.environ['HOME'] + '/.config/autostart/terra.desktop')):
            os.system('cp /usr/share/applications/terra.desktop ' + os.environ['HOME'] + '/.config/autostart/terra.desktop')

        if (not self.chk_run_on_startup.get_active() and os.path.exists(os.environ['HOME'] + '/.config/autostart/terra.desktop')):
            os.system('rm -f ' + os.environ['HOME'] + '/.config/autostart/terra.desktop')

        ConfigManager.save_config()
        ConfigManager.callback()
示例#3
0
    def on_apply_clicked(self, widget):
        ConfigManager.set_conf('seperator-size',
                               int(self.adj_seperator.get_value()))

        ConfigManager.set_conf('transparency',
                               int(self.adj_transparency.get_value()))

        ConfigManager.set_conf('skip-taskbar',
                               self.chk_hide_from_taskbar.get_active())

        ConfigManager.set_conf('use-border', self.chk_use_border.get_active())

        ConfigManager.set_conf('color-text',
                               self.color_text.get_color().to_string())

        ConfigManager.set_conf('color-background',
                               self.color_background.get_color().to_string())

        ConfigManager.set_conf('shell', self.entry_shell.get_text())

        ConfigManager.set_conf('select-by-word',
                               self.entry_select_by_word.get_text())

        if self.radio_home.get_active():
            ConfigManager.set_conf('dir', '$home$')
        elif self.radio_pwd.get_active():
            ConfigManager.set_conf('dir', '$pwd$')
        else:
            ConfigManager.set_conf('dir', self.dir_custom.get_text())

        ConfigManager.set_conf('background-image',
                               self.background_image.get_filename())

        ConfigManager.set_conf('use-default-font',
                               self.chk_use_system_font.get_active())

        ConfigManager.set_conf('font-name', self.font_name.get_font_name())

        ConfigManager.set_conf('show-scrollbar',
                               self.chk_show_scrollbar.get_active())

        ConfigManager.set_conf('always-on-top',
                               self.chk_always_on_top.get_active())

        ConfigManager.set_conf('losefocus-hiding',
                               self.chk_losefocus.get_active())

        ConfigManager.set_conf('hide-on-start',
                               self.chk_hide_on_start.get_active())

        ConfigManager.set_conf('fullscreen-key',
                               self.fullscreen_key.get_text())

        ConfigManager.set_conf('quit-key', self.quit_key.get_text())

        ConfigManager.set_conf('new-page-key', self.new_page_key.get_text())

        ConfigManager.set_conf('close-page-key',
                               self.close_page_key.get_text())

        ConfigManager.set_conf('rename-page-key',
                               self.rename_page_key.get_text())

        ConfigManager.set_conf('next-page-key', self.next_page_key.get_text())

        ConfigManager.set_conf('prev-page-key', self.prev_page_key.get_text())

        ConfigManager.set_conf('global-key', self.global_key.get_text())

        ConfigManager.set_conf('select-all-key',
                               self.select_all_key.get_text())

        ConfigManager.set_conf('copy-key', self.copy_key.get_text())

        ConfigManager.set_conf('paste-key', self.paste_key.get_text())

        ConfigManager.set_conf('split-h-key', self.split_h_key.get_text())

        ConfigManager.set_conf('split-v-key', self.split_v_key.get_text())

        ConfigManager.set_conf('close-node-key',
                               self.close_node_key.get_text())

        ConfigManager.set_conf('move-up-key', self.move_up_key.get_text())

        ConfigManager.set_conf('move-down-key', self.move_down_key.get_text())

        ConfigManager.set_conf('move-left-key', self.move_left_key.get_text())

        ConfigManager.set_conf('move-right-key',
                               self.move_right_key.get_text())

        ConfigManager.set_conf('toggle-scrollbars-key',
                               self.toggle_scrollbars_key.get_text())

        try:
            scrollback_line = int(self.entry_scrollback_lines.get_text())
        except ValueError:
            scrollback_line = 1024

        ConfigManager.set_conf('scrollback-lines', str(scrollback_line))

        ConfigManager.set_conf('scroll-on-output',
                               self.chk_scroll_on_output.get_active())

        ConfigManager.set_conf('scroll-on-keystroke',
                               self.chk_scroll_on_keystroke.get_active())

        ConfigManager.set_conf('infinite-scrollback',
                               self.chk_scrollback_unlimited.get_active())

        ConfigManager.set_conf('hide-tab-bar',
                               self.chk_hide_tab_bar.get_active())

        ConfigManager.set_conf('hide-tab-bar-fullscreen',
                               self.chk_hide_tab_bar_fullscreen.get_active())

        ConfigManager.set_conf('prompt-on-quit',
                               self.chk_prompt_on_quit.get_active())

        ConfigManager.set_conf('spawn-term-on-last-close',
                               self.spawn_term_on_last_close.get_active())

        try:
            step_time = int(self.entry_step_time.get_text())
            if not step_time > 0:
                step_time = 20
        except ValueError:
            step_time = 20

        try:
            step_count = int(self.entry_step_count.get_text())
            if not step_count > 0:
                step_count = 20
        except ValueError:
            step_count = 20

        ConfigManager.set_conf('use-animation',
                               self.chk_use_animation.get_active())

        ConfigManager.set_conf('step-count', step_count)
        ConfigManager.set_conf('step-time', step_time)

        if (self.chk_run_on_startup.get_active()
                and not os.path.exists(os.environ['HOME'] +
                                       '/.config/autostart/terra.desktop')):
            os.system('cp /usr/share/applications/terra.desktop ' +
                      os.environ['HOME'] + '/.config/autostart/terra.desktop')

        if (not self.chk_run_on_startup.get_active()
                and os.path.exists(os.environ['HOME'] +
                                   '/.config/autostart/terra.desktop')):
            os.system('rm -f ' + os.environ['HOME'] +
                      '/.config/autostart/terra.desktop')

        ConfigManager.save_config()
        ConfigManager.callback()
示例#4
0
    def on_keypress(self, widget, event):
        if ConfigManager.key_event_compare('toggle-scrollbars-key', event):
            ConfigManager.set_conf(
                'show-scrollbar', not ConfigManager.get_conf('show-scrollbar'))
            ConfigManager.save_config()
            ConfigManager.callback()
            return True

        if ConfigManager.key_event_compare('move-up-key', event):
            self.get_active_terminal().move(direction=1)
            return True

        if ConfigManager.key_event_compare('move-down-key', event):
            self.get_active_terminal().move(direction=2)
            return True

        if ConfigManager.key_event_compare('move-left-key', event):
            self.get_active_terminal().move(direction=3)
            return True

        if ConfigManager.key_event_compare('move-right-key', event):
            self.get_active_terminal().move(direction=4)
            return True

        if ConfigManager.key_event_compare('quit-key', event):
            self.quit()
            return True

        if ConfigManager.key_event_compare('select-all-key', event):
            self.get_active_terminal().select_all()
            return True

        if ConfigManager.key_event_compare('copy-key', event):
            self.get_active_terminal().copy_clipboard()
            return True

        if ConfigManager.key_event_compare('paste-key', event):
            self.get_active_terminal().paste_clipboard()
            return True

        if ConfigManager.key_event_compare('split-v-key', event):
            self.get_active_terminal().split_axis(None, 'h')
            return True

        if ConfigManager.key_event_compare('split-h-key', event):
            self.get_active_terminal().split_axis(None, 'v')
            return True

        if ConfigManager.key_event_compare('close-node-key', event):
            self.get_active_terminal().close_node(None)
            return True

        if ConfigManager.key_event_compare('fullscreen-key', event):
            self.toggle_fullscreen()
            return True

        if ConfigManager.key_event_compare('new-page-key', event):
            self.add_page()
            return True

        if ConfigManager.key_event_compare('rename-page-key', event):
            for button in self.buttonbox:
                if button != self.radio_group_leader and button.get_active():
                    self.page_rename(None, button)
                    return True

        if ConfigManager.key_event_compare('close-page-key', event):
            for button in self.buttonbox:
                if button != self.radio_group_leader and button.get_active():
                    self.page_close(None, button)
                    return True

        if ConfigManager.key_event_compare('next-page-key', event):
            page_button_list = self.buttonbox.get_children()[1:]

            for i in range(len(page_button_list)):
                if (page_button_list[i].get_active() == True):
                    if (i + 1 < len(page_button_list)):
                        page_button_list[i + 1].set_active(True)
                    else:
                        page_button_list[0].set_active(True)
                    return True

        if ConfigManager.key_event_compare('prev-page-key', event):
            page_button_list = self.buttonbox.get_children()[1:]

            for i in range(len(page_button_list)):
                if page_button_list[i].get_active():
                    if i > 0:
                        page_button_list[i - 1].set_active(True)
                    else:
                        page_button_list[-1].set_active(True)
                    return True

        if ConfigManager.key_event_compare('move-page-left', event):
            i = 0
            for button in self.buttonbox:
                if button != self.radio_group_leader and button.get_active():
                    if (i - 1) > 0:
                        self.notebook.reorder_child(
                            self.notebook.get_nth_page(i - 1), i - 2)
                        self.buttonbox.reorder_child(button, i - 1)
                        return True
                    else:
                        return False
                i += 1

        if ConfigManager.key_event_compare('move-page-right', event):
            i = 0
            for button in self.buttonbox:
                if button != self.radio_group_leader and button.get_active():
                    if (i + 1) < len(self.buttonbox):
                        self.notebook.reorder_child(
                            self.notebook.get_nth_page(i - 1), i)
                        self.buttonbox.reorder_child(button, i + 1)
                        return True
                    else:
                        return False
                i += 1
示例#5
0
    def on_keypress(self, widget, event):
        if ConfigManager.key_event_compare('toggle-scrollbars-key', event):
            ConfigManager.set_conf('show-scrollbar', not ConfigManager.get_conf('show-scrollbar'))
            ConfigManager.save_config()
            ConfigManager.callback()
            return True

        if ConfigManager.key_event_compare('move-up-key', event):
            self.get_active_terminal().move(direction=1)
            return True

        if ConfigManager.key_event_compare('move-down-key', event):
            self.get_active_terminal().move(direction=2)
            return True

        if ConfigManager.key_event_compare('move-left-key', event):
            self.get_active_terminal().move(direction=3)
            return True

        if ConfigManager.key_event_compare('move-right-key', event):
            self.get_active_terminal().move(direction=4)
            return True

        if ConfigManager.key_event_compare('quit-key', event):
            self.quit()
            return True

        if ConfigManager.key_event_compare('select-all-key', event):
            self.get_active_terminal().select_all()
            return True

        if ConfigManager.key_event_compare('copy-key', event):
            self.get_active_terminal().copy_clipboard()
            return True

        if ConfigManager.key_event_compare('paste-key', event):
            self.get_active_terminal().paste_clipboard()
            return True

        if ConfigManager.key_event_compare('split-v-key', event):
            self.get_active_terminal().split_axis(None, 'h')
            return True

        if ConfigManager.key_event_compare('split-h-key', event):
            self.get_active_terminal().split_axis(None, 'v')
            return True

        if ConfigManager.key_event_compare('close-node-key', event):
            self.get_active_terminal().close_node(None)
            return True

        if ConfigManager.key_event_compare('fullscreen-key', event):
            self.toggle_fullscreen()
            return True

        if ConfigManager.key_event_compare('new-page-key', event):
            self.add_page()
            return True

        if ConfigManager.key_event_compare('rename-page-key', event):
            for button in self.buttonbox:
                if button != self.radio_group_leader and button.get_active():
                    self.page_rename(None, button)
                    return True

        if ConfigManager.key_event_compare('close-page-key', event):
            for button in self.buttonbox:
                if button != self.radio_group_leader and button.get_active():
                    self.page_close(None, button)
                    return True

        if ConfigManager.key_event_compare('next-page-key', event):
            page_button_list = self.buttonbox.get_children()[1:]

            for i in range(len(page_button_list)):
                if (page_button_list[i].get_active() == True):
                    if (i + 1 < len(page_button_list)):
                        page_button_list[i+1].set_active(True)
                    else:
                        page_button_list[0].set_active(True)
                    return True


        if ConfigManager.key_event_compare('prev-page-key', event):
            page_button_list = self.buttonbox.get_children()[1:]

            for i in range(len(page_button_list)):
                if page_button_list[i].get_active():
                    if i > 0:
                        page_button_list[i-1].set_active(True)
                    else:
                        page_button_list[-1].set_active(True)
                    return True

        if ConfigManager.key_event_compare('move-page-left', event):
            i = 0
            for button in self.buttonbox:
                if button != self.radio_group_leader and button.get_active():
                    if (i - 1) > 0:
                        self.notebook.reorder_child(self.notebook.get_nth_page(i - 1), i - 2)
                        self.buttonbox.reorder_child(button, i - 1)
                        return True
                    else:
                        return False
                i += 1

        if ConfigManager.key_event_compare('move-page-right', event):
            i = 0
            for button in self.buttonbox:
                if button != self.radio_group_leader and button.get_active():
                    if (i + 1) < len(self.buttonbox):
                        self.notebook.reorder_child(self.notebook.get_nth_page(i - 1), i)
                        self.buttonbox.reorder_child(button, i + 1)
                        return True
                    else:
                        return False
                i += 1