<commit_before>path = require 'path'

fs = require 'fs-plus'
fuzzaldrin = require 'fuzzaldrin'
_ = require 'underscore-plus'
{CompositeDisposable} = require 'atom'
{$$, TextEditorView, View} = require 'atom-space-pen-views'
{Subscriber} = require 'emissary'

AvailablePackageView = require './available-package-view'
ErrorView = require './error-view'
PackageManager = require './package-manager'

module.exports =
class ThemesPanel extends View
  Subscriber.includeInto(this)

  @content: ->
    @div =>
      @div class: 'section packages themes-panel', =>
        @div class: 'section-container', =>
          @div class: 'section-heading icon icon-device-desktop', 'Choose a Theme'

          @div class: 'text native-key-bindings', tabindex: -1, =>
            @span class: 'icon icon-question', 'You can also style Atom by editing '
            @a class: 'link', outlet: 'openUserStysheet', 'your stylesheet'

          @div class: 'control-group', =>
            @div class: 'controls', =>
              @label class: 'control-label', =>
                @div class: 'setting-title themes-label text', 'UI Theme'
                @div class: 'setting-description text theme-description', 'This styles the tabs, status bar, tree view, and dropdowns'
              @select outlet: 'uiMenu', class: 'form-control'

          @div class: 'control-group', =>
            @div class: 'controls', =>
              @label class: 'control-label', =>
                @div class: 'setting-title themes-label text', 'Syntax Theme'
                @div class: 'setting-description text theme-description', 'This styles the text inside the editor'
              @select outlet: 'syntaxMenu', class: 'form-control'

      @section class: 'section', =>
        @div class: 'section-container', =>
          @div class: 'section-heading icon icon-paintcan', =>
            @text 'Installed Themes'
            @span outlet: 'totalPackages', class:'section-heading-count', ' (…)'
          @div class: 'editor-container', =>
            @subview 'filterEditor', new TextEditorView(mini: true, placeholderText: 'Filter themes by name')

          @div outlet: 'themeErrors'

          @section class: 'sub-section installed-packages', =>
            @h3 class: 'sub-section-heading icon icon-paintcan', =>
              @text 'Community Themes'
              @span outlet: 'communityCount', class:'section-heading-count', ' (…)'
            @div outlet: 'communityPackages', class: 'container package-container', =>
              @div class: 'alert alert-info loading-area icon icon-hourglass', "Loading themes…"

          @section class: 'sub-section core-packages', =>
            @h3 class: 'sub-section-heading icon icon-paintcan', =>
              @text 'Core Themes'
              @span outlet: 'coreCount', class:'section-heading-count', ' (…)'
            @div outlet: 'corePackages', class: 'container package-container', =>
              @div class: 'alert alert-info loading-area icon icon-hourglass', "Loading themes…"

          @section class: 'sub-section dev-packages', =>
            @h3 class: 'sub-section-heading icon icon-paintcan', =>
              @text 'Development Themes'
              @span outlet: 'devCount', class:'section-heading-count', ' (…)'
            @div outlet: 'devPackages', class: 'container package-container', =>
              @div class: 'alert alert-info loading-area icon icon-hourglass', "Loading themes…"


  initialize: (@packageManager) ->
    @disposables = new CompositeDisposable()
    @packageViews = []
    @loadPackages()

    @subscribe @packageManager, 'theme-install-failed theme-uninstall-failed', (pack, error) =>
      @themeErrors.append(new ErrorView(@packageManager, error))

    @openUserStysheet.on 'click', =>
      atom.commands.dispatch(atom.views.getView(atom.workspace), 'application:open-your-stylesheet')
      false

    @subscribe @packageManager, 'theme-installed', =>
      @populateThemeMenus()
<commit_msg>Update menu when themes are uninstalled<commit_after>path = require 'path'

