| 1 |
|
| 2 |
|
| 3 |
from .abstract_optionsbar import AbstractOptionsBar |
| 4 |
|
| 5 |
class OptionsBarSelection(AbstractOptionsBar): |
| 6 |
__gtype_name__ = 'OptionsBarSelection' |
| 7 |
|
| 8 |
def __init__(self, window): |
| 9 |
super().__init__() |
| 10 |
self.window = window |
| 11 |
builder = self._build_ui('selection/optionsbar-selection.ui') |
| 12 |
|
| 13 |
self.import_box = builder.get_object('import_box') |
| 14 |
self.clipboard_box = builder.get_object('clipboard_box') |
| 15 |
self.actions_btn = builder.get_object('actions_btn') |
| 16 |
self.actions_btn_long = builder.get_object('actions_btn_long') |
| 17 |
self._togglable_btn = self.actions_btn |
| 18 |
|
| 19 |
self.options_long_box = builder.get_object('options_long_box') |
| 20 |
self.options_short_box = builder.get_object('options_short_box') |
| 21 |
|
| 22 |
self.minimap_btn = builder.get_object('minimap_btn') |
| 23 |
self.minimap_label = builder.get_object('minimap_label') |
| 24 |
self.minimap_arrow = builder.get_object('minimap_arrow') |
| 25 |
|
| 26 |
def get_minimap_btn(self): |
| 27 |
return self.minimap_btn |
| 28 |
|
| 29 |
def set_minimap_label(self, label): |
| 30 |
self.minimap_label.set_label(label) |
| 31 |
|
| 32 |
def middle_click_action(self): |
| 33 |
self.window.lookup_action('new_tab_selection').activate() |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
def init_adaptability(self): |
| 38 |
super().init_adaptability() |
| 39 |
temp_limit_size = self.import_box.get_preferred_width()[0] + \ |
| 40 |
self.clipboard_box.get_preferred_width()[0] + \ |
| 41 |
self.actions_btn.get_preferred_width()[0] + \ |
| 42 |
self.options_long_box.get_preferred_width()[0] + \ |
| 43 |
self.help_btn.get_preferred_width()[0] + \ |
| 44 |
self.minimap_btn.get_preferred_width()[0] |
| 45 |
self._set_limit_size(temp_limit_size) |
| 46 |
|
| 47 |
def set_compact(self, state): |
| 48 |
super().set_compact(state) |
| 49 |
self.actions_btn_long.set_visible(state) |
| 50 |
self.import_box.set_visible(not state) |
| 51 |
self.actions_btn.set_visible(not state) |
| 52 |
|
| 53 |
self.options_long_box.set_visible(not state) |
| 54 |
self.options_short_box.set_visible(state) |
| 55 |
if state: |
| 56 |
self._togglable_btn = self.actions_btn_long |
| 57 |
else: |
| 58 |
self._togglable_btn = self.actions_btn |
| 59 |
|
| 60 |
self.minimap_arrow.set_visible(not state) |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|