Test Failed
Push — master ( 705b0f...728f1f )
by Yoshihiro
03:24
created

neditor.hm.HelpMenuClass.version()   A

Complexity

Conditions 1

Size

Total Lines 27
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 20
nop 1
dl 0
loc 27
rs 9.4
c 0
b 0
f 0
1
#!/usr/bin/env python3
2
import os
3
import webbrowser
4
import tkinter as tk
5
6
7
class HelpMenuClass():
8
    """ヘルプメニューバーのクラス.
9
10
    ・ヘルプメニューバーにあるプログラム群
11
12
    Args:
13
        app (instance): MainProcessingClass のインスタンス
14
        title_binary (str): タイトルイメージファイルのbase 64データ
15
        version (str): バージョン情報
16
    """
17
    def __init__(self, app, title_binary, version):
18
        # バージョン情報
19
        self.VERSION = version
20
        self.APP = app
21
        self.TITLE_BINARY = title_binary
22
23
    def version(self):
24
        """バージョン情報を表示.
25
26
        ・バージョン情報表示ダイアログを表示する。
27
        ×を押すまで消えないようにする。
28
        """
29
        img2 = 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=img2)
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.resizable(width=0, height=0)
49
        window.mainloop()
50
51
    def help(self):
52
        """helpページを開く.
53
54
        ・ウエブブラウザを使ってREADME.htmlを表示する。
55
        """
56
        webbrowser.open(
57
            'file://' + os.path.dirname(
58
                os.path.abspath(os.path.dirname(__file__))
59
            )
60
            + "/README.html"
61
        )
62