Passed
Push — master ( 63399a...705b0f )
by Yoshihiro
02:57
created

NovelEditor.HM.HelpMenuClass.version()   A

Complexity

Conditions 1

Size

Total Lines 27
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 1

Importance

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