NovelEditor.HelpMenu.HelpMenuClass.version()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 22
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 22
rs 9.6
c 0
b 0
f 0
cc 1
nop 1
1
#!/usr/bin/env python3
2
import os
3
import webbrowser
4
import tkinter as tk
5
6
from . import Definition
7
8
9
class HelpMenuClass(Definition.DefinitionClass):
10
    """ヘルプメニューバーのクラス.
11
12
    ・ヘルプメニューバーにあるプログラム群
13
14
    Args:
15
        app (instance): MainProcessingClass のインスタンス
16
        locale_var (str): ロケーション
17
        master (instance): toplevel のインスタンス
18
    """
19
20
    def __init__(self, app, locale_var, master=None):
21
        super().__init__(locale_var, master)
22
        self.app = app
23
24
    def version(self):
25
        """バージョン情報を表示.
26
27
        ・バージョン情報表示ダイアログを表示する。
28
        ×を押すまで消えないようにする。
29
        """
30
        img = tk.PhotoImage(data=self.TITLE_BINARY)
31
        window = tk.Toplevel(self.app)
32
        canvas = tk.Canvas(window, width=600, height=300)
33
        canvas.create_image(0, 0, anchor="nw", image=img)
34
        canvas.create_text(
35
            550,
36
            290,
37
            anchor="se",
38
            text="Copyright (C) 2019-2020 Yamahara Yoshihiro",
39
            font=("", 12),
40
        )
41
        canvas.create_text(420, 120, anchor="nw", text=self.VERSION, font=("", 12))
42
        canvas.pack()
43
        window.title(self.dic.get_dict("Novel Editor"))
44
        window.resizable(width=0, height=0)
45
        window.mainloop()
46
47
    def help(self):
48
        """helpページを開く.
49
50
        ・ウエブブラウザを使ってREADME.htmlを表示する。
51
        """
52
        webbrowser.open("file://" + os.path.abspath(os.getcwd()) + "/README.html")
53