Ejemplo n.º 1
0
def show_view_popup(view, content, *args, **kwargs):
  if view == None:
    return

  try:
    styled_popup.show_popup(view, content, *args, **kwargs)
  except:
    view.show_popup(content, *args, **kwargs)
	def get_comment(self, word, lang):
		function = self.word
		command_text = 'php "' + packages_path + os.sep + 'index.php" "Doc/find/function/' + function + '/lang/' + lang + '"'
		print(command_text)
		cloums = os.popen(command_text)
		data = cloums.read()
		if data:
			self.window = self.view.window()
			tmp = sublime.decode_value(data).replace('\\n', '<br>')
			print(tmp)
			styled_popup.show_popup(self.view, tmp)
		else:
			sublime.status_message('not found')
 def get_comment(self, word, lang):
     function = self.word
     command_text = 'php "' + packages_path + os.sep + 'index.php" "Doc/find/function/' + function + '/lang/' + lang + '"'
     print(command_text)
     cloums = os.popen(command_text)
     data = cloums.read()
     if data:
         self.window = self.view.window()
         tmp = sublime.decode_value(data).replace('\\n', '<br>')
         print(tmp)
         styled_popup.show_popup(self.view,
                                 tmp,
                                 on_navigate=self.nav,
                                 max_width=700)
     else:
         sublime.status_message('not found')
Ejemplo n.º 4
0
	def on_hide(self):
		if QOutPopupBaseCommand.TO_CLOSE:
			try:
				print('reopen')
				rowcol = self.current_rowcol()
				self.to_rowcol(self.rowcol)
				styled_popup.show_popup(self.view, self.html, on_hide=self.on_hide, on_navigate=self.on_navigate)
				self.to_rowcol(rowcol)
			except Exception as e:
				#will get exception when popup moves out of view, just close the pop up
				#not sure how to check that because self.view.sel() always return same object
				print(e)
				QOutPopupBaseCommand.TO_CLOSE = False
				QOutPopupBaseCommand.ACTUALLY_CLOSED = True
				self.view.hide_popup()
		else:
			QOutPopupBaseCommand.ACTUALLY_CLOSED = True
Ejemplo n.º 5
0
	def do(self, edit=None, input=None):
		#print(input)
		template = '<a href="close" style="display:inline;color:green;">x</a> {0}'
		self.html = template.format(input)

		if QOutPopupBaseCommand.ACTUALLY_CLOSED:
			current = self.current_rowcol()
			self.rowcol = self.current_rowcol()
			self.rowcol = [max(0, self.rowcol[0] - 2), self.rowcol[1] + 10]
			self.to_rowcol(self.rowcol)
			styled_popup.show_popup(self.view, self.html,on_hide=self.on_hide, on_navigate=self.on_navigate)
			self.to_rowcol(current)
			QOutPopupBaseCommand.TO_CLOSE = True
			QOutPopupBaseCommand.ACTUALLY_CLOSED = False
		else:
			print('close old popup first')
			QOutPopupBaseCommand.TO_CLOSE = False
			self.view.hide_popup()
			#wait until previous popup close and then open again
			#press same shortcut to hide popup
			#sublime.set_timeout(lambda x=input:self.do(input=x), 100)
		return ''	#return something so that the q_chain can continue
Ejemplo n.º 6
0
 def render_popup(self, trs_info):
     html = """<span class="keyword">{t.word}</span> <span class="storage type">{t.phonetic}</span><br><br><span class="string quoted">{t.trans}</span><br>""".format(
         t=trs_info)
     styled_popup.show_popup(self.window.active_view(), html)
 def render_popup(self, trs_info):
     html = """<span class="keyword">{t.word}</span> <span class="storage type">{t.phonetic}</span><br><br><span class="string quoted">{t.trans}</span><br>""".format(t=trs_info)
     styled_popup.show_popup(self.window.active_view(), html)