GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 428f11...e6133a )
by thatsIch
01:14
created

on_skin_selected()   A

Complexity

Conditions 2

Size

Total Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
dl 0
loc 21
rs 9.3142
c 1
b 0
f 0
1
"""
2
This module is for the feature "Open Skin as Project".
3
4
This feature provides a command which lists all Rainmeter Skins
5
installed in the Rainmeter Skin folder and allows a quick panel
6
to open the skin in a new window.
7
8
This is done by creating a new sublime text instance using subprocesses.
9
"""
10
11
import os
12
import subprocess
13
14
import sublime
15
import sublime_plugin
16
17
from .path.skin_path_provider import get_cached_skin_path
18
19
20
def on_skin_selected(selected_skin_id):
21
    """
22
    This is a callback upon user selecting a skin.
23
24
    This can handle user canceling the input.
25
    Upon selection a respective path is evaluated
26
    and send to a new sublime text instance.
27
    """
28
    if selected_skin_id == -1:
29
        return
30
31
    skins_path = get_cached_skin_path()
32
    skins = os.listdir(skins_path)
33
    selected_skin = skins[selected_skin_id]
34
    selected_skin_path = os.path.join(skins_path, selected_skin)
35
36
    # to open a folder in new window, just create a new process with the folder as argument
37
    st_path = sublime.executable_path()
38
    subprocess.Popen([
39
        st_path,
40
        selected_skin_path
41
    ])
42
43
44
class RainmeterOpenSkinAsProjectCommand(sublime_plugin.ApplicationCommand):
45
    """You can execute this command via the sublime API like sublime.run_command("rainmeter_open_skin_as_project")."""
46
47
    def run(self):
48
        """Automatically called upon calling the command."""
49
        skins_path = get_cached_skin_path()
50
        skins = os.listdir(skins_path)
51
52
        sublime.active_window().show_quick_panel(skins, on_skin_selected, 0, 0, None)
53