def make_tab(self, view): """Makes a new Tab entity relating to the given view. Args: view (sublime.View): Sublime View to build the Tab from Returns (Tab): Tab entity containing metadata about the view. """ name = view.file_name() is_file = True #If the name is not set, then we're dealing with a buffer #rather than a file, so deal with it accordingly. if name is None: is_file = False name = view.name() #set the view name to untitled if we get an empty name if len(name) == 0: name = "untitled" entity = tab.Tab(name, is_file) if self.window.get_view_index( self.window.active_view()) == self.window.get_view_index(view): entity.add_caption("Current File") if view.file_name() is None: entity.add_caption("Unsaved File") elif view.is_dirty(): entity.add_caption("Unsaved Changes") if view.is_read_only(): entity.add_caption("Read Only") return entity
def __init__(self, parse, args): self._parse = parse self._args = args self._tab = tab.Tab(args) self._lines = self._toLines(parse.rows()) self._lead = parse.lead() if self._lead.isspace(): self._indentationCharacters = self._tab.countChars(self._lead) else: self._indentationCharacters = self._tab.countChars(self._lead + '\t') mustAddNewLine = self._args.alwaysNewLineForFirstParameter if self._indentationCharacters + self._longestLine( ) > args.optimizeForMaximumLineLength: mustAddNewLine = True self._indentationCharacters = args.optimizeForMaximumLineLength - self._tab.roundUp( self._longestLine) if self._indentationCharacters < self._minimumIndentation(): self._indentationCharacters = self._minimumIndentation() if mustAddNewLine: self._lead + '\n' + self._indentation() else: assert self._indentationCharacters > self._tab.countChars( self._lead) self._lead += ' ' * (self._indentationCharacters - self._tab.countChars(self._lead))
def _parse(self, response): windows = [] for w in response.windows: tabs = [] for t in w.tabs: sessions = [] for s in t.sessions: sessions.append(session.Session(s.uniqueIdentifier)) tabs.append(tab.Tab(t.tab_id, sessions)) windows.append(window.Window(w.window_id, tabs)) self.windows = windows
def load_profile_from_file(profile): file = globvar.path + "/" + profile + ".json" try: with open(file, 'r') as f: input_json = json.loads(f.read()) tab.titles = [] for t in input_json: atab = tab.Tab(t['name']) atab.grep = t['grep'] tab.titles.append(atab) except FileNotFoundError: return
def open_file(self): """opens a file in a new tab""" dialog = QtGui.QFileDialog(self.ui) dialog.setFileMode(QtGui.QFileDialog.ExistingFiles) dialog.setNameFilter('HDF5 (*.hdf5)') if dialog.exec_(): filenames = dialog.selectedFiles() for filename in filenames: if filename: basename = analysis.get_file_basename(filename) newtab = tab.Tab(filename) newtab.setWindowTitle('%s' % basename) self.ui.tabWidget.addTab(newtab, '%s' % basename) else: print 'No file selected'
def __init__(self, window, starturi='about:newtab', uifont=None): ntab = tab.Tab(starturi) ntab.set_avail_space((1136, 600)) self.tabs = [ntab] self.activetab = 0 self.window = window self.uifont = uifont or pygame.font.Font(None, 13) window.fill((0, 0, 0)) window.blit( logo_gen.gen_logo(256), (window.get_width() // 2 - 128, window.get_height() // 2 - 128)) pygame.display.update()
def on_enter(self): """Create the Theater""" # The theater is the Sypral Group responsible for holding the # backdrop, actors, and subtitler. It is held by the Script. self.theater = spyral.sprite.Group(self.theaterCamera) bg = spyral.util.new_surface(geom['screen'].size) bg.fill(colors['bg']) self.screenCamera.set_background(bg) self.script = script.Script() self.script.setTheater(self.theater) self.script.setRecorder(self.recorder) self.script.default() self.gui = gui.App(theme=pgu['theme']) self.guiContainer = gui.Container(align=-1, valign=-1) if geom['frame'] != geom['screen']: images['main-background'] = spyral.util.load_image( images['main-background']) croppedFrame = spyral.util.new_surface(geom['screen'].size) croppedFrame.blit(images['main-background'], geom['frame'], area=geom['screen']) images['main-background'] = croppedFrame self.guiContainer.add(gui.Image(images['main-background']), *geom['screen'].topleft) self.guiContainer.add(gui.Image(images['main-tab']), *geom['tab'].topleft) # Tab is used to switch between the different panels self.tab = tab.Tab(self.script) # Add the tab and panel holder to the screen self.guiContainer.add(self.tab, *geom['tab'].topleft) self.guiContainer.add(self.tab.panelHolder, *geom['panel'].topleft) self.script.gui = self.gui self.gui.init(self.guiContainer)
def __init__(self, input, args): self._input = input self._args = args self._tab = tab.Tab(args) self._parse = parsesimplecall.ParseSimpleCall(input)
def __init__(self, input, args): self._input = input self._args = args self._tab = tab.Tab(args) self._parse = parsecppfunctionsignature.ParseCPPFunctionSignature( input)
def _parse(self, response): self.status = response.status if self.status == api_pb2.CreateTabResponse.OK: s = session.Session(response.session_id) t = tab.Tab(response.tab_id, [ s ]) self.window = Window(response.window_id, [ t ])