Exemplo n.º 1
0
 def update_list(self):
     try:
         self.list.set(Registry.all())
         self.enable()
         self.set_default_button(self.install_button)
     except Registry.ConnectionError:
         self.disable("Couldn't connect to the registry server...")
Exemplo n.º 2
0
 def update_list(self):
     try:
         self.list.set(Registry.all())
         self.enable()
         self.set_default_button(self.install_button)
     except Registry.ConnectionError:
         self.disable("Couldn't connect to the registry server...")
Exemplo n.º 3
0
 def register(self, sender):
     self.progress = self.start_progress('Sending to registry server...')
     try:
         registry = Registry(env.default_registry)
         response = registry.add(name=self.name.get(),
                                 filename=self.filename.get(),
                                 repository=self.repository.get())
         self.progress.close()
         response.raise_for_status()
         self.show_notification_sheet('%s was added.' % self.name.get())
         self.clear()
     except requests.exceptions.HTTPError as e:
         errors = response.json()['error']
         if isinstance(errors, basestring): errors = [errors]
         errors = map(lambda e: '%s.' % e.capitalize(), errors)
         self.show_notification_sheet('\n'.join(errors), size=(300,len(errors)*22 + 60))
     except requests.exceptions.ConnectionError:
         self.progress.close()
         self.show_connection_error_sheet()
Exemplo n.º 4
0
 def register(self, sender):
     self.progress = self.start_progress('Sending to registry server...')
     try:
         registry = Registry(env.default_registry)
         response = registry.add(name=self.name.get(),
                                 filename=self.filename.get(),
                                 repository=self.repository.get())
         self.progress.close()
         response.raise_for_status()
         self.show_notification_sheet('%s was added.' % self.name.get())
         self.clear()
     except requests.exceptions.HTTPError as e:
         errors = response.json()['error']
         if isinstance(errors, basestring): errors = [errors]
         errors = map(lambda e: '%s.' % e.capitalize(), errors)
         self.show_notification_sheet('\n'.join(errors),
                                      size=(300, len(errors) * 22 + 60))
     except requests.exceptions.ConnectionError:
         self.progress.close()
         self.show_connection_error_sheet()
Exemplo n.º 5
0
from mechanic.registry import Registry
from mechanic.ui.windows.main import MechanicWindow
from mechanic.ui.windows.notification import UpdateNotificationWindow

window = MechanicWindow().open('install')
tab = window.current_tab.view
table = tab.list

table.set(Registry('http://www.robofontmechanic.com').extensions())
tab.enable()


def dummy_updates(self, *args, **kwargs):
    return ['updates']


UpdateNotificationWindow.get_updates = dummy_updates
UpdateNotificationWindow()