Beispiel #1
0
def hide_context(_=None):
    """Hide the properties window, if it's open."""
    global is_open
    if is_open:
        is_open = False
        prop_window.withdraw()
        snd.fx('contract')
Beispiel #2
0
 def show_item_props():
     snd.fx('expand')
     itemPropWin.show_window(
         selected_item.get_properties(),
         wid['changedefaults'],
         selected_sub_item.name,
     )
Beispiel #3
0
def contract(_):
    """Shrink the filter view."""
    global is_expanded
    is_expanded = False
    wid["expand_frame"].grid_remove()
    snd.fx("contract")
    UI.flow_picker()
Beispiel #4
0
def hide_context(_=None):
    """Hide the properties window, if it's open."""
    global is_open
    if is_open:
        is_open = False
        prop_window.withdraw()
        snd.fx('contract')
Beispiel #5
0
 def show_item_props():
     snd.fx('expand')
     itemPropWin.show_window(
         selected_item.get_properties(),
         wid['changedefaults'],
         selected_sub_item.name,
     )
def contract(_):
    """Shrink the filter view."""
    global is_expanded
    is_expanded = False
    wid['expand_frame'].grid_remove()
    snd.fx('contract')
    UI.flow_picker()
Beispiel #7
0
 def hide_win(self, play_snd=True):
     """Hide the window."""
     if play_snd:
         snd.fx('config')
     self.withdraw()
     self.visible = False
     self.save_conf()
     self.tool_button.state(('!pressed', ))
Beispiel #8
0
 def hide_win(self, play_snd=True):
     """Hide the window."""
     if play_snd:
         snd.fx('config')
     self.withdraw()
     self.visible = False
     self.save_conf()
     self.tool_button.state(('!pressed',))
Beispiel #9
0
def hide_context(_=None):
    """Hide the properties window, if it's open."""
    global is_open, selected_item, selected_sub_item
    if is_open:
        is_open = False
        prop_window.withdraw()
        snd.fx('contract')
        selected_item = selected_sub_item = None
Beispiel #10
0
def hide_context(e=None):
    """Hide the properties window, if it's open."""
    global is_open, selected_item, selected_sub_item
    if is_open:
        is_open = False
        prop_window.withdraw()
        snd.fx('contract')
        selected_item = selected_sub_item = None
Beispiel #11
0
 def show_win(self, play_snd=True):
     """Show the window."""
     if play_snd:
         snd.fx('config')
     self.deiconify()
     self.visible = True
     self.save_conf()
     self.tool_button.state(('pressed', ))
     self.follow_main()
Beispiel #12
0
 def show_win(self, play_snd=True):
     """Show the window."""
     if play_snd:
         snd.fx('config')
     self.deiconify()
     self.visible = True
     self.save_conf()
     self.tool_button.state(('pressed',))
     self.follow_main()
Beispiel #13
0
def expand(_):
    """Expand the filter view."""
    global is_expanded
    is_expanded = True
    wid["expand_frame"].grid(row=2, column=0, columnspan=2, sticky="NSEW")
    wid["tag_list"]["height"] = TK_ROOT.winfo_height() / 48

    snd.fx("expand")
    UI.flow_picker()
Beispiel #14
0
def sub_sel(ind, e=None):
    """Change the currently-selected sub-item."""
    # Can only change the subitem on the preview window
    if selected_sub_item.is_pre:
        pos = SUBITEM_POS[selected_item.num_sub][ind]
        if pos != -1 and pos != selected_sub_item.subKey:
            snd.fx('config')
            selected_sub_item.change_subtype(pos)
            # Redisplay the window to refresh data and move it to match
            show_prop(selected_sub_item, warp_cursor=True)
Beispiel #15
0
def sub_sel(ind, _=None):
    """Change the currently-selected sub-item."""
    # Can only change the subitem on the preview window
    if selected_sub_item.is_pre:
        pos = SUBITEM_POS[selected_item.num_sub][ind]
        if pos != -1 and pos != selected_sub_item.subKey:
            snd.fx('config')
            selected_sub_item.change_subtype(pos)
            # Redisplay the window to refresh data and move it to match
            show_prop(selected_sub_item, warp_cursor=True)
Beispiel #16
0
def sfx(sound):
    """Play a sound effect.

    This waits for a certain amount of time between retriggering sounds
    so they don't overlap.
    """
    global play_sound
    if play_sound is True:
        snd.fx(sound)
        play_sound = False
        win.after(75, reset_sfx)
Beispiel #17
0
def sfx(sound):
    """Play a sound effect.

    This waits for a certain amount of time between retriggering sounds
    so they don't overlap.
    """
    global play_sound
    if play_sound is True:
        snd.fx(sound)
        play_sound = False
        win.after(75, reset_sfx)
