Skip to content

Commit

Permalink
UI details
Browse files Browse the repository at this point in the history
  • Loading branch information
jaakkonakaza committed Aug 27, 2024
1 parent 8272c78 commit facc5e4
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ internal class InitializationActivity() :
) {
val moduleModel = course.getComponentIfExists(module.name)
if (moduleModel is fi.aalto.cs.apluscourses.model.component.Module) {
moduleModel.loadToProject()
DumbService.getInstance(project).runWhenSmart {
moduleModel.loadToProject()
}
}
}
CourseManager.getInstance(project).refreshModuleStatuses()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ internal class APlusModuleBuilder : ModuleBuilder() {
inner class CourseSettingsStep(
val wizardContext: WizardContext
) : ModuleWizardStep() {
private var mainPanel = panel {}
private var mainPanel = JBScrollPane()
private val selectedLanguage = AtomicProperty<String>("")
private val dontImportSettings = AtomicProperty(false)
private var selectedSdk: AtomicProperty<ProjectWizardJdkIntent>? = null
Expand All @@ -209,7 +209,7 @@ internal class APlusModuleBuilder : ModuleBuilder() {
@NonNls val finnishCode = "fi"
if (languages.contains(finnishCode)) selectedLanguage.set(finnishCode) else selectedLanguage.set(languages.first())

mainPanel = panel {
mainPanel = JBScrollPane(panel {
panel {
group(message("generator.APlusModuleBuilder.language")) {
row {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package fi.aalto.cs.apluscourses.services

import com.intellij.openapi.components.Service
import com.intellij.openapi.project.Project
import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.launch

@Service(Service.Level.PROJECT)
class ProjectInitializationTracker(val project: Project, val cs: CoroutineScope) {
Expand All @@ -14,6 +16,15 @@ class ProjectInitializationTracker(val project: Project, val cs: CoroutineScope)
initializationTasks.add(task)
}

fun addInitializationTask(task: suspend () -> Unit) {
val deferred = CompletableDeferred<Boolean>()
initializationTasks.add(deferred)
cs.launch {
task()
deferred.complete(true)
}
}

suspend fun waitForAllTasks() {
initializationTasks.awaitAll()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.intellij.openapi.fileEditor.FileEditorManager
import com.intellij.openapi.fileEditor.impl.HTMLEditorProvider.Companion.openEditor
import com.intellij.openapi.project.Project
import com.intellij.ui.JBColor
import com.intellij.ui.jcef.JBCefScrollbarsHelper
import com.intellij.util.ui.JBFont
import fi.aalto.cs.apluscourses.MyBundle.message
import fi.aalto.cs.apluscourses.api.APlusApi
Expand Down Expand Up @@ -76,7 +77,7 @@ class ShowFeedback(
.replace(Regex("(--font-name:\\s*)(.*;)"), "$1\"$fontName\";"),
Safelist.none()
)
}</style>"
}${JBCefScrollbarsHelper.buildScrollbarsStyle()}</style>"

document.head().append(style)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,19 @@ class SubmitExerciseDialog(
}
}
row {
text(message("ui.SubmitExerciseDialog.description", submissionNumber, exercise.maxSubmissions))
text(
if (exercise.maxSubmissions < 1) message(
"ui.SubmitExerciseDialog.descriptionOptional",
submissionNumber
) else message(
"ui.SubmitExerciseDialog.description",
submissionNumber,
exercise.maxSubmissions
)
)
}
row {
if (submissionNumber >= exercise.maxSubmissions) {
if (!exercise.isOptional && submissionNumber >= exercise.maxSubmissions) {
text(
if (submissionNumber == exercise.maxSubmissions) message("ui.SubmitExerciseDialog.warning.lastSubmission")
else message("ui.SubmitExerciseDialog.warning.submissionsExceeded")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import com.intellij.util.ui.JBUI
import com.intellij.util.ui.UIUtil
import fi.aalto.cs.apluscourses.MyBundle.message
import fi.aalto.cs.apluscourses.icons.CoursesIcons
import fi.aalto.cs.apluscourses.model.component.Component
import fi.aalto.cs.apluscourses.model.component.Module
import fi.aalto.cs.apluscourses.services.CoursesClient
import fi.aalto.cs.apluscourses.services.Opener
Expand Down Expand Up @@ -144,6 +145,9 @@ class ModuleRenderer(
}

private fun Panel.available() {
if (module.status == Component.Status.LOADING) {
installing.set(true)
}
row {
info(zipSizeText.get())
.bindText(zipSizeText)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class OverviewView(private val project: Project) : SimpleToolWindowPanel(true, t
val content = JBScrollPane(panel)
content.horizontalScrollBarPolicy =
if (isMainPanel) ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED else ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER
content.verticalScrollBarPolicy = ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED
setContent(content)
}

Expand Down Expand Up @@ -267,7 +268,8 @@ class OverviewView(private val project: Project) : SimpleToolWindowPanel(true, t
}
}.customize(UnscaledGaps(16, 32, 16, 32))
}
mainPanel.preferredSize = Dimension(mainPanelMaxWidth, Int.MAX_VALUE)
mainPanel.preferredSize = Dimension(mainPanelMaxWidth, mainPanel.preferredSize.height)
// mainPanel.maximumSize = Dimension(mainPanelMaxWidth, Int.MAX_VALUE)
return mainPanel
}

Expand Down
1 change: 1 addition & 0 deletions src/main/resources/messages/resources.properties
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ ui.SubmitExerciseDialog.group=Group:
ui.SubmitExerciseDialog.groupDefaultButton=Set as Default
ui.SubmitExerciseDialog.cantChangeGroup=You cannot change the group after submitting.
ui.SubmitExerciseDialog.description=You are about to make submission {0} out of {1}.
ui.SubmitExerciseDialog.descriptionOptional=You are about to make submission {0}.
ui.SubmitExerciseDialog.warning.lastSubmission=This is your last available submission for this assignment. Make sure to test your solution thoroughly before submitting. If needed, discuss any remaining issues with the course staff.
ui.SubmitExerciseDialog.warning.submissionsExceeded=You have already used up all your submission attempts for this assignment. You can still submit, but further submissions won't count towards your point total.
# Module
Expand Down

0 comments on commit facc5e4

Please sign in to comment.