Fix overlapping config elements in config overview
This commit is contained in:
@@ -27,6 +27,7 @@ import io.ktor.client.plugins.compression.*
|
|||||||
import io.ktor.client.plugins.contentnegotiation.*
|
import io.ktor.client.plugins.contentnegotiation.*
|
||||||
import io.ktor.client.plugins.logging.*
|
import io.ktor.client.plugins.logging.*
|
||||||
import io.ktor.serialization.kotlinx.json.*
|
import io.ktor.serialization.kotlinx.json.*
|
||||||
|
import java.lang.Exception
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback
|
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback
|
||||||
@@ -39,6 +40,7 @@ import net.fabricmc.loader.api.metadata.ModMetadata
|
|||||||
import org.apache.logging.log4j.LogManager
|
import org.apache.logging.log4j.LogManager
|
||||||
import org.apache.logging.log4j.Logger
|
import org.apache.logging.log4j.Logger
|
||||||
import org.freedesktop.dbus.connections.impl.DBusConnectionBuilder
|
import org.freedesktop.dbus.connections.impl.DBusConnectionBuilder
|
||||||
|
import org.freedesktop.dbus.exceptions.DBusException
|
||||||
import kotlinx.coroutines.CoroutineName
|
import kotlinx.coroutines.CoroutineName
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
@@ -98,8 +100,12 @@ object Firmament {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val globalJob = Job()
|
val globalJob = Job()
|
||||||
val dbusConnection = DBusConnectionBuilder.forSessionBus()
|
val dbusConnection = try {
|
||||||
.build()
|
DBusConnectionBuilder.forSessionBus()
|
||||||
|
.build()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
null
|
||||||
|
}
|
||||||
val coroutineScope =
|
val coroutineScope =
|
||||||
CoroutineScope(EmptyCoroutineContext + CoroutineName("Firmament")) + SupervisorJob(globalJob)
|
CoroutineScope(EmptyCoroutineContext + CoroutineName("Firmament")) + SupervisorJob(globalJob)
|
||||||
|
|
||||||
@@ -117,12 +123,16 @@ object Firmament {
|
|||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun onClientInitialize() {
|
fun onClientInitialize() {
|
||||||
dbusConnection.requestBusName("moe.nea.firmament")
|
try {
|
||||||
|
dbusConnection?.exportObject(FirmamentDbusObject)
|
||||||
|
dbusConnection?.requestBusName("moe.nea.firmament")
|
||||||
|
} catch (e: DBusException) {
|
||||||
|
// :(
|
||||||
|
}
|
||||||
var tick = 0
|
var tick = 0
|
||||||
ClientTickEvent.CLIENT_POST.register(ClientTickEvent.Client { instance ->
|
ClientTickEvent.CLIENT_POST.register(ClientTickEvent.Client { instance ->
|
||||||
TickEvent.publish(TickEvent(tick++))
|
TickEvent.publish(TickEvent(tick++))
|
||||||
})
|
})
|
||||||
dbusConnection.exportObject(FirmamentDbusObject)
|
|
||||||
IDataHolder.registerEvents()
|
IDataHolder.registerEvents()
|
||||||
RepoManager.initialize()
|
RepoManager.initialize()
|
||||||
SBData.init()
|
SBData.init()
|
||||||
|
|||||||
@@ -23,8 +23,11 @@ import io.github.cottonmc.cotton.gui.client.CottonClientScreen
|
|||||||
import io.github.cottonmc.cotton.gui.client.LightweightGuiDescription
|
import io.github.cottonmc.cotton.gui.client.LightweightGuiDescription
|
||||||
import io.github.cottonmc.cotton.gui.widget.WBox
|
import io.github.cottonmc.cotton.gui.widget.WBox
|
||||||
import io.github.cottonmc.cotton.gui.widget.WButton
|
import io.github.cottonmc.cotton.gui.widget.WButton
|
||||||
|
import io.github.cottonmc.cotton.gui.widget.WClippedPanel
|
||||||
import io.github.cottonmc.cotton.gui.widget.WGridPanel
|
import io.github.cottonmc.cotton.gui.widget.WGridPanel
|
||||||
import io.github.cottonmc.cotton.gui.widget.WLabel
|
import io.github.cottonmc.cotton.gui.widget.WLabel
|
||||||
|
import io.github.cottonmc.cotton.gui.widget.WPanel
|
||||||
|
import io.github.cottonmc.cotton.gui.widget.WPanelWithInsets
|
||||||
import io.github.cottonmc.cotton.gui.widget.WScrollPanel
|
import io.github.cottonmc.cotton.gui.widget.WScrollPanel
|
||||||
import io.github.cottonmc.cotton.gui.widget.data.Axis
|
import io.github.cottonmc.cotton.gui.widget.data.Axis
|
||||||
import io.github.cottonmc.cotton.gui.widget.data.Insets
|
import io.github.cottonmc.cotton.gui.widget.data.Insets
|
||||||
@@ -33,6 +36,7 @@ import net.minecraft.client.gui.screen.Screen
|
|||||||
import net.minecraft.text.Text
|
import net.minecraft.text.Text
|
||||||
import moe.nea.firmament.features.FeatureManager
|
import moe.nea.firmament.features.FeatureManager
|
||||||
import moe.nea.firmament.gui.WFixedPanel
|
import moe.nea.firmament.gui.WFixedPanel
|
||||||
|
import moe.nea.firmament.gui.WTightScrollPanel
|
||||||
import moe.nea.firmament.repo.RepoManager
|
import moe.nea.firmament.repo.RepoManager
|
||||||
import moe.nea.firmament.util.MC
|
import moe.nea.firmament.util.MC
|
||||||
import moe.nea.firmament.util.ScreenUtil.setScreenLater
|
import moe.nea.firmament.util.ScreenUtil.setScreenLater
|
||||||
@@ -58,12 +62,18 @@ object AllConfigsGui {
|
|||||||
}, 0, 1, 10, 1)
|
}, 0, 1, 10, 1)
|
||||||
box.add(WFixedPanel(panel))
|
box.add(WFixedPanel(panel))
|
||||||
}
|
}
|
||||||
box.insets = Insets.ROOT_PANEL
|
lwgd.setRootPanel(WBox(
|
||||||
lwgd.setRootPanel(WScrollPanel((box)).also {
|
Axis.VERTICAL
|
||||||
|
).also {
|
||||||
|
it.insets = Insets.ROOT_PANEL
|
||||||
box.layout()
|
box.layout()
|
||||||
it.setSize(box.width + 8, MC.window.scaledHeight / 2)
|
it.add(WFixedPanel((WTightScrollPanel((box)).also {
|
||||||
|
it.setSize(0, MC.window.scaledHeight / 2)
|
||||||
|
})))
|
||||||
|
it.setSize(0, MC.window.scaledHeight / 2)
|
||||||
})
|
})
|
||||||
screen = object : CottonClientScreen(lwgd) {
|
|
||||||
|
screen = object : CottonClientScreen(lwgd) {
|
||||||
override fun close() {
|
override fun close() {
|
||||||
MC.screen = parent
|
MC.screen = parent
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user