Example #1
0
 def __init__(self, parent):
     Tkinter.Frame.__init__(self, parent)
     self.parent = parent
     self.icon = None
     self.icon_connected = open_photoimage(resource_path('resources', 'icon_connect_established.png'), self.winfo_rgb(COLOR_STATUS))
     self.icon_connecting = open_photoimage(resource_path('resources', 'icon_connect_creating.png'), self.winfo_rgb(COLOR_STATUS))
     self.icon_disconnected = open_photoimage(resource_path('resources', 'icon_connect_no.png'), self.winfo_rgb(COLOR_STATUS))
     self.icon_error = open_photoimage(resource_path('resources', 'icon_warning.png'), self.winfo_rgb(COLOR_STATUS))
     self.message = Tkinter.StringVar(value='')
     self.initialize()
     self.set_disconnected()
Example #2
0
    def initialize(self):
        self.config(background=COLOR_BG)
        row = 0

        # title image
        self.sidebar = open_photoimage(resource_path('resources', 'sidebar.png'), self.winfo_rgb(COLOR_BG))
        Tkinter.Label(self, image=self.sidebar, background=COLOR_BG, padx=0, pady=0, borderwidth=0)\
            .grid(row=row, column=0, rowspan=4, sticky='nw')

        # title text
        Tkinter.Label(self, text='%s v%s' % (TITLE, VERSION), background=COLOR_BG, font=FONT_TITLE, anchor='w', padx=5)\
            .grid(row=row, column=1, pady=(3,0), sticky='nwe')

        # description
        row += 1
        description = _('Use this application in order to allow access on your desktop.')
        self.description = Tkinter.Label(self, text=description, background=COLOR_BG, font=FONT_SMALL, anchor='w', padx=5, justify=Tkinter.LEFT)
        self.description.grid(row=row, column=1, sticky='nwe')
        self.description.bind('<Configure>', self.on_resize_description)

        # form fields
        row += 1
        self.connection = AppFrameForm(self)
        self.connection.address.bind('<Return>', self.on_key_enter)
        self.connection.port.bind('<Return>', self.on_key_enter)
        self.connection.grid(row=row, column=1, sticky='we', pady=10, padx=5)

        # logo image
        row += 1
        logo = resource_path('resources', 'logo.png')
        if os.path.isfile(logo):
            self.logo = open_photoimage(logo, self.winfo_rgb(COLOR_BG))
            Tkinter.Label(self, image=self.logo, background=COLOR_BG, padx=0, pady=0, borderwidth=0)\
                .grid(row=row, column=1, sticky='nw')

        # some space for separation with dynamic height, if no logo is present
        else:
            Tkinter.Label(self, background=COLOR_BG).grid(row=row, column=1)

        # form buttons
        row += 1
        self.buttons = AppFrameButtons(self)
        self.buttons.grid(row=row, column=0, columnspan=2, sticky='we')

        # status bar
        row += 1
        self.status = AppFrameStatus(self)
        self.status.grid(row=row, column=0, columnspan=2, sticky='we')
        self.status.set_message(_('Welcome to remote maintenance.'))

        # layout grid
        self.grid_columnconfigure(index=1, weight=1)
        self.grid_rowconfigure(index=3, weight=1)
Example #3
0
    def initialize(self):
        self.title(_('Extended Settings'))
        self.config(background=COLOR_BG, padx=0, pady=0)

        self.sidebar = open_photoimage(resource_path('resources', 'sidebar_settings.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, rowspan=11, sticky='nw')

        # settings form
        self.form = SettingsDialogForm(self)
        self.form.grid(row=0, column=1, padx=5, pady=5, sticky='nwe')

        # growing separator
        Tkinter.Label(self, font=FONT_SMALL, background=COLOR_BG)\
            .grid(row=1, column=1, sticky='we')

        # buttons
        buttons = Tkinter.Frame(self, background=COLOR_BG)
        Tkinter.Button(buttons, text=_('Submit'), command=self.on_click_submit, background=COLOR_BG, font=FONT_BUTTON)\
            .grid(row=0, column=1, padx=5, pady=5)
        Tkinter.Button(buttons, text=_('Cancel'), command=self.on_click_cancel, background=COLOR_BG, font=FONT_BUTTON)\
            .grid(row=0, column=2, padx=5, pady=5)
        buttons.grid(row=2, column=1, columnspan=2, sticky='e')

        # layout grid
        self.grid_columnconfigure(index=0, weight=0)
        self.grid_columnconfigure(index=1, weight=1)
        self.grid_rowconfigure(index=1, weight=1)

        # close dialog with ESC
        self.bind('<Escape>', lambda e: self.destroy())

        # Fokus auf dem Textfeld anfordern
        self.form.focus_set()
Example #4
0
    def initialize(self):

        self.title(TITLE)
        self.config(background=COLOR_BG)

        # HACK: set application icon
        # see http://stackoverflow.com/a/11180300
        icon = open_photoimage(resource_path('resources', 'icon.png'))
        self.tk.call('wm', 'iconphoto', self._w, icon)

        # create application frame
        self.frame = AppFrame(self)
        self.frame.pack(fill=Tkinter.BOTH, expand=1)

        # Specific modifications for Mac OS X systems
        if OS_DARWIN:

            # Add an empty main menu.
            menu = Tkinter.Menu(self)
            try:
                self.config(menu=menu)
            except AttributeError:
                # master is a toplevel window (Python 1.4/Tkinter 1.63)
                self.tk.call(self, 'config', '-menu', menu)

            # Register about dialog.
            self.createcommand('tkAboutDialog', self.show_about_dialog)

        # event on window close
        self.protocol('WM_DELETE_WINDOW', self.shutdown)

        # close window with ESC
        #self.bind('<Escape>', lambda e: self.on_close())

        # set window size
        #self.resizable(False,False)
        #self.resizable(width=False, height=False)
        w = get_configuration_int('gui', 'application-window-width', 500)
        h = get_configuration_int('gui', 'application-window-height', 300)
        self.geometry('%sx%s' % (w, h))
Example #5
0
    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()