parameters: (self, lang_str, open_with_file, node_name, boss, is_startup, is_arg, export_mode)
docstring: GUI Startup
docstring_summary: GUI Startup
docstring_tokens: GUI Startup
function: def __init__(self, lang_str, open_with_file, node_name, boss, is_startup, is_arg, export_mode):
          """GUI Startup"""
  
          self.boss = boss
          self.filetype = ""
          self.user_active = True
          self.ctrl_down = False
          self.dead_key = ""
          self.window = gtk.Window()
          self.window.set_title("CherryTree")
          self.window.set_default_size(963, 630)
          self.window.set_icon_from_file(os.path.join(cons.GLADE_PATH, "cherrytree.png"))
          # instantiate external handlers
          self.clipboard_handler = clipboard.ClipboardHandler(self)
          self.lists_handler = lists.ListsHandler(self)
          self.tables_handler = tablez.TablesHandler(self)
          self.codeboxes_handler = codeboxes.CodeBoxesHandler(self)
          self.state_machine = machines.StateMachine(self)
          self.xml_handler = machines.XMLHandler(self)
          self.html_handler = exports.Export2Html(self)
          self.ctdb_handler = ctdb.CTDBHandler(self)
          self.print_handler = printing.PrintHandler(self)
          # icon factory
          factory = gtk.IconFactory()
          for stock_name in cons.STOCKS_N_FILES:
              filename = stock_name + ".png"
              filepath = os.path.join(cons.GLADE_PATH, filename)
              pixbuf = gtk.gdk.pixbuf_new_from_file(filepath)
              iconset = gtk.IconSet(pixbuf)
              factory.add(stock_name, iconset)
          factory.add_default()
          # system settings
          try:
              gtk_settings = gtk.settings_get_default()
              gtk_settings.set_property("gtk-button-images", True)
              gtk_settings.set_property("gtk-menu-images", True)
          except: pass # older gtk do not have the property "gtk-menu-images"
          vbox_main = gtk.VBox()
          self.window.add(vbox_main)
          self.country_lang = lang_str
          self.cursor_position = 0
          config.config_file_load(self)
          if not cons.HAS_APPINDICATOR: self.use_appind = False
          elif not cons.HAS_SYSTRAY: self.use_appind = True
          # ui manager
          actions = gtk.ActionGroup("Actions")
          actions.add_actions(menus.get_entries(self))
          self.ui = gtk.UIManager()
          self.ui.insert_action_group(actions, 0)
          self.window.add_accel_group(self.ui.get_accel_group())
          self.ui.add_ui_from_string(menus.UI_INFO)
          self.ui.add_ui_from_string(config.get_toolbar_ui_str(self))
          # menubar add
          vbox_main.pack_start(self.ui.get_widget("/MenuBar"), False, False)
          # toolbar add
          vbox_main.pack_start(self.ui.get_widget("/ToolBar"), False, False)
          # hpaned add
          self.hpaned = gtk.HPaned()
          self.scrolledwindow_tree = gtk.ScrolledWindow()
          self.scrolledwindow_tree.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
          self.scrolledwindow_text = gtk.ScrolledWindow()
          self.scrolledwindow_text.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
          self.scrolledwindow_text.get_hscrollbar().connect('value-changed', self.on_hscrollbar_text_value_changed)
          self.vbox_text = gtk.VBox()
          self.header_node_name_eventbox = self.instantiate_node_name_header()
          self.vbox_text.pack_start(self.header_node_name_eventbox, False, False)
          self.vbox_text.pack_start(self.scrolledwindow_text)
          if self.tree_right_side:
              self.hpaned.add1(self.vbox_text)
              self.hpaned.add2(self.scrolledwindow_tree)
          else:
              self.hpaned.add1(self.scrolledwindow_tree)
              self.hpaned.add2(self.vbox_text)
          vbox_main.pack_start(self.hpaned)
          # statusbar add
          self.statusbar = gtk.Statusbar()
          self.statusbar_context_id = self.statusbar.get_context_id('')
          self.latest_statusbar_update_time = {}
          self.progressbar = gtk.ProgressBar()
          progress_frame = gtk.Frame()
          progress_frame.set_shadow_type(gtk.SHADOW_NONE)
          progress_frame.set_border_width(1)
          progress_frame.add(self.progressbar)
          self.progresstop = gtk.Button()
          self.progresstop.set_image(gtk.image_new_from_stock("gtk-stop", gtk.ICON_SIZE_MENU))
          self.progresstop.connect('clicked', self.on_button_progresstop_clicked)
          hbox_statusbar = gtk.HBox()
          hbox_statusbar.pack_start(self.statusbar, True, True)
          hbox_statusbar.pack_start(progress_frame, False, True)
          hbox_statusbar.pack_start(self.progresstop, False, True)
          vbox_main.pack_start(hbox_statusbar, False, False)
          # ROW: 0-icon_stock_id, 1-name, 2-buffer, 3-unique_id, 4-syntax_highlighting, 5-node_sequence, 6-tags, 7-readonly, 8-aux_icon_stock_id, 9-custom_icon_id, 10-weight, 11-foreground, 12-ts_creation, 13-ts_lastsave
          self.treestore = gtk.TreeStore(str, str, gobject.TYPE_PYOBJECT, long, str, int, str, gobject.TYPE_BOOLEAN, str, int, int, str, float, float)
          self.treeview = gtk.TreeView(self.treestore)
          self.treeview.set_headers_visible(False)
          self.treeview.drag_source_set(gtk.gdk.BUTTON1_MASK,
                                        [('CT_DND', gtk.TARGET_SAME_WIDGET, 0)],
                                        gtk.gdk.ACTION_MOVE)
          self.treeview.drag_dest_set(gtk.DEST_DEFAULT_ALL,
                                      [('CT_DND', gtk.TARGET_SAME_WIDGET, 0)],
                                      gtk.gdk.ACTION_MOVE)
          self.renderer_pixbuf = gtk.CellRendererPixbuf()
          self.renderer_text = gtk.CellRendererText()
          self.renderer_text.set_property('wrap-mode', pango.WRAP_WORD_CHAR)
          self.aux_renderer_pixbuf = gtk.CellRendererPixbuf()
          self.column = gtk.TreeViewColumn()
          self.column.pack_start(self.renderer_pixbuf, False)
          self.column.pack_start(self.renderer_text, True)
          self.column.pack_start(self.aux_renderer_pixbuf, False)
          self.column.set_attributes(self.renderer_pixbuf, stock_id=0)
          self.column.set_attributes(self.renderer_text, text=1, weight=10, foreground=11)
          self.column.set_attributes(self.aux_renderer_pixbuf, stock_id=8)
          self.treeview.append_column(self.column)
          self.treeview.set_search_column(1)
          self.treeviewselection = self.treeview.get_selection()
          self.treeview.connect('cursor-changed', self.on_node_changed)
          self.treeview.connect('event-after', self.on_event_after_tree)
          self.treeview.connect('row-activated', self.on_event_row_activated) # to detect double click 
          self.tree_just_auto_expanded = False
          self.treeview.connect('test-collapse-row', self.on_test_collapse_row_tree)
          self.treeview.connect('button-press-event', self.on_mouse_button_clicked_tree)
          self.treeview.connect('key_press_event', self.on_key_press_cherrytree)
          self.treeview.connect('drag-motion', self.on_drag_motion_cherrytree)
          self.treeview.connect('drag-data-received', self.on_drag_data_recv_cherrytree)
          self.treeview.connect('drag-data-get', self.on_drag_data_get_cherrytree)
          self.scrolledwindow_tree.add(self.treeview)
          self.orphan_accel_group = gtk.AccelGroup()
          self.menu_tree_create()
          self.window.connect('delete-event', self.on_window_delete_event)
          self.window.connect("focus-out-event", self.on_window_focus_out_event)
          self.window.connect('window-state-event', self.on_window_state_event)
          self.window.connect("size-allocate", self.on_window_n_tree_size_allocate_event)
          self.window.connect('key_press_event', self.on_key_press_window)
          self.window.connect("destroy", self.boss.on_window_destroy_event)
          self.scrolledwindow_tree.connect("size-allocate", self.on_window_n_tree_size_allocate_event)
          self.sourcestyleschememanager = gtksourceview2.StyleSchemeManager()
          self.sourceview = gtksourceview2.View()
          self.sourceview.set_sensitive(False)
          self.sourceview.set_smart_home_end(gtksourceview2.SMART_HOME_END_AFTER)
          self.sourceview.connect('populate-popup', self.on_sourceview_populate_popup)
          self.sourceview.connect("event", self.on_sourceview_event)
          self.sourceview.connect("motion-notify-event", self.on_sourceview_motion_notify_event)
          self.sourceview.connect("visibility-notify-event", self.on_sourceview_visibility_notify_event)
          self.sourceview.connect("event-after", self.on_sourceview_event_after)
          self.sourceview.connect("copy-clipboard", self.clipboard_handler.copy, False)
          self.sourceview.connect("cut-clipboard", self.clipboard_handler.cut, False)
          self.sourceview.connect("paste-clipboard", self.clipboard_handler.paste)
          self.sourceview.set_left_margin(7)
          self.sourceview.set_right_margin(7)
          self.sourcebuffers = {}
          self.hovering_link_iter_offset = -1
          self.tag_table = gtk.TextTagTable()
          self.scrolledwindow_text.add(self.sourceview)
          self.progress_stop = False
          self.go_bk_fw_click = False
          self.highlighted_obj = None
          self.embfiles_opened = {}
          self.embfiles_sentinel_id = None
          self.codebox_sentinel_id = None
          self.bookmarks = []
          self.bookmarks_menu_items = []
          self.nodes_names_dict = {}
          self.password = None
          self.export_single = False
          self.last_include_node_name = True
          self.last_index_in_page = True
          self.last_new_node_page = False
          self.curr_tree_iter = None
          self.curr_window_n_tree_width = None
          self.curr_buffer = None
          self.node_add_is_duplication = False
          self.nodes_cursor_pos = {}
          self.links_entries = {'webs':'', 'file':'', 'fold':'', 'anch':'', 'node':None}
          self.tags_set = set()
          self.file_update = False
          self.anchor_size_mod = False
          self.embfile_size_mod = False
          self.embfile_show_filename_mod = False
          self.cursor_key_press = None
          self.autosave_timer_id = None
          self.spell_check_init = False
          self.writing_to_disk = False
          self.export_overwrite = False
          self.mod_time_sentinel_id = None
          self.mod_time_val = 0
          self.prefpage = 0
          support.set_menu_items_recent_documents(self)
          support.set_menu_items_special_chars(self)
          self.find_handler = findreplace.FindReplace(self)
          if not export_mode:
              self.window.show_all() # this before the config_file_apply that could hide something
              self.window.present()
          config.config_file_apply(self)
          self.combobox_prog_lang_init()
          if is_arg or not is_startup or self.reload_doc_last:
              self.file_startup_load(open_with_file, node_name)
          else: self.file_name = ""
          if self.tree_is_empty(): self.update_node_name_header()
          if cons.DISABLE_SYSTRAY: self.systray = False
          if self.systray:
              if not self.boss.systray_active:
                  self.status_icon_enable()
              if self.start_on_systray: self.window.hide_all()
          else: self.ui.get_widget("/MenuBar/FileMenu/exit_app").set_property(cons.STR_VISIBLE, False)
          if self.check_version: self.check_for_newer_version()
