elif tab_type == 'new_file': # a new tab self.new_empty_tab += 1 while True: try: self.code_manager.get_screen(filename) self.code_manager.current = filename except ScreenManagerException: # then it is not added filename = 'Untitled-{}'.format(self.new_empty_tab) self.add_widget(FullCodeInput(filename=filename), tab_type=tab_type) return self.new_empty_tab += 1 elif tab_type == 'welcome': try: self.code_manager.get_screen('kivystudiowelcome') self.code_manager.current = filename except ScreenManagerException: # then it is not added self.add_widget(WelcomeTab(), tab_type=tab_type) class CodeTabsContainer(ScrollView): '''horizontal scrollview where the small tab buttons lay''' def on_touch_down(self, touch): FocusBehavior.ignored_touch.append(touch) return super(CodeTabsContainer, self).on_touch_down(touch) load_kv(__file__, 'code.kv')
from kivy.uix.behaviors import ButtonBehavior, ToggleButtonBehavior, FocusBehavior from kivy.uix.boxlayout import BoxLayout from kivy.lang import Builder from kivystudio.behaviors import HoverBehavior from kivystudio.widgets.dropdown import DropDownBase from kivystudio import tools tools.load_kv(__file__, 'dropmenu.kv') class MenuButton(HoverBehavior, ButtonBehavior, BoxLayout): pass class ToggleMenuButton(HoverBehavior, ToggleButtonBehavior, BoxLayout): pass class FileTopMenu(DropDownBase): def __init__(self, **k): super(FileTopMenu, self).__init__(**k) def new_file(self): tools.quicktools.open_new_file() def open_file(self): tools.quicktools.open_file() def open_folder(self): tools.quicktools.open_file()
entry point for the Application ''' import sys, os sys.path = [os.pardir] + sys.path # from kivy.config import Config # Config.set('modules', 'monitor', '') from kivy.app import App from os.path import dirname, join from kivy.lang import Builder from kivystudio import tools filepath = dirname(__file__) tools.load_kv(__file__, 'main.kv') # registering custom icons tools.iconfonts.register('awesome_font', join(filepath, 'resources/font-awesome.ttf'), join(filepath, 'resources/font-awesome.fontd')) from kivystudio.assembler import Assembler class KivyStudio(App): def build(self): return Assembler def run(self): super(KivyStudio, self).run()