fs = require 'fs-plus'
fuzzaldrin = require 'fuzzaldrin'
_ = require 'underscore-plus'
{CompositeDisposable} = require 'atom'
{$$, TextEditorView, View} = require 'atom-space-pen-views'
{Subscriber} = require 'emissary'

AvailablePackageView = require './available-package-view'
ErrorView = require './error-view'
PackageManager = require './package-manager'

module.exports =
class ThemesPanel extends View
  Subscriber.includeInto(this)

  @content: ->
    @div =>
      @div class: 'section packages themes-panel', =>
        @div class: 'section-container', =>
          @div class: 'section-heading icon icon-device-desktop', 'Choose a Theme'

          @div class: 'text native-key-bindings', tabindex: -1, =>
            @span class: 'icon icon-question', 'You can also style Atom by editing '
            @a class: 'link', outlet: 'openUserStysheet', 'your stylesheet'

          @div class: 'control-group', =>
            @div class: 'controls', =>
              @label class: 'control-label', =>
                @div class: 'setting-title themes-label text', 'UI Theme'
                @div class: 'setting-description text theme-description', 'This styles the tabs, status bar, tree view, and dropdowns'
              @select outlet: 'uiMenu', class: 'form-control'

          @div class: 'control-group', =>
            @div class: 'controls', =>
              @label class: 'control-label', =>
                @div class: 'setting-title themes-label text', 'Syntax Theme'
                @div class: 'setting-description text theme-description', 'This styles the text inside the editor'
              @select outlet: 'syntaxMenu', class: 'form-control'

      @section class: 'section', =>
        @div class: 'section-container', =>
          @div class: 'section-heading icon icon-paintcan', =>
            @text 'Installed Themes'
            @span outlet: 'totalPackages', class:'section-heading-count', ' (…)'
          @div class: 'editor-container', =>
            @subview 'filterEditor', new TextEditorView(mini: true, placeholderText: 'Filter themes by name')

          @div outlet: 'themeErrors'

          @section class: 'sub-section installed-packages', =>
            @h3 class: 'sub-section-heading icon icon-paintcan', =>
              @text 'Community Themes'
              @span outlet: 'communityCount', class:'section-heading-count', ' (…)'
            @div outlet: 'communityPackages', class: 'container package-container', =>
              @div class: 'alert alert-info loading-area icon icon-hourglass', "Loading themes…"

          @section class: 'sub-section core-packages', =>
            @h3 class: 'sub-section-heading icon icon-paintcan', =>
              @text 'Core Themes'
              @span outlet: 'coreCount', class:'section-heading-count', ' (…)'
            @div outlet: 'corePackages', class: 'container package-container', =>
              @div class: 'alert alert-info loading-area icon icon-hourglass', "Loading themes…"

          @section class: 'sub-section dev-packages', =>
            @h3 class: 'sub-section-heading icon icon-paintcan', =>
              @text 'Development Themes'
              @span outlet: 'devCount', class:'section-heading-count', ' (…)'
            @div outlet: 'devPackages', class: 'container package-container', =>
              @div class: 'alert alert-info loading-area icon icon-hourglass', "Loading themes…"


  initialize: (@packageManager) ->
    @disposables = new CompositeDisposable()
    @packageViews = []
    @loadPackages()

    @subscribe @packageManager, 'theme-install-failed theme-uninstall-failed', (pack, error) =>
      @themeErrors.append(new ErrorView(@packageManager, error))

    @openUserStysheet.on 'click', =>
      atom.commands.dispatch(atom.views.getView(atom.workspace), 'application:open-your-stylesheet')
      false

    @subscribe @packageManager, 'theme-installed theme-uninstalled', =>
      @populateThemeMenus()

{'fraction_non_alphanumeric': 0.13851351351351351, 'fraction_numerical': 0.001001001001001001, 'mean_word_length': 2.784564393939394, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3707433', 'n_tokens_mistral': 2261, 'n_tokens_neox': 2164, 'n_words': 612}