function_tokens: def __init__ ( self , lang_str , open_with_file , node_name , boss , is_startup , is_arg , export_mode ) : self . boss = boss self . filetype = "" self . user_active = True self . ctrl_down = False self . dead_key = "" self . window = gtk . Window ( ) self . window . set_title ( "CherryTree" ) self . window . set_default_size ( 963 , 630 ) self . window . set_icon_from_file ( os . path . join ( cons . GLADE_PATH , "cherrytree.png" ) ) # instantiate external handlers self . clipboard_handler = clipboard . ClipboardHandler ( self ) self . lists_handler = lists . ListsHandler ( self ) self . tables_handler = tablez . TablesHandler ( self ) self . codeboxes_handler = codeboxes . CodeBoxesHandler ( self ) self . state_machine = machines . StateMachine ( self ) self . xml_handler = machines . XMLHandler ( self ) self . html_handler = exports . Export2Html ( self ) self . ctdb_handler = ctdb . CTDBHandler ( self ) self . print_handler = printing . PrintHandler ( self ) # icon factory factory = gtk . IconFactory ( ) for stock_name in cons . STOCKS_N_FILES : filename = stock_name + ".png" filepath = os . path . join ( cons . GLADE_PATH , filename ) pixbuf = gtk . gdk . pixbuf_new_from_file ( filepath ) iconset = gtk . IconSet ( pixbuf ) factory . add ( stock_name , iconset ) factory . add_default ( ) # system settings try : gtk_settings = gtk . settings_get_default ( ) gtk_settings . set_property ( "gtk-button-images" , True ) gtk_settings . set_property ( "gtk-menu-images" , True ) except : pass # older gtk do not have the property "gtk-menu-images" vbox_main = gtk . VBox ( ) self . window . add ( vbox_main ) self . country_lang = lang_str self . cursor_position = 0 config . config_file_load ( self ) if not cons . HAS_APPINDICATOR : self . use_appind = False elif not cons . HAS_SYSTRAY : self . use_appind = True # ui manager actions = gtk . ActionGroup ( "Actions" ) actions . add_actions ( menus . get_entries ( self ) ) self . ui = gtk . UIManager ( ) self . ui . insert_action_group ( actions , 0 ) self . window . add_accel_group ( self . ui . get_accel_group ( ) ) self . ui . add_ui_from_string ( menus . UI_INFO ) self . ui . add_ui_from_string ( config . get_toolbar_ui_str ( self ) ) # menubar add vbox_main . pack_start ( self . ui . get_widget ( "/MenuBar" ) , False , False ) # toolbar add vbox_main . pack_start ( self . ui . get_widget ( "/ToolBar" ) , False , False ) # hpaned add self . hpaned = gtk . HPaned ( ) self . scrolledwindow_tree = gtk . ScrolledWindow ( ) self . scrolledwindow_tree . set_policy ( gtk . POLICY_AUTOMATIC , gtk . POLICY_AUTOMATIC ) self . scrolledwindow_text = gtk . ScrolledWindow ( ) self . scrolledwindow_text . set_policy ( gtk . POLICY_AUTOMATIC , gtk . POLICY_AUTOMATIC ) self . scrolledwindow_text . get_hscrollbar ( ) . connect ( 'value-changed' , self . on_hscrollbar_text_value_changed ) self . vbox_text = gtk . VBox ( ) self . header_node_name_eventbox = self . instantiate_node_name_header ( ) self . vbox_text . pack_start ( self . header_node_name_eventbox , False , False ) self . vbox_text . pack_start ( self . scrolledwindow_text ) if self . tree_right_side : self . hpaned . add1 ( self . vbox_text ) self . hpaned . add2 ( self . scrolledwindow_tree ) else : self . hpaned . add1 ( self . scrolledwindow_tree ) self . hpaned . add2 ( self . vbox_text ) vbox_main . pack_start ( self . hpaned ) # statusbar add self . statusbar = gtk . Statusbar ( ) self . statusbar_context_id = self . statusbar . get_context_id ( '' ) self . latest_statusbar_update_time = { } self . progressbar = gtk . ProgressBar ( ) progress_frame = gtk . Frame ( ) progress_frame . set_shadow_type ( gtk . SHADOW_NONE ) progress_frame . set_border_width ( 1 ) progress_frame . add ( self . progressbar ) self . progresstop = gtk . Button ( ) self . progresstop . set_image ( gtk . image_new_from_stock ( "gtk-stop" , gtk . ICON_SIZE_MENU ) ) self . progresstop . connect ( 'clicked' , self . on_button_progresstop_clicked ) hbox_statusbar = gtk . HBox ( ) hbox_statusbar . pack_start ( self . statusbar , True , True ) hbox_statusbar . pack_start ( progress_frame , False , True ) hbox_statusbar . pack_start ( self . progresstop , False , True ) vbox_main . pack_start ( hbox_statusbar , False , False ) # ROW: 0-icon_stock_id, 1-name, 2-buffer, 3-unique_id, 4-syntax_highlighting, 5-node_sequence, 6-tags, 7-readonly, 8-aux_icon_stock_id, 9-custom_icon_id, 10-weight, 11-foreground, 12-ts_creation, 13-ts_lastsave self . treestore = gtk . TreeStore ( str , str , gobject . TYPE_PYOBJECT , long , str , int , str , gobject . TYPE_BOOLEAN , str , int , int , str , float , float ) self . treeview = gtk . TreeView ( self . treestore ) self . treeview . set_headers_visible ( False ) self . treeview . drag_source_set ( gtk . gdk . BUTTON1_MASK , [ ( 'CT_DND' , gtk . TARGET_SAME_WIDGET , 0 ) ] , gtk . gdk . ACTION_MOVE ) self . treeview . drag_dest_set ( gtk . DEST_DEFAULT_ALL , [ ( 'CT_DND' , gtk . TARGET_SAME_WIDGET , 0 ) ] , gtk . gdk . ACTION_MOVE ) self . renderer_pixbuf = gtk . CellRendererPixbuf ( ) self . renderer_text = gtk . CellRendererText ( ) self . renderer_text . set_property ( 'wrap-mode' , pango . WRAP_WORD_CHAR ) self . aux_renderer_pixbuf = gtk . CellRendererPixbuf ( ) self . column = gtk . TreeViewColumn ( ) self . column . pack_start ( self . renderer_pixbuf , False ) self . column . pack_start ( self . renderer_text , True ) self . column . pack_start ( self . aux_renderer_pixbuf , False ) self . column . set_attributes ( self . renderer_pixbuf , stock_id = 0 ) self . column . set_attributes ( self . renderer_text , text = 1 , weight = 10 , foreground = 11 ) self . column . set_attributes ( self . aux_renderer_pixbuf , stock_id = 8 ) self . treeview . append_column ( self . column ) self . treeview . set_search_column ( 1 ) self . treeviewselection = self . treeview . get_selection ( ) self . treeview . connect ( 'cursor-changed' , self . on_node_changed ) self . treeview . connect ( 'event-after' , self . on_event_after_tree ) self . treeview . connect ( 'row-activated' , self . on_event_row_activated ) # to detect double click  self . tree_just_auto_expanded = False self . treeview . connect ( 'test-collapse-row' , self . on_test_collapse_row_tree ) self . treeview . connect ( 'button-press-event' , self . on_mouse_button_clicked_tree ) self . treeview . connect ( 'key_press_event' , self . on_key_press_cherrytree ) self . treeview . connect ( 'drag-motion' , self . on_drag_motion_cherrytree ) self . treeview . connect ( 'drag-data-received' , self . on_drag_data_recv_cherrytree ) self . treeview . connect ( 'drag-data-get' , self . on_drag_data_get_cherrytree ) self . scrolledwindow_tree . add ( self . treeview ) self . orphan_accel_group = gtk . AccelGroup ( ) self . menu_tree_create ( ) self . window . connect ( 'delete-event' , self . on_window_delete_event ) self . window . connect ( "focus-out-event" , self . on_window_focus_out_event ) self . window . connect ( 'window-state-event' , self . on_window_state_event ) self . window . connect ( "size-allocate" , self . on_window_n_tree_size_allocate_event ) self . window . connect ( 'key_press_event' , self . on_key_press_window ) self . window . connect ( "destroy" , self . boss . on_window_destroy_event ) self . scrolledwindow_tree . connect ( "size-allocate" , self . on_window_n_tree_size_allocate_event ) self . sourcestyleschememanager = gtksourceview2 . StyleSchemeManager ( ) self . sourceview = gtksourceview2 . View ( ) self . sourceview . set_sensitive ( False ) self . sourceview . set_smart_home_end ( gtksourceview2 . SMART_HOME_END_AFTER ) self . sourceview . connect ( 'populate-popup' , self . on_sourceview_populate_popup ) self . sourceview . connect ( "event" , self . on_sourceview_event ) self . sourceview . connect ( "motion-notify-event" , self . on_sourceview_motion_notify_event ) self . sourceview . connect ( "visibility-notify-event" , self . on_sourceview_visibility_notify_event ) self . sourceview . connect ( "event-after" , self . on_sourceview_event_after ) self . sourceview . connect ( "copy-clipboard" , self . clipboard_handler . copy , False ) self . sourceview . connect ( "cut-clipboard" , self . clipboard_handler . cut , False ) self . sourceview . connect ( "paste-clipboard" , self . clipboard_handler . paste ) self . sourceview . set_left_margin ( 7 ) self . sourceview . set_right_margin ( 7 ) self . sourcebuffers = { } self . hovering_link_iter_offset = - 1 self . tag_table = gtk . TextTagTable ( ) self . scrolledwindow_text . add ( self . sourceview ) self . progress_stop = False self . go_bk_fw_click = False self . highlighted_obj = None self . embfiles_opened = { } self . embfiles_sentinel_id = None self . codebox_sentinel_id = None self . bookmarks = [ ] self . bookmarks_menu_items = [ ] self . nodes_names_dict = { } self . password = None self . export_single = False self . last_include_node_name = True self . last_index_in_page = True self . last_new_node_page = False self . curr_tree_iter = None self . curr_window_n_tree_width = None self . curr_buffer = None self . node_add_is_duplication = False self . nodes_cursor_pos = { } self . links_entries = { 'webs' : '' , 'file' : '' , 'fold' : '' , 'anch' : '' , 'node' : None } self . tags_set = set ( ) self . file_update = False self . anchor_size_mod = False self . embfile_size_mod = False self . embfile_show_filename_mod = False self . cursor_key_press = None self . autosave_timer_id = None self . spell_check_init = False self . writing_to_disk = False self . export_overwrite = False self . mod_time_sentinel_id = None self . mod_time_val = 0 self . prefpage = 0 support . set_menu_items_recent_documents ( self ) support . set_menu_items_special_chars ( self ) self . find_handler = findreplace . FindReplace ( self ) if not export_mode : self . window . show_all ( ) # this before the config_file_apply that could hide something self . window . present ( ) config . config_file_apply ( self ) self . combobox_prog_lang_init ( ) if is_arg or not is_startup or self . reload_doc_last : self . file_startup_load ( open_with_file , node_name ) else : self . file_name = "" if self . tree_is_empty ( ) : self . update_node_name_header ( ) if cons . DISABLE_SYSTRAY : self . systray = False if self . systray : if not self . boss . systray_active : self . status_icon_enable ( ) if self . start_on_systray : self . window . hide_all ( ) else : self . ui . get_widget ( "/MenuBar/FileMenu/exit_app" ) . set_property ( cons . STR_VISIBLE , False ) if self . check_version : self . check_for_newer_version ( )