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

NovelEditor.HM   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 34
dl 0
loc 61
ccs 20
cts 20
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A HelpMenuClass.__init__() 0 5 1
A HelpMenuClass.help() 0 10 1
A HelpMenuClass.version() 0 27 1
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