def __init__(self): has_configured_ssh_keyfile = not DEFAULT_SSH_KEYFILE is None configured_vnc_application = get_configuration('settings', 'vnc-application', default='') if configured_vnc_application is None: configured_vnc_application = '' elif len(configured_vnc_application.strip()) < 1: configured_vnc_application = '' self.host = Tkinter.StringVar(value=get_configuration('settings', 'host', default='')) self.port = Tkinter.IntVar(value=get_configuration_int('settings', 'port', default=5500)) self.ssh_enabled = Tkinter.BooleanVar(value=get_configuration_boolean('settings', 'ssh-enabled', default=False)) self.ssh_use_provided_key = Tkinter.BooleanVar(value=not PROVIDED_SSH_KEY is None) self.ssh_user = Tkinter.StringVar(value=get_configuration('settings', 'ssh-user', default='')) self.ssh_password = Tkinter.StringVar(value=get_configuration('settings', 'ssh-password', default='')) self.ssh_keyfile = Tkinter.StringVar(value=DEFAULT_SSH_KEYFILE if has_configured_ssh_keyfile else '') self.ssh_port = Tkinter.IntVar(value=get_configuration_int('settings', 'ssh-port', default=22)) self.vnc_application = Tkinter.StringVar(value=configured_vnc_application) self.vnc_parameters = Tkinter.StringVar(value=get_configuration('settings', 'vnc-parameters', default=''))
def initialize(self): from src import DEFAULT_VNC_APPLICATION from src import DEFAULT_VNC_APPLICATION_LICENSE from src import VERSION_GETTEXT_WINDOWS from src import VERSION_NUMPY from src import VERSION_PARAMIKO from src import VERSION_PILLOW from src import VERSION_PSUTIL from src import VERSION_PYCRYPTO from src import VERSION_PYTHON from src import VERSION_TCL from src import VERSION_TIGHTVNC from src import VERSION_VINESERVER from src import VERSION_X11VNC authors = get_configuration('about', 'authors', None) company_name = get_configuration('about', 'company-name', None) company_website = get_configuration('about', 'company-website', None) is_forked = True if company_name else False self.title(_('About this program')) self.config(background=COLOR_BG) # HACK: Programm-Icon setzen # siehe http://stackoverflow.com/a/11180300 icon = open_photoimage(resource_path('resources', 'icon.png')) self.tk.call('wm', 'iconphoto', self._w, icon) self.sidebar = open_photoimage(resource_path('resources', 'sidebar_about.png'), self.winfo_rgb(COLOR_BG)) Tkinter.Label(self, image=self.sidebar, background=COLOR_BG, padx=0, pady=0, borderwidth=0)\ .grid(row=0, column=0, sticky='nw') vnc_linux = _('{0} for {1}').format('x11vnc %s (GPLv2)' % VERSION_X11VNC, 'Linux') vnc_darwin = _('{0} for {1}').format('VineServer / OSXvnc %s (GPLv2)' % VERSION_VINESERVER, 'Mac OS X') vnc_windows = _('{0} for {1}').format('TightVNC %s (GPLv2) ' % VERSION_TIGHTVNC, 'Windows') text = Tkinter.Text(self, height=20, width=50, background=COLOR_BG, padx=5, highlightthickness=0, relief=Tkinter.FLAT) scroll = Tkinter.Scrollbar(self, command=text.yview) text.configure(yscrollcommand=scroll.set) text.tag_configure('title', font=FONT_TITLE, wrap=Tkinter.WORD) text.tag_configure('subtitle', font=FONT_SUBTITLE, wrap=Tkinter.WORD) text.tag_configure('default', font=FONT_BASE, wrap=Tkinter.WORD) text.tag_configure('small', font=FONT_SMALL, wrap=Tkinter.WORD) text.tag_configure('tiny', font=(FONT_FAMILY, 4), wrap=Tkinter.WORD) #text.tag_configure('color', foreground='#476042', font=('Tempus Sans ITC', 12, 'bold')) #text.tag_bind('follow', '<1>', lambda e, t=text2: t.insert(Tkinter.END, "Not now, maybe later!")) text.insert(Tkinter.END, '%s v%s' % (TITLE, VERSION), 'title') text.insert(Tkinter.END, '\n\n', 'tiny') text.insert(Tkinter.END, _('This application provides access to your desktop for our support staff.'), 'default') text.insert(Tkinter.END, ' ', 'default') text.insert(Tkinter.END, _('We will tell you the required settings in order to build up a connection for remote maintenance.'), 'default') if is_forked: text.insert(Tkinter.END, '\n\n', 'tiny') text.insert(Tkinter.END, _('This software is based on the free and open Remote Support Tool and was modified for {0}.').format(company_name), 'default') text.insert(Tkinter.END, ' ', 'default') text.insert(Tkinter.END, _('Please contact {0} for any questions or problems.').format(company_name), 'default') text.insert(Tkinter.END, '\n\n\n', 'tiny') text.insert(Tkinter.END,_('Authors'), 'subtitle') text.insert(Tkinter.END, '\n\n', 'tiny') text.insert(Tkinter.END, '• Andreas Rudolph & Walter Wagner (OpenIndex.de)', 'default') if authors: text.insert(Tkinter.END, '\n• %s' % authors, 'default') text.insert(Tkinter.END, '\n\n\n', 'tiny') text.insert(Tkinter.END, _('Translators'), 'subtitle') text.insert(Tkinter.END, '\n\n', 'tiny') text.insert(Tkinter.END, _('There are currently no translations available besides the default languages (English and German).'), 'default') text.insert(Tkinter.END, '\n\n\n', 'tiny') text.insert(Tkinter.END, _('Internal components'), 'subtitle') text.insert(Tkinter.END, '\n\n', 'tiny') text.insert(Tkinter.END, _('The following third party components were integrated:'), 'default') text.insert(Tkinter.END, '\n\n', 'tiny') text.insert(Tkinter.END, '• Python %s (PSFL)\n' % VERSION_PYTHON, 'default') text.insert(Tkinter.END, '• Tcl/Tk %s (BSD)\n' % VERSION_TCL, 'default') text.insert(Tkinter.END, '• PyCrypto %s (Public Domain)\n' % VERSION_PYCRYPTO, 'default') text.insert(Tkinter.END, '• Paramiko %s (LGPL)\n' % VERSION_PARAMIKO, 'default') text.insert(Tkinter.END, '• Pillow %s (PIL)\n' % VERSION_PILLOW, 'default') text.insert(Tkinter.END, '• psutil %s (BSD)\n' % VERSION_PSUTIL, 'default') if not VERSION_NUMPY is None: text.insert(Tkinter.END, '• NumPy %s (BSD)\n' % VERSION_NUMPY, 'default') text.insert(Tkinter.END, '• gettext-py-windows %s (MIT)\n' % VERSION_GETTEXT_WINDOWS, 'default') text.insert(Tkinter.END, '• Crystal Clear Icons (LGPL)\n', 'default') text.insert(Tkinter.END, '\n\n', 'tiny') if DEFAULT_VNC_APPLICATION: vnc_app = '%s (%s)' % (VNC_NAME, DEFAULT_VNC_APPLICATION_LICENSE) text.insert(Tkinter.END, _('Embedded VNC application'), 'subtitle') text.insert(Tkinter.END, '\n\n', 'tiny') text.insert(Tkinter.END, _('The software {0} was embedded into this application in order to access your {1} system via VNC.').format(vnc_app, OS_NAME), 'default') text.insert(Tkinter.END, '\n\n', 'tiny') text.insert(Tkinter.END, _('Created with'), 'subtitle') text.insert(Tkinter.END, '\n\n', 'tiny') text.insert(Tkinter.END, _('The application was created with:'), 'default') text.insert(Tkinter.END, '\n\n', 'tiny') text.insert(Tkinter.END, '• PyCharm Community Edition\n', 'default') text.insert(Tkinter.END, '• PyInstaller\n', 'default') text.insert(Tkinter.END, '\n\n', 'tiny') text.insert(Tkinter.END, _('License'), 'subtitle') text.insert(Tkinter.END, '\n\n', 'tiny') with open(resource_path('resources', 'LICENSE.txt'), 'r') as myfile: txt = myfile.read()\ .replace('\n\n', '$$')\ .replace('\n', '')\ .replace('$$', '\n\n') text.insert(Tkinter.END, txt, 'default') text.insert(Tkinter.END, '\n', 'small') #text.insert(Tkinter.END, 'follow-up\n', 'follow') #text.pack(side=Tkinter.LEFT, expand=True) text.grid(row=0, column=1, rowspan=4, pady=(3,0), sticky='nwes') text.config(state=Tkinter.DISABLED) scroll.grid(row=0, column=2, rowspan=4, sticky='nes') button_row = 0 if company_name and company_website: button_row += 1 Tkinter.Button(self, text=company_name, command=self.on_click_company, background=COLOR_BG, font=FONT_BUTTON)\ .grid(row=button_row, column=0, padx=6, pady=3, sticky='ews') button_row += 1 Tkinter.Button(self, text=_('Project at GitHub'), command=self.on_click_github, background=COLOR_BG, font=FONT_BUTTON)\ .grid(row=button_row, column=0, padx=6, pady=3, sticky='ews') button_row += 1 Tkinter.Button(self, text=_('Close'), command=self.on_click_close, background=COLOR_BG, font=FONT_BUTTON)\ .grid(row=button_row, column=0, padx=6, pady=3, sticky='ews') self.grid_columnconfigure(index=0, weight=0) self.grid_columnconfigure(index=1, weight=1) self.grid_columnconfigure(index=2, weight=0) self.grid_rowconfigure(index=0, weight=1) self.grid_rowconfigure(index=1, weight=0) self.grid_rowconfigure(index=2, weight=0) self.grid_rowconfigure(index=3, weight=0) # close dialog with ESC self.bind('<Escape>', lambda e: self.destroy()) # Fokus auf dem Textfeld anfordern text.focus_set()
def on_click_company(self): company_website = get_configuration('about', 'company-website', None) if company_website: webbrowser.open_new_tab(company_website)