Beispiel #18
0
def expand(_):
    """Expand the filter view."""
    global is_expanded
    is_expanded = True
    wid['expand_frame'].grid(
        row=2,
        column=0,
        columnspan=2,
        sticky='NSEW',
    )
    wid['tag_list']['height'] = TK_ROOT.winfo_height() / 48

    snd.fx('expand')
    UI.flow_picker()
def expand(_):
    """Expand the filter view."""
    global is_expanded
    is_expanded = True
    wid['expand_frame'].grid(
        row=2,
        column=0,
        columnspan=2,
        sticky='NSEW',
    )
    wid['tag_list']['height'] = TK_ROOT.winfo_height() / 48

    snd.fx('expand')
    UI.flow_picker()
Beispiel #20
0
    def _start(self, slot: 'Slot[ItemT]', event: tkinter.Event) -> None:
        """Start the drag."""
        if slot.contents is None:
            return  # Can't pick up blank...

        self._cur_drag = slot.contents

        show_group = False

        if not slot.is_source:
            slot.contents = None

            # If none of this group are present in the targets and we're
            # pulling from the items, we hold a group icon.
            try:
                group = self._cur_drag.dnd_group
            except AttributeError:
                pass
            else:
                if group is not None:
                    for other_slot in self._targets:
                        if getattr(other_slot.contents, 'dnd_group', None) == group:
                            break
                    else:
                        # None present.
                        show_group = True

        self._display_item(self._drag_lbl, self._cur_drag, show_group)
        self._cur_prev_slot = slot

        sound.fx('config')

        self._drag_win.deiconify()
        self._drag_win.lift(slot._lbl.winfo_toplevel())
        # grab makes this window the only one to receive mouse events, so
        # it is guaranteed that it'll drop when the mouse is released.
        self._drag_win.grab_set_global()
        # NOTE: _global means no other programs can interact, make sure
        # it's released eventually or you won't be able to quit!

        # Call this to reposition it.
        self._evt_move(event)

        self._drag_win.bind(utils.EVENTS['LEFT_MOVE'], self._evt_move)
Beispiel #21
0
    def _evt_stop(self, event: tkinter.Event) -> None:
        """User released the item."""
        if self._cur_drag is None or self._cur_prev_slot is None:
            return

        sound.fx('config')
        self._drag_win.grab_release()
        self._drag_win.withdraw()
        self._drag_win.unbind(utils.EVENTS['LEFT_MOVE'])

        dest = self._pos_slot(event.x_root, event.y_root)

        if dest:
            # We have a target.
            dest.contents = self._cur_drag
        # No target, and we dragged off an existing target - delete.
        elif not self._cur_prev_slot.is_source:
            sound.fx('delete')

        self._cur_drag = None
        self._cur_prev_slot = None
Beispiel #22
0
 def _evt_fastdrag(self, event: tkinter.Event) -> None:
     """Quickly add/remove items by shift-clicking."""
     if self.is_source:
         # Add this item to the first free position.
         item = self.contents
         for slot in self.man._targets:
             if slot.contents is None:
                 slot.contents = item
                 sound.fx('config')
                 return
             elif slot.contents is item:
                 # It's already on the board, don't change anything.
                 sound.fx('config')
                 return
         sound.fx('delete')
     else:
         # Fast-delete this.
         self.contents = None
         sound.fx('delete')
Beispiel #23
0
def open_event(e):
    """Read data from the event, and show the window."""
    snd.fx('expand')
    show_prop(e.widget)
Beispiel #24
0
def open_event(e):
    """Read data from the event, and show the window."""
    snd.fx('expand')
    show_prop(e.widget)
Beispiel #25
0
def sub_open(ind, _=None):
    """Move the context window to apply to the given item."""
    pos = SUBITEM_POS[selected_item.num_sub][ind]
    if pos != -1 and pos != selected_sub_item.subKey:
        snd.fx('expand')
        selected_sub_item.open_menu_at_sub(pos)
Beispiel #26
0
def hide_item_props(vals):
    snd.fx('contract')
    selected_item.set_properties(vals)
Beispiel #27
0
 def func(e):
     snd.fx('expand')
     show_prop(item)
Beispiel #28
0
 def func(e):
     snd.fx('expand')
     show_prop(item)
Beispiel #29
0
def sub_open(ind, e=None):
    """Move the context window to apply to the given item."""
    pos = SUBITEM_POS[selected_item.num_sub][ind]
    if pos != -1 and pos != selected_sub_item.subKey:
        snd.fx('expand')
        selected_sub_item.open_menu_at_sub(pos)
Beispiel #30
0
def hide_item_props(vals):
    snd.fx('contract')
    selected_item.set_properties(vals)