-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
63 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,27 @@ | ||
import tkinter as tk | ||
from tkinter import ttk | ||
|
||
from .utils.shortcuts import Shortcuts | ||
|
||
class EmptyTab(tk.Frame): | ||
def __init__(self, master, *args, **kwargs): | ||
super().__init__(master, *args, **kwargs) | ||
self.base = master.base | ||
|
||
self.bg = "#FFFFFF" | ||
self.fg = "#787878" | ||
self.config(bg=self.bg) | ||
|
||
self.grid_rowconfigure(0, weight=1) | ||
# self.grid_rowconfigure(1, weight=1) | ||
self.grid_columnconfigure(0, weight=1) | ||
|
||
self.logo_img = self.base.settings.resources.logo.subsample(2) | ||
self.logo = ttk.Label(self, image=self.logo_img, width=10) | ||
self.logo.place(anchor=tk.CENTER, relx=.5, rely=.5) | ||
self.logo = tk.Label(self, image=self.logo_img, bg=self.bg) | ||
self.logo.grid(row=0, column=0) | ||
|
||
self.shortcuts = Shortcuts(self, bg=self.bg) | ||
self.shortcuts.grid(row=1, column=0, pady=(0, 40)) | ||
|
||
# +------------------+ | ||
# | +------+ | | ||
# | [ logo ] | | ||
# | +------+ | | ||
# | [some shortcuts] | | ||
# | | | ||
# +------------------+ | ||
self.shortcuts.add_shortcut("Show all commands", ["Ctrl", "Shift", "P"]) | ||
self.shortcuts.add_shortcut("Toggle terminal", ["Ctrl", "`"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import tkinter as tk | ||
|
||
|
||
class Shortcut(tk.Frame): | ||
def __init__(self, master, shortcuts, sc_bg="#f3f3f3", sc_fg="#767676", *args, **kwargs): | ||
super().__init__(master, *args, **kwargs) | ||
self.shortcuts = shortcuts | ||
self.bg = master.bg | ||
|
||
self.sc_bg = sc_bg | ||
self.sc_fg = sc_fg | ||
|
||
self.add_shortcuts() | ||
|
||
def add_shortcuts(self): | ||
for shortcut in self.shortcuts[:-1]: | ||
self.add_shortcut(shortcut) | ||
self.add_separator() | ||
self.add_shortcut(self.shortcuts[-1]) | ||
|
||
def add_separator(self): | ||
tk.Label(self, text="+", bg=self.bg).pack(padx=2, side=tk.LEFT) | ||
|
||
def add_shortcut(self, shortcut): | ||
tk.Label( | ||
self, text=shortcut, bg=self.sc_bg, fg=self.sc_fg, | ||
font=("Consolas", 12)).pack(padx=2, side=tk.LEFT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import tkinter as tk | ||
from .shortcut import Shortcut | ||
|
||
|
||
class Shortcuts(tk.Frame): | ||
def __init__(self, master, *args, **kwargs): | ||
super().__init__(master, *args, **kwargs) | ||
self.bg = master.bg | ||
self.fg = master.fg | ||
|
||
self.row = 0 | ||
|
||
def add_shortcut(self, name, value): | ||
name = tk.Label(self, text=name, font=("Verdana", 12), anchor=tk.E, fg=self.fg, bg=self.bg) | ||
value = Shortcut(self, shortcuts=value, bg=self.bg) | ||
|
||
name.grid(row=self.row, column=0, sticky=tk.EW, pady=5) | ||
value.grid(row=self.row, column=1, sticky=tk.EW, pady=5) | ||
|
||
self.row += 1 |