Test Failed
Push — master ( b264b0...0ab505 )
by Yoshihiro
03:23
created

NovelEditor.HelpMenu.HelpMenuClass.help()   A

Complexity

Conditions 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 8
rs 10
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
    def __init__(self, app, locale_var, master=None):
20
        super().__init__(locale_var, master)
21
        self.app = app
22
23
    def version(self):
24
        """バージョン情報を表示.
25
26
        ・バージョン情報表示ダイアログを表示する。
27
        ×を押すまで消えないようにする。
28
        """
29
        img = tk.PhotoImage(data=self.TITLE_BINARY)
30
        window = tk.Toplevel(self.app)
31
        canvas = tk.Canvas(window, width=600, height=300)
32
        canvas.create_image(0, 0, anchor='nw', image=img)
33
        canvas.create_text(
34
            550,
35
            290,
36
            anchor='se',
37
            text='Copyright (C) 2019-2020 Yamahara Yoshihiro',
38
            font=('', 12)
39
        )
40
        canvas.create_text(
41
            420,
42
            120,
43
            anchor='nw',
44
            text=self.VERSION,
45
            font=('', 12)
46
        )
47
        canvas.pack()
48
        window.title(self.dic.get_dict("Novel Editor"))
49
        window.resizable(width=0, height=0)
50
        window.mainloop()
51
52
    def help(self):
53
        """helpページを開く.
54
55
        ・ウエブブラウザを使ってREADME.htmlを表示する。
56
        """
57
        webbrowser.open(
58
            'file://' + os.path.abspath(os.getcwd())
59
            + "/README.html"
60
        )
61